Module: check_mk
Branch: master
Commit: 42b03d4b681f8ae9d3bfffc1cf07d6243e0a19f2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=42b03d4b681f8a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jun 13 11:32:13 2017 +0200
4828 FIX User notification rules can now be canceled
Previously, the cancel notification rule did only apply to global notification rules.
Change-Id: Ice21bf51e0cbaefca3ad9f6af1afbf618421cbb3
---
.werks/4828 | 11 +++++++++++
modules/notify.py | 5 +++++
web/htdocs/wato.py | 3 +++
3 files changed, 19 insertions(+)
diff --git a/.werks/4828 b/.werks/4828
new file mode 100644
index 0000000..38eeb12
--- /dev/null
+++ b/.werks/4828
@@ -0,0 +1,11 @@
+Title: User notification rules can now be canceled
+Level: 1
+Component: notifications
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1497346214
+Class: fix
+
+Previously, the cancel notification rule did only apply to global notification rules.
+
diff --git a/modules/notify.py b/modules/notify.py
index 2b8d67d..2157a08 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -523,6 +523,11 @@ def user_notification_rules():
for contactname in contactnames:
contact = contacts[contactname]
for rule in contact.get("notification_rules", []):
+ # User notification rules always use allow_disable
+ # This line here is for legacy reasons. Newer versions
+ # already set the allow_disable option in the rule configuration
+ rule["allow_disable"] = True
+
# Save the owner of the rule for later debugging
rule["contact"] = contactname
# We assume that the "contact_..." entries in the
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index e3857c7..07f11e6 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -8637,6 +8637,9 @@ def mode_notification_rule(phase, profilemode):
vs.validate_value(rule, "rule")
+ # User rules are always allow_disable
+ rule["allow_disable"] = True
+
if new and clone_nr >= 0:
rules[clone_nr:clone_nr] = [ rule ]
elif new:
Module: check_mk
Branch: master
Commit: 798500fd41f66a3c5f2a8c32fdc8478155426f12
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=798500fd41f66a…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Jun 12 14:46:08 2017 +0200
made plugin readable
corrected indentation
replaced tabs with spaces
Change-Id: Id8d02d5cc0516aae0404a2f6712e497d50f55783
---
agents/plugins/smart | 81 ++++++++++++++++++++++++++--------------------------
1 file changed, 40 insertions(+), 41 deletions(-)
diff --git a/agents/plugins/smart b/agents/plugins/smart
index 0779c49..6e28c91 100755
--- a/agents/plugins/smart
+++ b/agents/plugins/smart
@@ -31,12 +31,11 @@
# SCSI protocol interface.
megaraid_info()
{
-
#PDINFO=$(MegaCli -PDlist -a0)
if [ -z "$1" ]; then
- PDINFO=$(megacli -PDlist -a0 -NoLog)
+ PDINFO=$(megacli -PDlist -a0 -NoLog)
else
- PDINFO=$($1 -PDlist -a0 -NoLog)
+ PDINFO=$($1 -PDlist -a0 -NoLog)
fi
echo "$PDINFO" | \
@@ -80,18 +79,18 @@ if which smartctl > /dev/null 2>&1 ; then
# get the serials for all disks on the controller
#
if which tw_cli > /dev/null 2>&1 ; then
- # support for only one controller at the moment
- TWAC=$(tw_cli show | awk 'NR < 4 { next } { print $1 }' | head -n 1)
-
- # - add a trailing zero to handle case of unused slot
- # trailing zeros are part of the device links in /dev/disk/by-id/... anyway
- # - only the last 9 chars seem to be relevant
- # (hopefully all this doesn't change with new kernels...)
- eval `tw_cli /$TWAC show drivestatus | grep -E '^p[0-9]' | awk '{print $1 " " $7 "0"}' | while read twaminor serial ; do
- twaminor=${twaminor#p}
- serial=${serial:(-9)}
- serial=AMCC_${serial}00000000000
- echo "$serial=$twaminor"
+ # support for only one controller at the moment
+ TWAC=$(tw_cli show | awk 'NR < 4 { next } { print $1 }' | head -n 1)
+
+ # - add a trailing zero to handle case of unused slot
+ # trailing zeros are part of the device links in /dev/disk/by-id/... anyway
+ # - only the last 9 chars seem to be relevant
+ # (hopefully all this doesn't change with new kernels...)
+ eval `tw_cli /$TWAC show drivestatus | grep -E '^p[0-9]' | awk '{print $1 " " $7 "0"}' | while read twaminor serial ; do
+ twaminor=${twaminor#p}
+ serial=${serial:(-9)}
+ serial=AMCC_${serial}00000000000
+ echo "$serial=$twaminor"
done`
else:
echo "tw_cli not found" >&2
@@ -121,8 +120,8 @@ if which smartctl > /dev/null 2>&1 ; then
continue
fi
- # Avoid duplicate entries for same device
- if [ "${SEEN//.$N./}" != "$SEEN" ] ; then
+ # Avoid duplicate entries for same device
+ if [ "${SEEN//.$N./}" != "$SEEN" ] ; then
continue
fi
SEEN="$SEEN.$N."
@@ -131,32 +130,32 @@ if which smartctl > /dev/null 2>&1 ; then
DNAME=${D#/dev/disk/by-id/scsi-}
DNAME=${DNAME#/dev/disk/by-id/ata-}
# 2012-01-25 Stefan Kaerst CDJ - special option in case vendor is AMCC
- CMD=
+ CMD=
if [ "$VEND" == "AMCC" -a -n "$TWAC" ]; then
- DNAME=${DNAME#1}
- [ -z "${!DNAME}" ] && continue
- CMD="smartctl -d 3ware,${!DNAME} -v 9,raw48 -A /dev/twa0"
- # create nice device name including model
- MODEL=$(tw_cli /$TWAC/p${!DNAME} show model | head -n 1 | awk -F= '{ print $2 }')
- MODEL=${MODEL## }
- MODEL=${MODEL// /-}
- DNAME=${DNAME#AMCC_}
- DNAME="AMCC_${MODEL}_${DNAME%000000000000}"
+ DNAME=${DNAME#1}
+ [ -z "${!DNAME}" ] && continue
+ CMD="smartctl -d 3ware,${!DNAME} -v 9,raw48 -A /dev/twa0"
+ # create nice device name including model
+ MODEL=$(tw_cli /$TWAC/p${!DNAME} show model | head -n 1 | awk -F= '{ print $2 }')
+ MODEL=${MODEL## }
+ MODEL=${MODEL// /-}
+ DNAME=${DNAME#AMCC_}
+ DNAME="AMCC_${MODEL}_${DNAME%000000000000}"
elif [ "$VEND" != "ATA" ] ; then
- TEMP=
- # create temperature output as expected by checks/smart
- # this is a hack, TODO: change checks/smart to support SCSI-disks
- eval `smartctl -d scsi -i -A $D | while read a b c d e ; do
- [ "$a" == Serial ] && echo SN=$c
- [ "$a" == Current -a "$b" == Drive -a "$c" == Temperature: ] && echo TEMP=$d
- done`
- [ -n "$TEMP" ] && CMD="echo 194 Temperature_Celsius 0x0000 000 000 000 Old_age Always - $TEMP (0 0 0 0)"
- DNAME="${VEND}_${MODEL}_${SN}"
- else
- CMD="smartctl -d ata -v 9,raw48 -A $D"
- fi
-
- [ -n "$CMD" ] && $CMD | grep Always | egrep -v '^190(.*)Temperature(.*)' | sed "s|^|$DNAME $VEND $MODEL |"
+ TEMP=
+ # create temperature output as expected by checks/smart
+ # this is a hack, TODO: change checks/smart to support SCSI-disks
+ eval `smartctl -d scsi -i -A $D | while read a b c d e ; do
+ [ "$a" == Serial ] && echo SN=$c
+ [ "$a" == Current -a "$b" == Drive -a "$c" == Temperature: ] && echo TEMP=$d
+ done`
+ [ -n "$TEMP" ] && CMD="echo 194 Temperature_Celsius 0x0000 000 000 000 Old_age Always - $TEMP (0 0 0 0)"
+ DNAME="${VEND}_${MODEL}_${SN}"
+ else
+ CMD="smartctl -d ata -v 9,raw48 -A $D"
+ fi
+
+ [ -n "$CMD" ] && $CMD | grep Always | egrep -v '^190(.*)Temperature(.*)' | sed "s|^|$DNAME $VEND $MODEL |"
done 2>/dev/null