Module: check_mk
Branch: master
Commit: 0227914547c5b138c714f41cd797a1b586472487
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0227914547c5b1…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Fri Apr 4 13:48:48 2014 +0200
ibm_svc_eventlog: New Check for Messages in Event log of IBM SVC / V7000 devices
---
.werks/801 | 8 ++++
ChangeLog | 1 +
agents/special/agent_ibmsvc | 15 +++++---
checkman/ibm_svc_eventlog | 13 +++++++
checks/ibm_svc_eventlog | 61 +++++++++++++++++++++++++++++++
web/plugins/wato/datasource_programs.py | 1 +
6 files changed, 94 insertions(+), 5 deletions(-)
diff --git a/.werks/801 b/.werks/801
new file mode 100644
index 0000000..9c7742b
--- /dev/null
+++ b/.werks/801
@@ -0,0 +1,8 @@
+Title: ibm_svc_eventlog: New Check for Messages in Event log of IBM SVC / V7000 devices
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1396612089
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index a7cb5fd..8f71b33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
NOTE: Please refer to the migration notes!
* 0799 ibm_svc_systemstats.cpu_util: New check for CPU Utilization of an IBM SVC / V7000 device in total
* 0800 ibm_svc_nodestats.cache, ibm_svc_systemstats.cache: New checks for Cache Usage of IBM SVC / V7000 devices
+ * 0801 ibm_svc_eventlog: New Check for Messages in Event log of IBM SVC / V7000 devices
* 0777 FIX: special agent emcvnx: did not work with security file authentication...
Multisite:
diff --git a/agents/special/agent_ibmsvc b/agents/special/agent_ibmsvc
index 3598a1e..4a61a04 100755
--- a/agents/special/agent_ibmsvc
+++ b/agents/special/agent_ibmsvc
@@ -61,10 +61,10 @@ OPTIONS:
-i MODULES, --modules MODULES Modules to query. This is a comma separated list of
which may contain the keywords "lshost", "lslicense",
"lsmdisk", "lsmdiskgrp", "lsnode", "lsnodestats",
- "lssystem", "lssystemstats" or "all" to define which
- information should be queried from the device. You can
- define to use only view of them to optimize performance.
- The default is "all".
+ "lssystem", "lssystemstats", "lseventlog" or "all" to
+ define which information should be queried from the
+ device. You can define to use only view of them to
+ optimize performance. The default is "all".
""")
@@ -100,6 +100,7 @@ command_options = {
"lsnodestats" : {"section_header" : "ibm_svc_nodestats", "active" : False},
"lssystem" : {"section_header" : "ibm_svc_system", "active" : False},
"lssystemstats" : {"section_header" : "ibm_svc_systemstats", "active" : False},
+ "lseventlog" : {"section_header" : "ibm_svc_eventlog", "active" : False},
}
for o,a in opts:
@@ -156,7 +157,11 @@ cmd = "ssh -o ConnectTimeout=%s %s %s@%s '" % (opt_timeout, opt_any_hostkey, use
for module in command_options.keys():
if command_options[module]["active"] == True:
- cmd += "echo \<\<\<%s:sep\(58\)\>\>\>; %s -nohdr -delim :;" % (command_options[module]["section_header"], module)
+ cmd += "echo \<\<\<%s:sep\(58\)\>\>\>;" % command_options[module]["section_header"]
+ if module == "lseventlog":
+ cmd += "lseventlog -expired no -fixed no -monitoring no -order severity -message no -delim : -nohdr;"
+ else:
+ cmd += "%s -nohdr -delim :;" % module
cmd += "'"
diff --git a/checkman/ibm_svc_eventlog b/checkman/ibm_svc_eventlog
new file mode 100644
index 0000000..5b6fc24
--- /dev/null
+++ b/checkman/ibm_svc_eventlog
@@ -0,0 +1,13 @@
+title: IBM SVC / V7000: Messages in Event log
+agents: ibm_svc
+catalog: hw/storagehw/ibm
+license: GPL
+distribution: check_mk
+description:
+ Checks the event log of IBM SVC / V7000 devices for messsages not expired
+ and not yet fixed. Returns {WARN} if there is at least one and {OK} if
+ there is none.
+
+inventory:
+ Creates exactly one check on every IBM SVC / V7000 device named
+ IBM SVC Eventlog.
diff --git a/checks/ibm_svc_eventlog b/checks/ibm_svc_eventlog
new file mode 100644
index 0000000..7d6f893
--- /dev/null
+++ b/checks/ibm_svc_eventlog
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+# Example output from agent:
+# <<<ibm_svc_eventlog:sep(58)>>>
+# 588:120404112526:mdiskgrp:6:md07_sas10k::alert:no:989001::Managed Disk Group space warning
+# 589:120404112851:mdiskgrp:7:md08_nlsas7k_1t::alert:no:989001::Managed Disk Group space warning
+# 590:120404112931:mdiskgrp:8:md09_nlsas7k_1t::alert:no:989001::Managed Disk Group space warning
+# 591:120404113001:mdiskgrp:9:md10_nlsas7k_1t::alert:no:989001::Managed Disk Group space warning
+# 592:120404113026:mdiskgrp:10:md11_nlsas7k_1t::alert:no:989001::Managed Disk Group space warning
+# 593:120404113111:mdiskgrp:11:md12_nlsas7k_1t::alert:no:989001::Managed Disk Group space warning
+# 1690:130801070656:drive:59:::alert:no:981020::Managed Disk error count warning threshold met
+# 2058:131030112416:drive:42:::alert:no:981020::Managed Disk error count warning threshold met
+
+def inventory_ibm_svc_eventlog(info):
+ return [ (None, None) ]
+
+def check_ibm_svc_eventlog(item, _no_params, info):
+ messagecount = 0
+ last_err = ""
+
+ for sequence_number, last_timestamp, object_type, object_id, object_name, copy_id, status, fixed, event_id, error_code, description in info:
+ messagecount += 1
+ last_err = description
+
+ if messagecount > 0:
+ return 1, "%d messages not expired and not yet fixed found in event log, last was: %s" % \
+ (messagecount, last_err)
+
+ return 0, "No messages not expired and not yet fixed found in event log"
+
+check_info["ibm_svc_eventlog"] = {
+ "check_function" : check_ibm_svc_eventlog,
+ "inventory_function" : inventory_ibm_svc_eventlog,
+ "service_description" : "IBM SVC Eventlog",
+ "has_perfdata" : False,
+}
+
diff --git a/web/plugins/wato/datasource_programs.py b/web/plugins/wato/datasource_programs.py
index 90f9077..990095a 100644
--- a/web/plugins/wato/datasource_programs.py
+++ b/web/plugins/wato/datasource_programs.py
@@ -273,6 +273,7 @@ register_rule(group,
( "lsnodestats", _("Node Stats") ),
( "lssystem", _("System Info") ),
( "lssystemstats", _("System Stats") ),
+ ( "lseventlog", _("Event Log") ),
],
default_value = [ "lshost", "lslicense", "lsmdisk", "lsmdiskgrp", "lsnode",
"lsnodestats", "lssystem", "lssystemstats", ],
Module: check_mk
Branch: master
Commit: 350c84b2d7a1f05cea52eac63b1207087b233e83
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=350c84b2d7a1f0…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Apr 4 13:36:30 2014 +0200
FIX FIX: compute correct state transitions for notifications
This fixes a problem with the combination of
<ul>
<li>Rule based notifications</li>
<li>Maximum check attempts > 1</li>
<li>Rule conditions based on the <i>original</i> state of a host or service</li>
</ul>
When a service got CRIT while having more than one check attempt, the previous
(soft) state would be displayed as CRIT, while it is OK in fact. This has
been fixed natively when using the Check_MK Micro Core. When using Nagios then
during the notification the previous hard state is not always known. In doubt
a notification is being sent out rather then omitted.
---
.werks/752 | 20 ++++++++++++++++++++
ChangeLog | 3 +++
check_mk_templates.cfg | 2 ++
modules/notify.py | 49 +++++++++++++++++++++++++++++++++++++++++++-----
4 files changed, 69 insertions(+), 5 deletions(-)
diff --git a/.werks/752 b/.werks/752
new file mode 100644
index 0000000..619cda9
--- /dev/null
+++ b/.werks/752
@@ -0,0 +1,20 @@
+Title: FIX: compute correct state transitions for notifications
+Level: 2
+Component: notifications
+Class: fix
+State: unknown
+Version: 1.2.5i3
+Date: 1396610543
+
+This fixes a problem with the combination of
+<ul>
+<li>Rule based notifications</li>
+<li>Maximum check attempts > 1</li>
+<li>Rule conditions based on the <i>original</i> state of a host or service</li>
+</ul>
+
+When a service got CRIT while having more than one check attempt, the previous
+(soft) state would be displayed as CRIT, while it is OK in fact. This has
+been fixed natively when using the Check_MK Micro Core. When using Nagios then
+during the notification the previous hard state is not always known. In doubt
+a notification is being sent out rather then omitted.
diff --git a/ChangeLog b/ChangeLog
index b7c5b87..ad0bdd2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,9 @@
WATO:
* 0781 FIX: host diag page: fixed problem with update of diagnose subwindows...
+ Notifications:
+ * 0752 FIX: FIX: compute correct state transitions for notifications...
+
Livestatus:
* 0747 FIX: livestatus table hostsbygroup: fixed bug with group_authorization strict...
diff --git a/check_mk_templates.cfg b/check_mk_templates.cfg
index 1f295b1..406fc57 100644
--- a/check_mk_templates.cfg
+++ b/check_mk_templates.cfg
@@ -364,6 +364,7 @@ define command {
NOTIFY_HOSTNAME='$HOSTNAME$' \
NOTIFY_HOSTALIAS='$HOSTALIAS$' \
NOTIFY_HOSTADDRESS='$HOSTADDRESS$' \
+ NOTIFY_HOSTATTEMPT='$HOSTATTEMPT$' \
NOTIFY_LASTHOSTSTATE='$LASTHOSTSTATE$' \
NOTIFY_LASTHOSTSTATEID='$LASTHOSTSTATEID$' \
NOTIFY_LASTHOSTSTATECHANGE='$LASTHOSTSTATECHANGE$' \
@@ -379,6 +380,7 @@ define command {
NOTIFY_LASTSERVICESTATEID='$LASTSERVICESTATEID$' \
NOTIFY_LASTSERVICESTATECHANGE='$LASTSERVICESTATECHANGE$' \
NOTIFY_LASTSERVICEOK='$LASTSERVICEOK$' \
+ NOTIFY_SERVICEATTEMPT='$SERVICEATTEMPT$' \
NOTIFY_SERVICESTATE='$SERVICESTATE$' \
NOTIFY_SERVICESTATEID='$SERVICESTATEID$' \
NOTIFY_SERVICEOUTPUT='$SERVICEOUTPUT$' \
diff --git a/modules/notify.py b/modules/notify.py
index 6adc3ef..c638286 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -744,7 +744,7 @@ def rbn_match_host_event(rule, context):
return # Let this be handled by match_service_event
allowed_events = rule["match_host_event"]
state = context["HOSTSTATE"]
- last_state = context["LASTHOSTSTATE"]
+ last_state = context["PREVIOUSHOSTHARDSTATE"]
events = { "UP" : 'r', "DOWN" : 'd', "UNREACHABLE" : 'u' }
return rbn_match_event(context, state, last_state, events, allowed_events)
@@ -758,7 +758,7 @@ def rbn_match_service_event(rule, context):
return # Let this be handled by match_host_event
allowed_events = rule["match_service_event"]
state = context["SERVICESTATE"]
- last_state = context["LASTSERVICESTATE"]
+ last_state = context["PREVIOUSSERVICEHARDSTATE"]
events = { "OK" : 'r', "WARNING" : 'w', "CRITICAL" : 'c', "UNKNOWN" : 'u' }
return rbn_match_event(context, state, last_state, events, allowed_events)
@@ -777,9 +777,16 @@ def rbn_match_event(context, state, last_state, events, allowed_events):
else:
event = events.get(last_state, '?') + events.get(state, '?')
- if event not in allowed_events:
- return "Event type '%s' not handled by this rule. Allowed are: %s" % (
- event, ", ".join(allowed_events))
+ notify_log("Event type is %s" % event)
+
+ # Now go through the allowed events. Handle '?' has matching all types!
+ for allowed in allowed_events:
+ if event == allowed or \
+ event[0] == '?' and event[1] == allowed[1]:
+ return
+
+ return "Event type '%s' not handled by this rule. Allowed are: %s" % (
+ event, ", ".join(allowed_events))
def rbn_rule_contacts(rule, context):
@@ -1495,6 +1502,38 @@ def complete_raw_context(raw_context):
if not contact or contact == "check-mk-notify":
add_rulebased_macros(raw_context)
+
+ # Add the previous hard state. This is neccessary for notification rules that depend on certain transitions,
+ # like OK -> WARN (but not CRIT -> WARN). The CMC sends PREVIOUSHOSTHARDSTATE and PREVIOUSSERVICEHARDSTATE.
+ # Nagios does not have this information and we try to deduct this.
+ if "PREVIOUSHOSTHARDSTATE" not in raw_context:
+ prev_state = raw_context["LASTHOSTSTATE"]
+ # When the attempts are > 1 then the last state could be identical with
+ # the current one, e.g. both critical. In that case we assume the
+ # previous hard state to be OK.
+ if prev_state == raw_context["HOSTSTATE"]:
+ prev_state = "UP"
+ elif "HOSTATTEMPT" not in raw_context or \
+ ("HOSTATTEMPT" in raw_context and raw_context["HOSTATTEMPT"] != "1"):
+ # Here We do not know. The transition might be OK -> WARN -> CRIT and
+ # the initial OK is completely lost. We use the artificial state "?"
+ # here, which matches all states and makes sure that when in doubt a
+ # notification is being sent out.
+ prev_state = "?"
+ notify_log("Previous host hard state not known. Allowing all states.")
+ raw_context["PREVIOUSHOSTHARDSTATE"] = prev_state
+
+ # Same for services
+ if raw_context["WHAT"] == "SERVICE" and "PREVIOUSSERVICEHARDSTATE" not in raw_context:
+ prev_state = raw_context["LASTSERVICESTATE"]
+ if prev_state == raw_context["SERVICESTATE"]:
+ prev_state = "OK"
+ elif "SERVICEATTEMPT" not in raw_context or \
+ ("SERVICEATTEMPT" in raw_context and raw_context["SERVICEATTEMPT"] != "1"):
+ prev_state = "?"
+ notify_log("Previous service hard state not known. Allowing all states.")
+ raw_context["PREVIOUSSERVICEHARDSTATE"] = prev_state
+
convert_context_to_unicode(raw_context)
Module: check_mk
Branch: master
Commit: 17fde02d11e239c8e386e77f08818706618aeec2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=17fde02d11e239…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Thu Apr 3 18:40:25 2014 +0200
Werk descirptions augmented
---
.werks/601 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.werks/601 b/.werks/601
index 491c2a2..d00a54c 100644
--- a/.werks/601
+++ b/.werks/601
@@ -8,3 +8,5 @@ Class: incomp
If a description of the the alert group state is not available from the device, the check
now displays a textual representation of the alert code instead of the alert code itself.
This makes the service output more readable and useful to the printer admin.
+
+With this change the printer_alerts_state_map is deprecated and will no longer be used.
Module: check_mk
Branch: master
Commit: 386fc83c032240ba8e931e687891eccdf4ef0563
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=386fc83c032240…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Thu Apr 3 18:37:16 2014 +0200
printer_alerts: check can now display a textual representation of the alert code
If a description of the the alert group state is not available from the device, the check
now displays a textual representation of the alert code instead of the alert code itself.
This makes the service output more readable and useful to the printer admin.
---
.werks/601 | 10 ++++
ChangeLog | 4 ++
checkman/printer_alerts | 30 ++++------
checks/printer_alerts | 149 +++++++++++++++++++++++++++++++++++++++--------
4 files changed, 149 insertions(+), 44 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=386fc83c03…
Module: check_mk
Branch: master
Commit: d23c8cb5a121876921dfa17ddb58153cbeedd84a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d23c8cb5a12187…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Apr 3 15:15:49 2014 +0200
enterasys_lsnat: new check monitoring the current LSNAT bindings
---
.werks/783 | 8 +++++
ChangeLog | 1 +
checkman/enterasys_lsnat | 17 ++++++++++
checks/enterasys_lsnat | 59 ++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 22 +++++++++++++
5 files changed, 107 insertions(+)
diff --git a/.werks/783 b/.werks/783
new file mode 100644
index 0000000..c4c9727
--- /dev/null
+++ b/.werks/783
@@ -0,0 +1,8 @@
+Title: enterasys_lsnat: new check monitoring the current LSNAT bindings
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1396530940
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 527b30f..8f32594 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
Checks & Agents:
* 0149 cisco_secure: New check for Port Security on Cisco swichtes
* 0751 New localcheck for Linux that makes sure that filesystems in /etc/fstab are mounted...
+ * 0783 enterasys_lsnat: new check monitoring the current LSNAT bindings
* 0777 FIX: special agent emcvnx: did not work with security file authentication...
Multisite:
diff --git a/checkman/enterasys_lsnat b/checkman/enterasys_lsnat
new file mode 100644
index 0000000..4c4953b
--- /dev/null
+++ b/checkman/enterasys_lsnat
@@ -0,0 +1,17 @@
+title: Enterasys: LSNAT bindings
+agents: snmp
+catalog: hw/network/enterasys
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the number of current LSNAT bindings if the feature is activated
+ on this device (oid .1.3.6.1.4.1.5624.1.2.74.1.1.5.0 must contain a value)
+
+inventory:
+ One check is created for each Enterasys device
+
+[parameters]
+parameters (dict): A dictionary with the following optional keys:
+
+ {"current_bindings"}: tuple(int, int) representing the warn and crit limits for this check
+
diff --git a/checks/enterasys_lsnat b/checks/enterasys_lsnat
new file mode 100644
index 0000000..e38169d
--- /dev/null
+++ b/checks/enterasys_lsnat
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+def inventory_enterasys_lsnat(info):
+ return [ (None, {}) ]
+
+def check_enterasys_lsnat(no_item, params, info):
+ if not info:
+ return 3, "LSNAT bindings info is missing"
+
+ lsnat_bindings = saveint(info[0][0])
+ warn, crit = params.get("current_bindings", (None, None))
+
+ state = 0
+ state_info = ""
+ if warn:
+ if lsnat_bindings > crit:
+ state = 2
+ state_info = state_markers[state]
+ elif lsnat_bindings > warn:
+ state = 1
+ state_info = state_markers[state]
+
+ return state, "Current bindings %d%s" % (lsnat_bindings, state_info)
+
+
+check_info["enterasys_lsnat"] = {
+ "check_function" : check_enterasys_lsnat,
+ "inventory_function" : inventory_enterasys_lsnat,
+ "service_description" : "LSNAT Bindings",
+ "group" : "lsnat",
+ "snmp_info" : ( ".1.3.6.1.4.1.5624.1.2.74.1.1.5", [ "0" ] ),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.5624.2.1") and
+ oid(".1.3.6.1.4.1.5624.1.2.74.1.1.5.0"),
+}
+
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 4b80934..2c7918d 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1295,6 +1295,28 @@ register_check_parameters(
register_check_parameters(
subgroup_networking,
+ "lsnat",
+ _("Enterasys LSNAT Bindings"),
+ Dictionary(
+ elements = [
+ ( "current_bindings",
+ Tuple(
+ title = _("Number of current LSNAT bindings"),
+ elements = [
+ Integer(title = _("Warning if above"), size = 10, unit=_("bindings")),
+ Integer(title = _("Critical if above"), size = 10, unit=_("bindings")),
+ ]
+ )
+ ),
+ ],
+ optional_keys = False,
+ ),
+ None,
+ "dict"
+)
+
+register_check_parameters(
+ subgroup_networking,
"wlc_clients",
_("WLC WiFi client connections"),
Tuple(