script output has more that 3 status

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
natalia
Posts: 8
Joined: Sun Jul 28, 2013 5:38 am

script output has more that 3 status

Post by natalia »

Hello,

we run script that return value : 0,1,2,3,4,5 and according the value different application message should be appeared in dashboard/console, for example:

0- OK
1- Problem with connection
2- Problem with login
3- No input data
4- Process is not running
5- Data incorrect
6- Problem with connection solved

“0-OK” should ack all active alerts
“6- Problem with connection solved” – should ack only “1-Problem with connection”

How can I implement this ?

Thanks for your help !
Natalia
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: script output has more that 3 status

Post by jsmurphy »

The behaviour of how Nagios handles the monitoring scripts is immutable, you cannot modify that behaviour.
Nagios will only ever understand 4 return codes:
0 - OK
1 - Warning
2 - Critical
3 - Unknown

Nagios will always display the last message handed to STDOUT (print, echo, etc) as the description displayed in the console. When dealing with Nagios monitoring you need to think of each service as a self contained monitoring entity in that it only pertains to a single "piece" of the monitoring. There are usually two distinct ways you can handle this:

1.
Have your script check all of the the named condition and only return the "worst status" and have the description text list all currently active problems.

2.
Alternatively you will probably want to break this check into several different services and use a Business Process Addon (http://exchange.nagios.org/directory/Ad ... 29/details) to combine those back into an "application". Create a service that only checks for the conditions you have associated with return code 0, 1 and 6 and call that "My Application Connection availability", then create another service for "My Application Running", so on and so forth until you have all distinct failure cases captured.

Hopefully this helps you better understand how Nagios monitoring is usually approached!
natalia
Posts: 8
Joined: Sun Jul 28, 2013 5:38 am

Re: script output has more that 3 status

Post by natalia »

Hello,

Many thanks for the quick response and your suggestions !!!!!!

Now it's more clear for me regarding the nagios event handling.


Thanks for the help !
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: script output has more that 3 status

Post by slansing »

Thanks Jsmurphy! Closing as resolved.
Locked