diff --git a/check_snmp_data b/check_snmp_data index f9c8641be98823aaecc890f2807855f5d8788c42..90ec912d4e02aff9ddccc4eb3e3494409822c780 100755 --- a/check_snmp_data +++ b/check_snmp_data @@ -186,7 +186,7 @@ $_methods CONFIG FILE: The config file can be multiline and has the syntax - [SNMPTARGET]:[auth parameters] + [SNMPTARGET[,target2]]:[auth parameters] The auth parameters set the version and all needed values to connect. Snmp v2 uses a community string. Snmp v3 is highly recommended (you should disable Snmp v2) and needs diff --git a/check_snmp_includes b/check_snmp_includes index c54910da1ea5b7e524f7649a8d48a68a506e9188..83b8a6b7395926b3cdc42746795030ee5864fb3e 100644 --- a/check_snmp_includes +++ b/check_snmp_includes @@ -35,10 +35,14 @@ read_config(){ SNMPAUTH="-v $SNMPVERSION -c $SNMPCOMMUNITY" if [ -r "$SNMPCONFIG" ]; then - if grep "^${SNMPTARGET}:" "$SNMPCONFIG" >/dev/null; then - SNMPAUTH="$( grep "^${SNMPTARGET}:" "$SNMPCONFIG" | cut -f 2- -d ':' )" - else + SNMPAUTH="$( grep -v "^#" "$SNMPCONFIG" | grep "^,*${SNMPTARGET}[,:]" | cut -f 2- -d ':' )" + if [ -z "$SNMPAUTH" ]; then SNMPAUTH="$( grep "^DEFAULT:" "$SNMPCONFIG" | cut -f 2- -d ':' )" + if [ -z "$SNMPAUTH" ]; then + ph.setStatus "unknown" + echo "ERROR: No authentication data were found for [${SNMPTARGET}] in config file [$SNMPCONFIG]." + ph.exit + fi fi else ph.setStatus "unknown" diff --git a/check_snmp_synology b/check_snmp_synology index 93936f5c7ee42672fd6ffd72e825deadd4432a5c..c994e19df398d1765d2e8eca43426238fd312704 100755 --- a/check_snmp_synology +++ b/check_snmp_synology @@ -96,7 +96,7 @@ OPTIONS: CONFIG FILE: The config file can be multiline and has the syntax - [SNMPTARGET]:[auth parameters] + [SNMPTARGET[,target2]]:[auth parameters] The auth parameters set the version and all needed values to connect. Snmp v2 uses a community string. Snmp v3 is highly recommended (you should disable Snmp v2) and needs diff --git a/inc_pluginfunctions b/inc_pluginfunctions index 3de16e7a84ca43ad3a4287c295ff3906d540e744..3904103eae23a34ac00949bce03c19bd43bb3837 100644 --- a/inc_pluginfunctions +++ b/inc_pluginfunctions @@ -325,8 +325,8 @@ function ph.getFileAge(){ function ph._getStorefile(){ local varName=$1 - local mydir="/tmp/icinga_counter_$( whoami )" - test -n "$dir_data" && mydir="${dir_data}/_counter_$( whoami )" + local mydir="/tmp/icinga_counter_${USER}" + test -n "$dir_data" && mydir="${dir_data}/_counter_${USER}" local _basename _basename=$(basename $0)