custom nrpe plugin in nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
divyaimca
Posts: 5
Joined: Wed Nov 21, 2012 8:12 am

custom nrpe plugin in nagios

Post 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 ??
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: custom nrpe plugin in nagios

Post 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 :)
divyaimca
Posts: 5
Joined: Wed Nov 21, 2012 8:12 am

Re: custom nrpe plugin in nagios

Post 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 ??
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: custom nrpe plugin in nagios

Post 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
divyaimca
Posts: 5
Joined: Wed Nov 21, 2012 8:12 am

Re: custom nrpe plugin in nagios

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

Re: custom nrpe plugin in nagios

Post 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.
divyaimca
Posts: 5
Joined: Wed Nov 21, 2012 8:12 am

Re: custom nrpe plugin in nagios

Post by divyaimca »

Dear slansing, I didnt get you
open service's detail page
which service's ??
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: custom nrpe plugin in nagios

Post 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.
divyaimca
Posts: 5
Joined: Wed Nov 21, 2012 8:12 am

Re: custom nrpe plugin in nagios

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

Re: custom nrpe plugin in nagios

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