Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
@wyang
Favorites0
Views
Projects0
--- /usr/lib64/nagios/plugins/check_snmp_synology~ 2018-12-07 19:11:35.231831343 +0000 +++ /usr/lib64/nagios/plugins/check_snmp_synology 2019-01-30 21:23:40.471135880 +0000 @@ -307,3 +307,8 @@ - RAIDName[$i]=$(echo "$syno" | grep $OID_RAIDName.$(($i-1)) | cut -d "=" -f2) - RAIDStatus[$i]=$(echo "$syno" | grep $OID_RAIDStatus.$(($i-1)) | cut -d "=" -f2 | sed 's/^[ t]*//;s/[ t]*$//') - + # modified by William Yang / DataPulse + # the regexes below were not anchored on the tail end, which created situations where + # a record could contain multiple lines. Caused a lot of heartache. Adding the + # anchor [^.0-9] ensures no subsquent numeral or OID component is matched, causing + # the code to be much more resilient. We added 10 volumes one maintenance window, + # and we had to track this down.... + RAIDName[$i]=$(echo "$syno" | grep "$OID_RAIDName.$(($i-1))[^.0-9]" | cut -d "=" -f2) + RAIDStatus[$i]=$(echo "$syno" | grep "$OID_RAIDStatus.$(($i-1))[^.0-9]" | cut -d "=" -f2 | sed 's/^[ t]*//;s/[ t]*$//') @@ -317,0 +323,2 @@
Reviewed 7 years ago