Page 1 of 1
Automation in Nagios
Posted: Thu Dec 27, 2012 3:34 am
by lafargeuser
In NagiosXI below are the things i am looking ?
Identify and restarting the service in case of High CPU & Memory Utilization.
Identify top 5 process as part of CPU & Memory Monitoring.
Re: Automation in Nagios
Posted: Thu Dec 27, 2012 10:28 am
by slansing
These are possible, have you taken a look at the following?:
http://exchange.nagios.org/directory/Pl ... rs/details
Re: Automation in Nagios
Posted: Mon Jan 07, 2013 8:15 am
by lafargeuser
Uploaded plugin in Nagiso XI server.
Trying to run below command from XI. It throws error.
#./check_cpu_stats.sh -H 172.17.98.78
-bash: ./check_cpu_stats.sh: /bin/ksh^M: bad interpreter: No such file or directory
Re: Automation in Nagios
Posted: Mon Jan 07, 2013 10:28 am
by nscott
A few things, the error you posted:
-bash: ./check_cpu_stats.sh: /bin/ksh^M: bad interpreter: No such file or directory
ksh does not ship out with Nagios XI, so you may need to install it yourself, so login to the Nagios XI server with a terminal session and:
yum install ksh
And the ^M at the end could be troublesome as well, if the above doesn't fix it, you may need to replace all of the ^M that are the cause of editing a file in the Windows environment and then bringing it to the Linux environment. You can solve it by following this solution:
http://www.tech-recipes.com/rx/150/remo ... nes-in-vi/
Re: Automation in Nagios
Posted: Wed Jan 09, 2013 8:28 am
by lafargeuser
Thanks, nscott.
This is working fine in local linux server.But, what if i want to monitor remote linux server, how can i call that script from Nagios.
So that, it will report me same detailed.
Re: Automation in Nagios
Posted: Wed Jan 09, 2013 10:17 am
by slansing
You will need to install NRPE on the remote system, and configure it to run this script, please follow these guides:
Installationg:
http://assets.nagios.com/downloads/nagi ... _Agent.pdf
A brief overview of using NRPE with XI:
http://assets.nagios.com/downloads/nagi ... g_NRPE.pdf
Once installed on the remote machine, make sure that that system's new nrpe.cfg file has your nagios xi server in it's "allowed_hosts" section so that they can communicate and you must add the new plugin as a command definition so NRPE knows what to do with it:
Under the Command Definitions section at the bottom add:
Code: Select all
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh -w $ARG1$ -c $ARG2$ "Anything else the files help flag told you to add"
. You will also need to place your plugin shell script in the /usr/local/nagios/libexec folder on the remote system making sure that it has execute privilages. Your Nagios server's firewall must allow port 5666 TCP/UDP to be open and this should already be configured on the remote system via the install script in the first document.
To test your new plugin, on your nagios system run the following:
Code: Select all
/usr/local/nagios/libexec/check_cpu_stats.sh -H "HOST IP HERE" -c check_cpu_stats -w "your desired warning value" -c "your desired critical value" "anything else the help file told you to add"
Once you have done this and it is functioning let us know, then we can help you set it up in the xi web interface.
Re: Automation in Nagios
Posted: Mon Jan 21, 2013 9:23 am
by lafargeuser
http://exchange.nagios.org/directory/Pl ... cs/details
Pls. help how can i use this plugin.
/check_iostat:
-d <disk> Device to be checked (without the full path, eg. sda)
-c <tps>,<read>,<wrtn> Sets the CRITICAL level for tps, KB_read/s and KB_written/s, respectively
-w <tps>,<read>,<wrtn> Sets the WARNING level for tps, KB_read/s and KB_written/s, respectively
dont know what i have to enter on XI. bit confused -c & -w. How can i get result of remote machine
Re: Automation in Nagios
Posted: Mon Jan 21, 2013 11:08 am
by slansing
I would start by just inputting a value for -d so that you can see what the other system outputs, then you should be able to see in what fashion the other arguments must be formatted.