-   Linux - Software (
-   -   Nagios plugin development question. (

knockout_artist 02-05-2010 01:45 PM

Nagios plugin development question.

How do nagios decide to turn certain input into red and decide they are critical?

Are they evaluated against -c and -w arguments? if so at what point.

We take custom out put for our applications, but where there is no output it just shows nothing.
Now we want it to go red and send alerts.

What I have tired is

1-send '-c' argument which I chose it to be 3.
2- on libexec side, I printed 4.

But all it does is print 4. That it.

So what I do to see if the things is on critical level and stuff.


EricTRA 02-05-2010 01:55 PM


Nagios uses plugins for the host and service checks. They provide four different return values: O (OK), 1 (WARNING), 2 (CRITICAL), and 3 (UNKNOWN). That's how Nagios get's feedback from the plugins.

You can read some more about it here (old article but still valid info).
Nagios Basics

Nagios determines the states of services and hosts from the return values of the plugin. The states for services are the same as the return values OK, WARNING, CRITICAL and UNKNOWN. For the hosts the picture is slightly different: the UP state describes a reachable host, DOWN means that the computer is down, and UNREACHABLE refers to the state of nonreachability, where Nagios cannot test whether the host is available or not, because a parent is down (see Section 4.1, page 72).

In addition to this, Nagios makes a distinction between two types of state: soft state and hard state. If a problem occurs for the first time (that is, if there was nothing wrong with the state of a service until now) then the program categorizes the new state initially as a soft state and repeats the test several times. It may be the case that the error state was just a one-off event that was eliminated a short while later. Only if the error continues to exist after multiple testing is it then categorized by Nagios as a hard state. Administrators are informed only of hard states, because messages involving short-term disruptions that disappear again immediately afterwards only add to an unnecessary flood of information.
and some more information on the sourceforge pages at

Kind regards,


knockout_artist 02-05-2010 03:01 PM

Thanks Eric.

I found the solution.

What ever the return value plugin produce thats get evaluated.

What I did before was



echo  CRITICAL - 

#echo  2  this or the the one above

That's how it actually need to be done.




echo  CRITICAL -  test

exit ${OK}  ##  <-------------  this value gets evaluated.


EricTRA 02-05-2010 03:08 PM


That's great! If you consider this thread as solved you can mark it as such using the thread tools. Have fun with Linux!

Kind regards,


All times are GMT -5. The time now is 06:03 AM.