Module: check_mk
Branch: master
Commit: 3e799bd24fcc4e3989fc199b6824bc1d170faaaf
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e799bd24fcc4e…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Aug 11 17:35:46 2014 +0200
#1173 cisco_secure: Check creates now a summary instead one service by port
With this new behavier it's much easyer to handle fussy enviroments whith many
portstate changes.
A re-service detection for the switch's with port security is necessary after Update.
---
.werks/1173 | 12 ++++++++++++
ChangeLog | 2 ++
checkman/cisco_secure | 7 +++----
checks/cisco_secure | 28 ++++++++++++----------------
4 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/.werks/1173 b/.werks/1173
new file mode 100644
index 0000000..3a2f618
--- /dev/null
+++ b/.werks/1173
@@ -0,0 +1,12 @@
+Title: cisco_secure: Check creates now a summary instead one service by port
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.5i6
+Date: 1407771069
+Class: feature
+
+With this new behavier it's much easyer to handle fussy enviroments whith many
portstate changes.
+
+A re-service detection for the switch's with port security is necessary after
Update.
+
diff --git a/ChangeLog b/ChangeLog
index 4f12d8f..62aabde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,8 @@
* 0200 arris_cmts_cpu,arris_cmts_temp: New Checks for Arris CMTS Devices (
Temperature and CPU Utilization)
* 0202 cisco_temp_sensor: It is now possible to configure this check in WATO....
* 1172 New check sap.value_groups...
+ * 1173 cisco_secure: Check creates now a summary instead one service by port...
+ NOTE: Please refer to the migration notes!
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checkman/cisco_secure b/checkman/cisco_secure
index 41a508f..c084d47 100644
--- a/checkman/cisco_secure
+++ b/checkman/cisco_secure
@@ -6,12 +6,11 @@ distribution: check_mk
description:
This check monitors the port Security feature of cisco_switches. It returns a {CRITICAL}
state for
each port which is locked due a security isse. If is port security configured but cant
be enabled
- the check returns {WARNING}. If a port goes down, the check ignores that and only shows
a information in the
- check output.
+ the check returns {WARNING}.
item:
- The description of the Port
+ None
inventory:
- One check for each port with enabled port security which is also up will be created
+ One summary check will be created
diff --git a/checks/cisco_secure b/checks/cisco_secure
index aa7e030..e82d7ec 100644
--- a/checks/cisco_secure
+++ b/checks/cisco_secure
@@ -35,12 +35,12 @@ def cisco_secure_convert(info):
def inventory_cisco_secure(info):
info = cisco_secure_convert(info)
- inventory = []
+ # search for at least one port with security
for name, op_state, enabled, status, violationCount, lastmac in info:
#if portsecurity enabled and port up OR currently there is sercurity issue`
if ( enabled == 1 and op_state == 1) or status == 3:
- inventory.append( (name, None) )
- return inventory
+ return [ (None, None) ]
+ return []
def check_cisco_secure(item, params, info):
secure_states = {
@@ -50,21 +50,17 @@ def check_cisco_secure(item, params, info):
}
info = cisco_secure_convert(info)
+ failed = []
for name, op_state, enabled, status, violationCount, lastmac in info:
- if name == item:
- message = "Port Security %s (Violation Count: %s, Last Mac: %s)" %
\
- ( secure_states[status], violationCount, lastmac )
+ message = "Port %s: %s (Violation Count: %s, Last Mac: %s)" % \
+ ( name, secure_states[status], violationCount, lastmac )
- # If port cant be enabled and is up
- if status == 2 and op_state == 1:
- return 1, message
- # Port cant be enabled but is down, so no error state
- elif status == 2:
- return 0, "Port is down"
- # Security issue
- elif status == 3:
- return 2, message
- return 0, message
+ # If port cant be enabled and is up
+ if status == 2 and op_state == 1:
+ yield 1, message
+ # Security issue
+ elif status == 3:
+ yield 2, message
check_info["cisco_secure"] = {
"check_function" : check_cisco_secure,