Hello -
We're monitoring a 3 phase battery and to get the overall utilization of the battery there is a calculation that needs to be done. SNMP information from the battery only provides utilization for each of the 3 phases but there's no value for overall utilization.
What I would like to do in Nagios is have a a value reported for overall utilization. To do that I need to query the 3 phase values, do a calculation on that to come up with number. How can this be done in Nagios though? How can a check be based on the values of other checks, with some calculation on top of it?
Does anyone know if this can be done?
Thanks!
How to show a value based on other check values?
Re: How to show a value based on other check values?
It sounds like you might want to write your own plugin to do this, or modify the plugin you're already using.
If the utilization is coming from SNMP, it shouldn't be too hard to use snmpget to pull the individual values into variables, etc., then calculate whatever you need to calculate.
Essentially, any script you can write that can output something like this:
or
and do an exit 0 (for OK) or an exit 2 (for critical)
can work as a Nagios plugin. Here's a nice tutorial:
https://www.howtoforge.com/tutorial/wri ... ck-plugin/
If you want more detail, here's our official plugin documentation:
https://nagios-plugins.org/doc/guidelines.html
If your problem is as I imagine it from your description, you'd be writing a script that's maybe 25-50 lines.
--Jeffrey
If the utilization is coming from SNMP, it shouldn't be too hard to use snmpget to pull the individual values into variables, etc., then calculate whatever you need to calculate.
Essentially, any script you can write that can output something like this:
Code: Select all
OK | Everything is OK
Code: Select all
CRITICAL | Stuff is not right
can work as a Nagios plugin. Here's a nice tutorial:
https://www.howtoforge.com/tutorial/wri ... ck-plugin/
If you want more detail, here's our official plugin documentation:
https://nagios-plugins.org/doc/guidelines.html
If your problem is as I imagine it from your description, you'd be writing a script that's maybe 25-50 lines.
--Jeffrey
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: How to show a value based on other check values?
Ok thanks - I'll try my own plugin. Doesn't see all that bad. I could use the same commands and parse the output from the 3 phases.
Thanks for the suggestion.
Thanks for the suggestion.
Re: How to show a value based on other check values?
It's the calculations part that makes it so complex so a custom plugin is probably your easiest route.
That being said, while not something for the faint of heart , there's this:
https://github.com/flackem/check_multi
https://github.com/flackem/check_multi/ ... /readme.md
https://github.com/flackem/check_multi/ ... oc/eval.md
While not likely relevant to what you're trying to do (the exact calculations that you're trying to do matter in this case):
You could setup a BPI group in Home > BPI (or create a servicegroup for them and use the servicegroup in BPI) and set the warning/critical thresholds/essential members/etc, then use Configure > Configuration Wizards > BPI Wizard to monitor the status of that BPI group to do the notifying for the group of services (you can disable notifications on the individual services if you don't want them to notify). That would also base the status of the service on other checks:
https://assets.nagios.com/downloads/nag ... BPI_v2.pdf
Another base-service-status-on-status-of-other-checks functionality is the check_cluster plugin:
https://assets.nagios.com/downloads/nag ... sters.html
That being said, while not something for the faint of heart , there's this:
https://github.com/flackem/check_multi
https://github.com/flackem/check_multi/ ... /readme.md
https://github.com/flackem/check_multi/ ... oc/eval.md
While not likely relevant to what you're trying to do (the exact calculations that you're trying to do matter in this case):
You could setup a BPI group in Home > BPI (or create a servicegroup for them and use the servicegroup in BPI) and set the warning/critical thresholds/essential members/etc, then use Configure > Configuration Wizards > BPI Wizard to monitor the status of that BPI group to do the notifying for the group of services (you can disable notifications on the individual services if you don't want them to notify). That would also base the status of the service on other checks:
https://assets.nagios.com/downloads/nag ... BPI_v2.pdf
Another base-service-status-on-status-of-other-checks functionality is the check_cluster plugin:
https://assets.nagios.com/downloads/nag ... sters.html