1
0
monitoring-plugins/monitoring-plugins-2.1.1-check_log_-_quoting.patch
Lars Vogdt 8e37c1a55c - recommend syslog for monitoring-plugins-log, as people probably
want to analize logs generated by (r)syslog or journald
Renamed patches:
- renamed monitoring-plugins-1.4.6-no_chown.patch to 
  monitoring-plugins-1.4.6-Makefile_-_no_chown.patch to make it
  easier to detect the patched file
- renamed monitoring-plugins-2.1.1-check_logfile.patch to 
  monitoring-plugins-2.1.1-check_log_-_quoting.patch to make it
  easier to detect the patched file and reason for the patch
New patches:
- add monitoring-plugins-2.3.1-check_snmp_segfaults.patch:
  check_snmp will segfaults at line 489 if number of lines returned 
  by SNMPD is greater than number of defined thresholds
  -> https://github.com/monitoring-plugins/monitoring-plugins/pull/1589
- added monitoring-plugins-2.3.1_-_check_snmp_hang_on_STDERR_workaround.patch:
  When the MIBs are not quite right, snmpget outputs lots of errors on 
  STDERR before getting down to business.
  If this is enough to fill the pipe buffer, snmpget hangs waiting for 
  it to be cleared, which it never will be because check_snmp is 
  waiting for snmpget to output something on STDOUT.
  This simple fix from s2156945 for this is to read STDERR before STDOUT.
  cmd_run_array from utils_cmd.c is also used by plugins/check_by_ssh 
  and plugins/negate but you're likely to get lots of errors or lots 
  of output, not both at the same time.
  The real fix is probably to do a select() and read from both as 
  they come in.
  https://github.com/monitoring-plugins/monitoring-plugins/issues/1706
- added monitoring-plugins-2.3.1-check_dhcp_-_detect_rogue_dhcp_servers.patch:
  feature enhancement from Patrick Cervicek for check_dhcp, which allows 
  to detect rogue DHCP servers. Use it with the "-x" flag, example:

OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins?expand=0&rev=90
2021-11-19 13:47:30 +00:00

91 lines
2.4 KiB
Diff

Index: monitoring-plugins-2.3.1/plugins-scripts/check_log.sh
===================================================================
--- monitoring-plugins-2.3.1.orig/plugins-scripts/check_log.sh
+++ monitoring-plugins-2.3.1/plugins-scripts/check_log.sh
@@ -115,27 +115,27 @@ while test -n "$1"; do
exit $STATE_OK
;;
--filename)
- logfile=$2
+ logfile="$2"
shift
;;
-F)
- logfile=$2
+ logfile="$2"
shift
;;
--oldlog)
- oldlog=$2
+ oldlog="$2"
shift
;;
-O)
- oldlog=$2
+ oldlog="$2"
shift
;;
--query)
- query=$2
+ query="$2"
shift
;;
-q)
- query=$2
+ query="$2"
shift
;;
-x)
@@ -157,10 +157,10 @@ done
# If the source log file doesn't exist, exit
-if [ ! -e $logfile ]; then
+if [ ! -e "$logfile" ]; then
echo "Log check error: Log file $logfile does not exist!"
exit $STATE_UNKNOWN
-elif [ ! -r $logfile ] ; then
+elif [ ! -r "$logfile" ] ; then
echo "Log check error: Log file $logfile is not readable!"
exit $STATE_UNKNOWN
fi
@@ -169,8 +169,8 @@ fi
# we're running this test, so copy the original log file over to
# the old diff file and exit
-if [ ! -e $oldlog ]; then
- cat $logfile > $oldlog
+if [ ! -e "$oldlog" ]; then
+ cat "$logfile" > "$oldlog"
echo "Log check data initialized..."
exit $STATE_OK
fi
@@ -184,20 +184,20 @@ if [ -x /bin/mktemp ]; then
else
tempdiff=`/bin/date '+%H%M%S'`
tempdiff="/tmp/check_log.${tempdiff}"
- touch $tempdiff
- chmod 600 $tempdiff
+ touch "$tempdiff"
+ chmod 600 "$tempdiff"
fi
-diff $logfile $oldlog | grep -v "^>" > $tempdiff
+diff "$logfile" "$oldlog" | grep -v "^>" > "$tempdiff"
# Count the number of matching log entries we have
-count=`grep -c "$query" $tempdiff`
+count=`grep -c "$query" "$tempdiff"`
# Get the last matching entry in the diff file
-lastentry=`grep "$query" $tempdiff | tail -1`
+lastentry=`grep "$query" "$tempdiff" | tail -1`
-rm -f $tempdiff
-cat $logfile > $oldlog
+rm -f "$tempdiff"
+cat "$logfile" > "$oldlog"
if [ "$count" = "0" ]; then # no matches, exit with no error
echo "Log check ok - 0 pattern matches found"