Page 1 of 1
check_snmp convert unit & performance data label
Posted: Mon Jan 14, 2013 3:53 am
by kz_skies
Hello, greetings from Indonesia
I have some question:
1) How to convert check_snmp results unit? For example if I want to check free memory on my switch, the check_snmp keeps getting me bytes unit. How can I convert it into MB?
2) How to modifying performance data label? For example, the performance data of PING: "Packet Losts :" ... %.
How can I modify it into like this: "Packet Losts Percentage: " ... %
Thank you very much for your help!

Re: check_snmp convert unit & performance data label
Posted: Mon Jan 14, 2013 11:15 am
by sreinhardt
1) Check_snmp is only returning the data that your device is sending it. It does not by default modify anything. You would have a couple options regarding how you can change this. Alter the C code for check_snmp and reconfigure so that it divides by 1024 by default. You could also modify the check_mrtgtraf C file for along the same regards, but that would only change the graphing files. My final thought would be to potentially modify the C files that create cgi scripts. However this may not be possible depending on how those cgi's are taking data in, and regarding the other changes, all could cause issues for other ports or services if you do not want the same value there.
2)Again, you would need to modify the C files that are built into cgi files. After modification be sure to compile and replace the existing ones.
Re: check_snmp convert unit & performance data label
Posted: Mon Jan 14, 2013 12:55 pm
by abrist
To expand on sreinhardt's points, if you do change the metric in the check_snmp c file, any check that uses this plugin will have incorrect data (as far it is represented on the perf graphs) for all perf data that was written before the check_snmp code change. Just FYI.
Re: check_snmp convert unit & performance data label
Posted: Mon Jan 14, 2013 3:06 pm
by kz_skies
Thank you abrist, sreinhardt !
Now the question is, where is the location of check_snmp
C file?
Because i only find check_snmp in a binary form (located at /usr/local/nagios/
libexec), and obviously i can't edit a binary file

Re: check_snmp convert unit & performance data label
Posted: Tue Jan 15, 2013 11:58 am
by abrist
The source for the standard plugins can be downloaded
here. You will find the check_snmp.c file in the tarball.