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.
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: " ... %
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
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
The source for the standard plugins can be downloaded here. You will find the check_snmp.c file in the tarball.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.