Automation in Nagios

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
lafargeuser
Posts: 341
Joined: Thu Sep 27, 2012 12:23 am

Automation in Nagios

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Automation in Nagios

Post by slansing »

These are possible, have you taken a look at the following?:

http://exchange.nagios.org/directory/Pl ... rs/details
lafargeuser
Posts: 341
Joined: Thu Sep 27, 2012 12:23 am

Re: Automation in Nagios

Post 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
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Automation in Nagios

Post 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/
Nicholas Scott
Former Nagios employee
lafargeuser
Posts: 341
Joined: Thu Sep 27, 2012 12:23 am

Re: Automation in Nagios

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Automation in Nagios

Post 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:

Code: Select all

vi /usr/local/nagios/etc/nrpe.cfg
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.
lafargeuser
Posts: 341
Joined: Thu Sep 27, 2012 12:23 am

Re: Automation in Nagios

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Automation in Nagios

Post 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.
Locked