Module: check_mk
Branch: master
Commit: 179b01b69be7b15d283f23de78ab027facd17faf
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=179b01b69be7b1…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Wed Jun 22 15:00:32 2016 +0200
3146 FIX notification scripts will now also timeout when sending a bulk notification
Werk #2843 introduced a timeout for notification scripts, as a single long-running notification
could stall the whole notification system.
That werk only affected regular notifications, not bulk notifications. This is now rectified
---
.werks/3146 | 12 ++++++++++++
ChangeLog | 1 +
modules/notify.py | 29 ++++++++++++++++++++++-------
3 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/.werks/3146 b/.werks/3146
new file mode 100644
index 0000000..8a73254
--- /dev/null
+++ b/.werks/3146
@@ -0,0 +1,12 @@
+Title: notification scripts will now also timeout when sending a bulk notification
+Level: 1
+Component: notifications
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1466600205
+
+Werk #2843 introduced a timeout for notification scripts, as a single long-running notification
+could stall the whole notification system.
+That werk only affected regular notifications, not bulk notifications. This is now rectified
diff --git a/ChangeLog b/ChangeLog
index 94947ab..78a8e79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -458,6 +458,7 @@
NOTE: Please refer to the migration notes!
* 3426 FIX: sms: fixed wrong message handling after message was quoted and therefore too long
* 3139 FIX: fixed a couple of minor issues in call to notification scripts...
+ * 3146 FIX: notification scripts will now also timeout when sending a bulk notification...
BI:
* 3271 New option in aggregation for tuning aggregation of downtimes...
diff --git a/modules/notify.py b/modules/notify.py
index fbe7ffc..5407020 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1528,13 +1528,28 @@ def call_bulk_notification_script(plugin, context_text):
if not path:
raise MKGeneralException("Notification plugin %s not found" % plugin)
- # Protocol: The script gets the context on standard input and
- # read until that is closed. It is being called with the parameter
- # --bulk.
- p = subprocess.Popen([path, "--bulk"], shell=False,
- stdout = subprocess.PIPE, stderr = subprocess.PIPE, stdin = subprocess.PIPE)
- stdout_txt, stderr_txt = p.communicate(context_text.encode("utf-8"))
- exitcode = p.returncode
+ stdout_txt = stderr_txt = ""
+ try:
+ set_notification_timeout()
+
+ # Protocol: The script gets the context on standard input and
+ # read until that is closed. It is being called with the parameter
+ # --bulk.
+ p = subprocess.Popen([path, "--bulk"], shell=False,
+ stdout = subprocess.PIPE, stderr = subprocess.PIPE,
+ stdin = subprocess.PIPE)
+
+ stdout_txt, stderr_txt = p.communicate(context_text.encode("utf-8"))
+ exitcode = p.returncode
+
+ clear_notification_timeout()
+ except NotificationTimeout:
+ notify_log("Notification plugin did not finish within %d seconds. Terminating." %
+ notification_plugin_timeout)
+ # p.kill() requires python 2.6!
+ os.kill(p.pid, signal.SIGTERM)
+ exitcode = 1
+
if exitcode:
notify_log("ERROR: script %s --bulk returned with exit code %s" % (path, exitcode))
for line in (stdout_txt + stderr_txt).splitlines():
Module: check_mk
Branch: master
Commit: d0ccf09e5eeeabb39827cad7747cd69e48192fa0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d0ccf09e5eeeab…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Tue Jun 21 13:32:11 2016 +0200
3145 FIX solaris agent: fileinfo patterns that match a directory will no longer output items for the files in that directory
Please note that this behaviour was not intended and differed from other agents. The created items
are also incorrectly formatted so we assume no one used/wanted this.
---
.werks/3145 | 11 +++++++++++
ChangeLog | 1 +
agents/check_mk_agent.solaris | 15 ++++++++-------
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/.werks/3145 b/.werks/3145
new file mode 100644
index 0000000..303f215
--- /dev/null
+++ b/.werks/3145
@@ -0,0 +1,11 @@
+Title: solaris agent: fileinfo patterns that match a directory will no longer output items for the files in that directory
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1466508571
+
+Please note that this behaviour was not intended and differed from other agents. The created items
+are also incorrectly formatted so we assume no one used/wanted this.
diff --git a/ChangeLog b/ChangeLog
index deeb95e..94947ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -277,6 +277,7 @@
* 3638 FIX: cisco_qos: fixed wrong unit handling
* 3548 FIX: agent_netapp: fixed agent exception for channels without shelfes. improved 7mode/clustermode differentation...
* 3549 FIX: netapp_api_snapshots: now correctly processes offline volumes...
+ * 3145 FIX: solaris agent: fileinfo patterns that match a directory will no longer output items for the files in that directory...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index cf1d3ca..839432e 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -353,17 +353,18 @@ if [ -f "$MK_CONFDIR/fileinfo.cfg" ]
then
echo '<<<fileinfo:sep(124)>>>'
/usr/bin/perl -e 'print time."\n"'
+ # note: patterns in the fileinfo.cfg are resolved inside this loop
for file in $(cat "$MK_CONFDIR/fileinfo.cfg")
do
ls $file > /dev/null 2>&1
if [ $? -eq 0 ]; then
- ls $file | sort -u | \
- /usr/bin/perl -e '
- while(my $file = <>) {
- $file =~ s/\n$//;
- ($device, $inode, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($file);
- print("$file|$size|$mtime\n");
- }'
+ echo $file | \
+ /usr/bin/perl -e '
+ while(my $file = <>) {
+ $file =~ s/\n$//;
+ ($device, $inode, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($file);
+ print("$file|$size|$mtime\n");
+ }'
else
echo "$file|missing|$(/usr/bin/perl -e 'print time')"
fi
Module: check_mk
Branch: master
Commit: 41b34efc597b626a17667c48a34da3ca41e69761
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=41b34efc597b62…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jun 21 09:36:43 2016 +0200
3548 FIX agent_netapp: fixed agent exception for channels without shelfes. improved 7mode/clustermode differentation
An exception has been fixed when a channel has 0 shelfes configured.
Furthermore, the agent has now a slightly more reliable 7mode/clustermode detection mechanism.
The 7mode/clustermode detection will be revised in an upcoming agent version.
---
.werks/3548 | 13 +++++++++++++
ChangeLog | 1 +
agents/special/agent_netapp | 27 ++++++++++++++++++---------
3 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/.werks/3548 b/.werks/3548
new file mode 100644
index 0000000..c2c360c
--- /dev/null
+++ b/.werks/3548
@@ -0,0 +1,13 @@
+Title: agent_netapp: fixed agent exception for channels without shelfes. improved 7mode/clustermode differentation
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i1
+Date: 1466494329
+Class: fix
+
+An exception has been fixed when a channel has 0 shelfes configured.
+
+
+Furthermore, the agent has now a slightly more reliable 7mode/clustermode detection mechanism.
+The 7mode/clustermode detection will be revised in an upcoming agent version.
diff --git a/ChangeLog b/ChangeLog
index aae9674..ed3be01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -275,6 +275,7 @@
* 3143 FIX: windows agent: fixed some minor memory and handle leaks
* 3144 FIX: bugfix: replacing pipe symbol in plugin output was broken
* 3638 FIX: cisco_qos: fixed wrong unit handling
+ * 3548 FIX: agent_netapp: fixed agent exception for channels without shelfes. improved 7mode/clustermode differentation...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index d7e81c6..149ac69 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -409,7 +409,14 @@ if clustered_info:
netapp_mode = clustered_info.lower() == "false" and "7mode" or "clustermode"
else:
# Looks like the is-clustered attribute is not set, e.g. NetApp 7-Mode Version 8.0
- netapp_mode = "7-mode" in version_info.child_get_string("version").lower() and "7mode" or "clustermode"
+ version_string = version_info.child_get_string("version").lower()
+ # TODO: Needs improvement. Unfortunately the version info string does not provide
+ # exact info whether its a 7mode or a clustermode system
+ # Possible approach: Query a class which does not exist in 7-mode and evaluate response
+ if "NetApp Release 7.3.5.1".lower() in version_string:
+ netapp_mode = "7mode"
+ else:
+ netapp_mode = "7-mode" in version_string and "7mode" or "clustermode"
#.
@@ -812,14 +819,16 @@ else:
environ_info = query("storage-shelf-environment-list-info")
if environ_info:
for channel in environ_info.children_get():
- for shelf in channel.child_get("shelf-environ-shelf-list").children_get():
- shelf_id = shelf.child_get_string("shelf-id")
- for what, section in [ ("power-supply-list", "netapp_api_psu"),
- ("cooling-element-list", "netapp_api_fan"),
- ("temp-sensor-list", "netapp_api_temp") ]:
- print "<<<%s:sep(9)>>>" % section
- node = shelf.child_get(what)
- print format_config(node, what, shelf_id)
+ shelf_list = channel.child_get("shelf-environ-shelf-list")
+ if shelf_list:
+ for shelf in shelf_list.children_get():
+ shelf_id = shelf.child_get_string("shelf-id")
+ for what, section in [ ("power-supply-list", "netapp_api_psu"),
+ ("cooling-element-list", "netapp_api_fan"),
+ ("temp-sensor-list", "netapp_api_temp") ]:
+ print "<<<%s:sep(9)>>>" % section
+ node = shelf.child_get(what)
+ print format_config(node, what, shelf_id)
# License information
print "<<<netapp_api_licenses:sep(9)>>>"