Page 1 of 1

check_snmp returned data conversion?

Posted: Tue Dec 17, 2013 3:42 pm
by tippy24
I have been searching for an easier way to converts returned data units (such as seconds to minutes, time ticks to minutes, milliamps to amps, etc.) than rewriting the plugin scripts (I AM NOT a developer). Modifying a script for each instance I need the data formatted seems like a kludge.

Examples:
1. MIB's for our UPS's return 'output in watts' in milliwatts, our current homegrown solution just does $VAL/1000 to show correct units.
2. Some temp probes are returns in Celsius, and we use Fahrenheit, so we currently use $VAL*1.8+32
3. MIB's for our UPS's return time in timeticks, and must be divided by 6000 ($VAL/6000)

I'm not the only one who has had this problem, but I cannot find solutions beyond rewriting the plugin scripts. I'm surprised there is nothing in CCM to make this easier.
Has anyone found a solution for returned data conversion that IS NOT modifying the plugin scripts?
Any assistance would be most appreciated.

Thanks,
tippy

Re: check_snmp returned data conversion?

Posted: Tue Dec 17, 2013 3:57 pm
by jsmurphy
Instead of using check_snmp you may want to see if there is a vendor/device specific plugin on Nagios exchange, which is more likely to handle all of that sort of stuff for you. Failing that though there isn't a non-scripty way to deal with your problem.

Nagios will execute a script and then take the returned data and apply it to the appropriate service, there's no layer in between to modify the returned data.

Re: check_snmp returned data conversion?

Posted: Wed Dec 18, 2013 11:57 am
by tippy24
There are no vendor specific plugins for our particular CRAC's and UPS's.
Is there any other way, after the data is passed to the service, to convert the data?
This just seems like s problem whose solution should be much simpler than it is at the moment.

Re: check_snmp returned data conversion?

Posted: Thu Dec 19, 2013 4:22 pm
by jsmurphy
No, not really. Well... technically there is a way to do it post ingestion but it still requires scripting and is a pretty awful idea.

It does sound like the solution is simpler than the problem, looks however can be deceiving. To change it though would require changing some very fundamental components of Nagios that could have some very significant ramifications on execution time and scalability... that's not to say it couldn't be done but it's likely not a trivial problem. Nagios is more of a monitoring framework than it is a monitoring solution, you're going to find that scripting is going to become a fairly necessary trait depending on how large your environment is.

Re: check_snmp returned data conversion?

Posted: Fri Dec 20, 2013 9:55 am
by tmcdonald
You can always write a smallish script that Nagios will use as the check, and that script kicks off the real script. When the real script returns its data, your outer script does the necessary conversions and passes everything back to Nagios. As far as Nagios is concerned, only one check was made. This is a pretty common thing to do, and is a good first project for sharpening your scripting skills.