Handling different states

Stuart Browne stuart.browne at ausregistry.com.au
Tue Sep 21 09:30:00 CEST 2010


> -----Original Message-----
> From: sandman42 at libero.it [mailto:sandman42 at libero.it]
> Sent: Tuesday, 21 September 2010 16:31
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Handling different states
> 
> Hi all,
> 
> I've written a plugin that looks for number of record processed. If
> they are
> below the thresold, it writes to stdout 'All OK' and exit with code 0.
> If thet
> are above it writes "Too many records" and exits with code 2, and this
> event
> triggers a mail notification with Down as problem, and "Too many
> records" as
> info.
> 
> All is working fine.
> 
> What I'd need is to handle a third situation: no records processed.
> Assuming I
> may trigger the condition in the same script:
> 
> 1) How can I notify Nagios of this event? Using a different exit code?
> 2) How can I modify Nagios notification, so I don't have a problem
> Down, but
> something else, say "Resource hog"?
> 
> Thanks

Nagios understands exit codes 0 (OK), 1 (WARNING), 2 (CRITICAL), 3 (UNKNOWN) and 4 (DEPENDANT) for services.

You can use these in any way you desire to present your exit information.  I'd advise against using DEPENDANT as a regular exit state as it has other implications in availability decisions.

More details:

http://nagios.sourceforge.net/docs/3_0/pluginapi.html

Stuart

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list