notification had been counted twice
Message-ID: <54817e82.QqxRJnfhZaMvDeRw%mk(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 9ae3e0fe1300cfbdf01a1778810ed08bf774c2fd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9ae3e0fe1300cf…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Dec 5 10:44:17 2014 +0100
#1702 FIX Fix check_notify_count: notification had been counted twice
The active check for counting the notifications of users have been fixed.
The dummy contact <tt>check-mk-notify</tt> is now being handled separately.
We make a distinction between <i>raw notifications</i> - notifications
created
by the monitoring - and <i>user notification</i> - those being sent out
to users.
Note: in the rule based notifications one raw notification can create several
user notifications. Other raw notifcations might create no user notification
at all.
---
.werks/1702 | 17 +++++++++
ChangeLog | 1 +
doc/treasures/active_checks/check_notify_count | 46 +++++++++++++-----------
web/plugins/wato/active_checks.py | 2 +-
4 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/.werks/1702 b/.werks/1702
new file mode 100644
index 0000000..b244068
--- /dev/null
+++ b/.werks/1702
@@ -0,0 +1,17 @@
+Title: Fix check_notify_count: notification had been counted twice
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417772551
+Class: fix
+
+The active check for counting the notifications of users have been fixed.
+The dummy contact <tt>check-mk-notify</tt> is now being handled separately.
+We make a distinction between <i>raw notifications</i> - notifications
created
+by the monitoring - and <i>user notification</i> - those being sent out
+to users.
+
+Note: in the rule based notifications one raw notification can create several
+user notifications. Other raw notifcations might create no user notification
+at all.
diff --git a/ChangeLog b/ChangeLog
index 78f7ee5..60ba542 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -116,6 +116,7 @@
* 1681 FIX: cmciii_lcp_fans: Skipping non FAN units now; cleaned up check
* 1682 FIX: cmciii_lcp_waterflow: Check can now deal with devices with a different
setup
* 1701 FIX: Correctly show absolute level for CPU load in case of warn/crit...
+ * 1702 FIX: Fix check_notify_count: notification had been counted twice...
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/doc/treasures/active_checks/check_notify_count
b/doc/treasures/active_checks/check_notify_count
index 423b2a0..d1ae52b 100755
--- a/doc/treasures/active_checks/check_notify_count
+++ b/doc/treasures/active_checks/check_notify_count
@@ -41,16 +41,16 @@ USAGE: check_notify_count
check_notify_count -h
OPTIONS:
- -h, --help Show this help message and exit
- -l PATH Path to livestatus socket (Autodetected in OMD)
- -r MINUTES Timerange in the past to observe, given in minutes.
- Default is set to 60 minutes.
- -w NUM Minumum number of notifications per contact in
- timerange to raise a WARNING state.
- Disabled by default.
- -c NUM Minumum number of notifications per contact in
- timerange to raise a CRITICAL state.
- Disabled by default.
+ -h, --help Show this help message and exit
+ -l PATH Path to livestatus socket (Autodetected in OMD)
+ -r MINUTES Timerange in the past to observe, given in minutes.
+ Default is set to 60 minutes.
+ -w NUM Minumum number of notifications per contact in
+ timerange to raise a WARNING state.
+ Disabled by default.
+ -c NUM Minumum number of notifications per contact in
+ timerange to raise a CRITICAL state.
+ Disabled by default.
""")
@@ -104,19 +104,25 @@ total_num = 0
perfdata = []
state = 0
details = []
+
+num_users = 0
+raw_notifications = 0
for contact_name, num in c.query_table(query):
- total_num += num
+ if contact_name == "check-mk-notify":
+ raw_notifications += num
+ else:
+ total_num += num
+
+ if crit != None and num > crit:
+ state = max(state, 2)
+ details.append('%s got %d (> %d)(!!)' % (contact_name, num,
crit))
- if crit != None and num > crit:
- state = max(state, 2)
- details.append('%s got %d (>%d) (!!)' % (contact_name, num, crit))
- elif warn != None and num > warn:
- state = max(state, 1)
- details.append('%s got %d (>%d) (!)' % (contact_name, num, warn))
+ elif warn != None and num > warn:
+ state = max(state, 1)
+ details.append('%s got %d (> %d)(!)' % (contact_name, num, warn))
perfdata.append('%s_num=%d' % (contact_name, num))
detail_txt = details and ' (%s)' % ', '.join(details) or ''
-sys.stdout.write('%d notifications within last %d minutes%s | %s\n' %
- (total_num, timerange, detail_txt, ' '.join(perfdata)))
-sys.exit(0)
+sys.stdout.write('%d raw notifications, %d user notifications within last %d
minutes%s | %s\n' %
+ (raw_notifications, total_num, timerange, detail_txt, '
'.join(perfdata)))
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 8def316..cea3cc4 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -1387,7 +1387,7 @@ register_rule(group,
"log file of your monitoring core."),
elements = [
TextUnicode(
- title = _("Name"),
+ title = _("Service Description"),
help = _("The name that will be used in the service
description"),
allow_empty = False
),