aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-09-12 02:21:04 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-09-12 02:21:04 +0200
commit05186426f9877b714612c3b63d68aeabc126a16a (patch)
tree479c7e39766c0d0811908fb172dcb2a96bd910e1
parent2933f49a7df49ffae44ef7407fb473220326902e (diff)
downloadmonitoring_custom-05186426f9877b714612c3b63d68aeabc126a16a.tar.gz
check_snmp_if
-rwxr-xr-xcheck_snmp_if5
1 files changed, 2 insertions, 3 deletions
diff --git a/check_snmp_if b/check_snmp_if
index bc2ae44..5d56ae3 100755
--- a/check_snmp_if
+++ b/check_snmp_if
@@ -39,7 +39,7 @@ walk() {
}
extract_val() {
- sed -n 's/.*=\(.*\)/\1/p' | sed -n 's/.*:\s*\(.*\)/\1/p'
+ sed -n 's/.*=\(.*\)/\1/p' | sed -n 's/.*:\s*\(.*\)/\1/p' | tr -d "\"'"
}
perfdata() {
@@ -89,7 +89,7 @@ else
result 3 "No or insufficient authentication info provided"
fi
-SNMPWALK_RESULT=$(snmpwalk $AUTH "$HOSTNAME" "$MIB_IFOPERSTATUS.$INTERFACE"; exit $?)
+SNMPWALK_RESULT=$(walk "$MIB_IFOPERSTATUS.$INTERFACE"; exit $?)
RET=$?
[ $RET -ne 0 ] && result 3 "snmpwalk failed with code $RET: $SNMPWALK_RESULT"
@@ -111,5 +111,4 @@ OUTERRORS=$(walk "$MIB_ERR_OUT.$INTERFACE" | extract_val)
extract_val <<< "$SNMPWALK_RESULT" | grep "up\|1" > /dev/null && result 0 "$COMPLETE_NAME is up."
-
result 2 "$COMPLETE_NAME $INTERFACE is not up: $SNMPWALK_RESULT"