diff options
author | Sven Nierlein <sven@nierlein.de> | 2023-01-19 22:29:01 (GMT) |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2023-01-20 07:57:56 (GMT) |
commit | f4930aee28ccb664691809e7dcc9198eb81429c5 (patch) | |
tree | aaec633b9ddbbc84f70c29999d56712cff32c342 /tap/tests/pass/test.t | |
parent | 916572c1aecc37ebfea474f952df61d15d2f60b8 (diff) | |
download | monitoring-plugins-f4930aee28ccb664691809e7dcc9198eb81429c5.tar.gz |
fix check_snmp regex matches
the multiplier function always tried to extract a number, even if the result
is a string because of using a mib.
before:
```
./check_snmp -H hostname -P2c -c public -o IF-MIB::ifAdminStatus.11466 -vvv -r 0
/usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c [context] [authpriv] 10.0.13.11:161 IF-MIB::ifAdminStatus.11466
IF-MIB::ifAdminStatus.11466 = INTEGER: up(1)
Processing oid 1 (line 1)
oidname: IF-MIB::ifAdminStatus.11466
response: = INTEGER: up(1)
SNMP OK - 0 | IF-MIB::ifAdminStatus.11466=0;;
```
the regexp 0 matches, even if the actual result is "up(1)".
after this patch:
```
./check_snmp -H hostname -P2c -c public -o IF-MIB::ifAdminStatus.11466 -vvv -r 0
/usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c [context] [authpriv] 10.0.13.11:161 IF-MIB::ifAdminStatus.11466
IF-MIB::ifAdminStatus.11466 = INTEGER: up(1)
Processing oid 1 (line 1)
oidname: IF-MIB::ifAdminStatus.11466
response: = INTEGER: up(1)
SNMP CRITICAL - *up(1)* |
```
Diffstat (limited to 'tap/tests/pass/test.t')
0 files changed, 0 insertions, 0 deletions