check_snmp - Dividing Output
Posted: Thu Nov 28, 2019 3:25 am
Good Day,
We are moitoring UPS's via a SNMP Card. Some of the values, however, need to be divided by 10 to get proper value. In the forums, I cam accross this solution :
That works perfectly ... but, we need to set thresholds and this is where it fails as the output differs between a status of Ok and Warning / Critical :
SNMP OK - 2178 | iso.3.6.1.4.1.935.1.1.1.3.2.1.0=2178
SNMP CRITICAL - *2180* | iso.3.6.1.4.1.935.1.1.1.3.2.1.0=2180;2300:;2300:
Has anyone successfully implemented something that we are trying accomplsih ?
Regards
We are moitoring UPS's via a SNMP Card. Some of the values, however, need to be divided by 10 to get proper value. In the forums, I cam accross this solution :
Code: Select all
#!/bin/bash
hostaddress=$1
/usr/local/nagios/libexec/check_snmp -H $hostaddress -C public -o 1.3.6.1.4.1.935.1.1.1.3.2.1.0 | awk -F'|' '{split($1,array_left,"-");} {split($2,array_right,"=");} {print array_left[1]"- "array_left[2]/10"|"array_right[1]"="array_right[2]/10;}'
SNMP OK - 2178 | iso.3.6.1.4.1.935.1.1.1.3.2.1.0=2178
SNMP CRITICAL - *2180* | iso.3.6.1.4.1.935.1.1.1.3.2.1.0=2180;2300:;2300:
Has anyone successfully implemented something that we are trying accomplsih ?
Regards