Ad Widget
Collapse
snmp string to float conversion
Collapse
X
-
-
I'm having a similar problem, while running 1.6.4...
But there is a twist... My string has both numbers and text in it, and I need to find a way to strip the number and save it as float.
My OID comes back like this:
SNMPv2-SMI::enterprises.161.19.3.2.2.8.0 = STRING: "-73 dBm"
How can I strip that down to the number? I don't mind loosing the negative sign, as I'm needing the number, not the sign... I won't get positive values, so I'm needing to simply graph the trend. What can I do to extract the value from this string?Comment
-
Well, I solved my problem with an external command.
I used snmpwalk to create a one-line script that probes the device, then used awk and sed to carve up the output until I had the bare numeric value.
Then I ran that as an external check, and it works great!
/usr/bin/snmpwalk -v 2c -c public $1 .1.3.6.1.4.1.161.19.3.2.2.8.0 |awk {print'$4'} |sed 's/"-//g'Comment
Comment