1

I love the nagios plugin API. It is easy and successful.

The exit-status of the check can have these values:

  • 0: ok
  • 1: WARN
  • 2: ERR
  • 3: Unkown

See: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/pluginapi.html

AFAIK there is a way that a single check script can return several results in one call.

Up to now I could not find docs for this API.

Or is there no official API for "one call returns several results"?

  • Do you mean "a single plugin should return multiple end-results leading to one status", eg Disc free OK: sda1 50% sda3 65% sdb 33%, or "a single plugin should return multiple statuses", eg sda1 free OK 44%, sda2 free WARNING 3%? – MadHatter Sep 15 '17 at 8:07
  • @MadHatter I think check_mk works this way. I want to create multiple end-results. But I don't want "leading to one status". – guettli Sep 15 '17 at 13:36
  • One service, one status - I think that's pretty much built into NAGIOS. What on earth would you expect NAGIOS to report if a service had multiple statuses at any given time? – MadHatter Sep 15 '17 at 21:17
4
+50

All Nagios cares about is the return code, and there's only one return code.

Ultimately, you can only have one status per check, sorry.

You can sort of work around this with something like check_mk, check_multi, check_cluster, etc.

(One of the ways check_mk can work around this is by submitting multiple [passive] check results simultaneously, for example. But this is atypical of Nagios plugins.)

  • 1
    Good answer. The way nagios works with return codes is actually really quite clever, as it forces you to appreciate the 'warning' and 'critical' values as hard values and not an ambiguous response. To follow on from what you said, it is critical to understand that something -cannot- be 'okay' and 'warning' at the same time, and if you are planning on checking something twice, you would use two health checks. – Reverend Tim Sep 19 '17 at 15:24

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.