I am trying to write a script that enables me to install agents for Nagios XI on systems.
Script is like so (pretty simple)
#!/bin/bash
###########################
# This script is used to install Nagios XI Agents
# on target systems rather than manually installing
############################
# Move to /tmp for install
cd /tmp
#Pickup agent package
wget
http://assets.nagios.com/downloads/n...e-agent.tar.gz
#Untar package
tar xvfz linux-nrpe-agent.tar.gz
#Move into agent directory
cd linux-nrpe-agent
#Run full install script
./fullinstall
#### IN HERE I NEED THE PROPER EXPECT STATEMENT ######
##Install asks if you want to proceed (Do you want to continue? [Y/n])
##Then when install is complete "Allow from:" is asked. IP Address(es) of Nagios server(s) goes here
### So, two answers are needed
##I know THIS cannot be right##
expect Do you want to continue? [Y/n]
send Y
expect Allow from:
send XXX.XXX.XXX.XXX
#Restart xinetd service
/etc/init.d/xinetd restart
When the agent install is complete (
THIS POINT OF THE SCRIPT ) the IP Address of the Nagios system doing the monitoring needs to be entered. I am sure this is a simple statement that is escaping me. However - I am experiencing a true brain cramp.
How do I enter the IP address (expect statement?) into this script so it can proceed without manual entry?
Recent comments
2 days 13 hours ago
2 days 22 hours ago
3 days 1 hour ago
3 days 2 hours ago
3 days 3 hours ago
3 days 5 hours ago
3 days 6 hours ago
3 days 8 hours ago
4 days 7 min ago
4 days 56 min ago