check_snmp. Multiply or divide the obtained value

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
kchiche18
Posts: 1
Joined: Tue Jan 11, 2022 1:03 pm

check_snmp. Multiply or divide the obtained value

Post by kchiche18 »

Good afternoon.
I need to multiply by 0.1 a value obtained with the check_snmp plugin. I have seen that there exists in the source code of Github https://github.com/nagios-plugins/nagio ... eck_snmp.c, a parameter:

#define L_MULTIPLIER CHAR_MAX+6

I need to send to "check_snmp" a parameter (for example, -M 0.1) to multiply/divide the value recibied.
How can I do it?

I think to patch "check_snmp" something like this below, comment the constant and substituing by 'M' parameters.
Thanks.

@@ -68,1 +68,1 @@
-#define L_MULTIPLIER CHAR_MAX+6
+/*#define L_MULTIPLIER CHAR_MAX+6*/
@@ -775,1 +775,1 @@
- {"multiplier", required_argument, 0, L_MULTIPLIER},
+ {"multiplier", required_argument, 0, 'M'},
@@ -1015,1 +1015,1 @@
- case L_MULTIPLIER:
+ case 'M':
@@ -1365,1 +1365,1 @@
- printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd] [--strict]\n");
+ printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd] [-M multiplier] [--strict]\n");
Locked