Update check_snmp.c

Okay, heres a better version of my updates yesterday.

I've added an -M flag, for math-functions: I tried writing a full eval-ish parser, but it turns out that is way more time investment than I'm willing to spend on this. So I settled for a very basic multiply/divide formula.

-M '[OPERAND][RHS]:[PRECISION]' is the format..

where
[OPERAND] is either * or / for multiply or divide, respectively
[RHS] is the numerical value that becomes the right hand side of the formula [whereas the response, saved in the variable show is the left hand side]
[PRECISION] is to which precision we report decimal points

so..
-M '/1000:1' would divide the result by 1,000 and limit the result to 1 decimal place.

Here is an example from the command line from my environment

[root@nms1 plugins]# ./check_snmp -H 10.240.5.18 -C agile -p 161 -P 1 -l "Channel Width" -l "Estimated Bandwidth" -l "Current Operating Frequency" -o enterprises.4458.1000.1.5.24.0 -o enterprises.4458.1000.1.3.1.0 -o enterprises.4458.1000.1.5.16.0 -u "MHz,Mbps,MHz" -M '/1000:2,/1048576:3,/1000:2,' -vvv

/usr/bin/snmpget -Le -t 1 -r 5 -m ALL -v 1 [authpriv] 10.240.5.18:161 enterprises.4458.1000.1.5.24.0 enterprises.4458.1000.1.3.1.0 enterprises.4458.1000.1.5.16.0


SNMPv2-SMI::enterprises.4458.1000.1.5.24.0 = INTEGER: 20000
SNMPv2-SMI::enterprises.4458.1000.1.3.1.0 = INTEGER: 95148800
SNMPv2-SMI::enterprises.4458.1000.1.5.16.0 = INTEGER: 5180
Processing oid 1 (line 1)
  oidname: SNMPv2-SMI::enterprises.4458.1000.1.5.24.0
  response: INTEGER: 20000
Processing oid 2 (line 2)
  oidname: SNMPv2-SMI::enterprises.4458.1000.1.3.1.0
  response: INTEGER: 95148800
Processing oid 3 (line 3)
  oidname: SNMPv2-SMI::enterprises.4458.1000.1.5.16.0
  response: INTEGER: 5180
SNMP OK - Channel Width 20.00 MHz Estimated Bandwidth 90.741 Mbps Current Operating Frequency 5.18 MHz | 'Channel Width'=20.00MHz 'Estimated Bandwidth'=90.741Mbps 'Current Operating Frequency'=5.18MHz

Hope this helps :)