How to show a value based on other check values?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Moltron83
Posts: 2
Joined: Wed Jan 29, 2020 9:56 am

How to show a value based on other check values?

Post by Moltron83 »

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!
User avatar
jdunitz
Posts: 235
Joined: Wed Feb 05, 2020 2:50 pm

Re: How to show a value based on other check values?

Post by jdunitz »

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:

Code: Select all

OK | Everything is OK
or

Code: Select all

CRITICAL | Stuff is not right
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
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!
Moltron83
Posts: 2
Joined: Wed Jan 29, 2020 9:56 am

Re: How to show a value based on other check values?

Post by Moltron83 »

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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: How to show a value based on other check values?

Post by ssax »

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 :ugeek:, 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
Locked