Page 1 of 1
script output has more that 3 status
Posted: Sun Aug 18, 2013 4:33 am
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
Re: script output has more that 3 status
Posted: Sun Aug 18, 2013 7:37 pm
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!
Re: script output has more that 3 status
Posted: Sun Aug 18, 2013 11:40 pm
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 !
Re: script output has more that 3 status
Posted: Mon Aug 19, 2013 10:45 am
by slansing
Thanks Jsmurphy! Closing as resolved.