check_snmp returned data conversion?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
tippy24
Posts: 4
Joined: Mon Oct 28, 2013 11:50 am

check_snmp returned data conversion?

Post 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
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_snmp returned data conversion?

Post 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.
tippy24
Posts: 4
Joined: Mon Oct 28, 2013 11:50 am

Re: check_snmp returned data conversion?

Post 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.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_snmp returned data conversion?

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_snmp returned data conversion?

Post 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.
Former Nagios employee
Locked