Hi all,
i'm writing a custom sensor , it does a curl query and reports feedback as result. There are two possible feedbacks, one is similar to "{:status 0, :desc "Alive: 29741}" and it means service is ok, and reports it's PID, other is similar to "{:status 0, :desc "Started: 2012-08-30-10:13"}," and it's a error - it reports service was last seen alive at mentioned date.
How can i get a green/red indicator in nagios for mentioned sensor feedbacks ? Desired behavior is 'ALL GREEN' while sensor reports 'Alive' , and 'RED/CRIT' for anything else.
Sensor works like this:
ServerA monitors ServerB via NRPE. On serverB there is a custom NRPE sensor that runs a bash script that has a curl query in it.
ServerA runs Nagios Core on Debian linux, ServerB runs NRPE on CentOS 6.x linux.
Thank you in advance.
Writing a custom sensor - how to mark feedback as error
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Writing a custom sensor - how to mark feedback as error
Have you added return codes into your plugin? This is the main modifier used by Nagios when passing check results to it.
Re: Writing a custom sensor - how to mark feedback as error
You should read through the plugin development guidelines as this is covered there:
http://nagiosplug.sourceforge.net/devel ... html#AEN76
You will need to make your plugin return exit codes.
From the dev guidelines:
http://nagiosplug.sourceforge.net/devel ... html#AEN76
You will need to make your plugin return exit codes.
From the dev guidelines:
Code: Select all
0 - OK (green in nagios)
The plugin was able to check the service and it appeared to be functioning properly
1 - Warning (yellow)
The plugin was able to check the service, but it appeared to be above some "warning" threshold or did not appear to be working properly
2 - Critical (red)
The plugin detected that either the service was not running or it was above some "critical" threshold
3 - Unknown (orange)
Invalid command line arguments were supplied to the plugin or low-level failures internal to the plugin (such as unable to fork, or open a tcp socket) that prevent it from performing the specified operation. Higher-level errors (such as name resolution errors, socket timeouts, etc) are outside of the control of plugins and should generally NOT be reported as UNKNOWN states.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Writing a custom sensor - how to mark feedback as error
Thank you, i paired up exit codes and text feedback. One more thing to watch out for is that code+text has to be in one line.
*Solved*
*Solved*