Page 1 of 1

custom nrpe plugin in nagios

Posted: Wed Nov 21, 2012 8:18 am
by divyaimca
I have created a custom script with perl. But I am unable to use it in nagios with nrpe to monitor remote system.

On the host its working fine but with nagios its throwing error:
CHECK_NRPE: Socket timeout after 30 seconds
Can any one guide me how to add custom script to use with nrpe remote linux ??

Re: custom nrpe plugin in nagios

Posted: Wed Nov 21, 2012 5:21 pm
by jsmurphy
See the section "Customizing your configuration": http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf

If you're still having trouble, post up some more information on what you've done/tried so far :)

Re: custom nrpe plugin in nagios

Posted: Thu Nov 22, 2012 12:18 am
by divyaimca
Yes. Its now solved. I actually forgot to add the full path of the command in the sudo file for the nagios user in the remote system.


But I am facing simple problems here. My script is written in Perl and it has multiline output.

How will I display the multiline output in nagios page ??

The output has mix of OK,critical and warning , So how the proper colour will be displayed in the nagios page ??

Re: custom nrpe plugin in nagios

Posted: Sun Nov 25, 2012 7:04 pm
by jsmurphy
A Nagios script can only have one print statement... everything except the last print statement will be ignored. In order to do multi-line output you need to separate the lines using the newline seperator. Nagios will also only display the first line of multi-line output unless you click on the service to get the full detailed information.

The colour displayed (aka state) in Nagios isn't determined by the words OK, Critical, etc in the description text... The state is determined by the exit code of the script.
OK: exit 0
Warning: exit 1
Critical: exit 2
Unknown: exit 3

Hopefully this clears things up for you. You can also read the full developer guidelines here: http://nagiosplug.sourceforge.net/devel ... lines.html

Re: custom nrpe plugin in nagios

Posted: Mon Nov 26, 2012 5:21 am
by divyaimca
Thanks JSmurphy, I was able to display colors correctly by using exit codes. But not got any clue for multi line output. In document also its saying, out of luck if returns more than one line.

Please guide me if any other way for multi line output.

Re: custom nrpe plugin in nagios

Posted: Mon Nov 26, 2012 1:39 pm
by slansing
The only way to get multi line output in the web interface is to open the Service's details page, the overview of all services will not display multiple lines.

Re: custom nrpe plugin in nagios

Posted: Mon Nov 26, 2012 11:09 pm
by divyaimca
Dear slansing, I didnt get you
open service's detail page
which service's ??

Re: custom nrpe plugin in nagios

Posted: Tue Nov 27, 2012 2:41 pm
by agriffin
divyaimca wrote:
slansing wrote:open service's detail page
which service's ??
Whatever service has the multiple lines of output that you want to view. Most pages in the Nagios interface will only display one line of plugin output. If a service returns more than one line, you must go to its Service Detail page to view the rest.

Re: custom nrpe plugin in nagios

Posted: Wed Nov 28, 2012 2:28 am
by divyaimca
Yes, the multi-line output is there in the service details page, but cant it be displayed in the front page where all the services are listed ?? :?:

Re: custom nrpe plugin in nagios

Posted: Wed Nov 28, 2012 12:51 pm
by slansing
Please see jsmurphy's post above:
In order to do multi-line output you need to separate the lines using the newline seperator. Nagios will also only display the first line of multi-line output unless you click on the service to get the full detailed information.