Module: check_mk
Branch: master
Commit: 520d6409dffaf9aca56bc893d675d9992468f75c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=520d6409dffaf9…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Aug 14 08:43:57 2017 +0200
transformed checkplugin revisited
Change-Id: Ic8299885cc4a4134b5be32e0b2f44cd949954750
---
checkman/stormshield_policy | 14 -----------
checkman/stormshield_sync | 11 +++++++++
checks/{stormshield_policy => stormshield_sync} | 32 ++++++++++++-------------
3 files changed, 26 insertions(+), 31 deletions(-)
diff --git a/checkman/stormshield_policy b/checkman/stormshield_policy
deleted file mode 100644
index cfae8c9..0000000
--- a/checkman/stormshield_policy
+++ /dev/null
@@ -1,14 +0,0 @@
-title: Stormshield: Policy status
-agents: snmp
-catalog: hw/network/stormshield
-license: GPL
-distribution: check_mk
-description:
- This check measures the syncing of a policy. The state will change to {CRIT}
- if the policy is not synced.
-
-item:
- The policy name is the item
-
-inventory:
- One service for each policy is created
diff --git a/checkman/stormshield_sync b/checkman/stormshield_sync
new file mode 100644
index 0000000..9289c8c
--- /dev/null
+++ b/checkman/stormshield_sync
@@ -0,0 +1,11 @@
+title: Stormshield: Sync status
+agents: snmp
+catalog: hw/network/stormshield
+license: GPL
+distribution: check_mk
+description:
+ This check measures the sync status in a cluster environment. The state will change to
{CRIT}
+ if the cluster nodes are not synced.
+
+inventory:
+ Only one service is created
diff --git a/checks/stormshield_policy b/checks/stormshield_sync
similarity index 67%
rename from checks/stormshield_policy
rename to checks/stormshield_sync
index 5422e0a..24ffcc0 100644
--- a/checks/stormshield_policy
+++ b/checks/stormshield_sync
@@ -28,30 +28,28 @@
# example output
-def inventory_stormshield_policy(info):
- for line in info:
- yield (line[0], None)
+def inventory_stormshield_sync(info):
+ return [ (None, None) ]
-def check_stormshield_policy(item, params, info):
+def check_stormshield_sync(_no_item, _no_params, info):
sync_status = {
- '1' : (0, "synced"),
- '2' : (2, "not synced"),
+ '1' : (0, "Synced"),
+ '0' : (2, "Not synced"),
+ '-1' : (3, "Unknown / error"),
}
- for line in info:
- if line[0] == item:
- state, state_readable = sync_status[line[1]]
- yield state, "Policy is %s" % state_readable
+ state, state_readable = sync_status[info[0][0]]
+ return state, "%s" % state_readable
-check_info['stormshield_policy'] = {
- 'inventory_function' : inventory_stormshield_policy,
- 'check_function' : check_stormshield_policy,
- 'service_description' : 'Policy %s status',
- 'snmp_info' : ('.1.3.6.1.4.1.11256.1.8.1.1', [
- '2', # STORMSHIELD-POLICY-MIB::snsPolicyName
- '5', # STORMSHIELD-POLICY-MIB::snsPolicySync
+
+check_info['stormshield_sync'] = {
+ 'inventory_function' : inventory_stormshield_sync,
+ 'check_function' : check_stormshield_sync,
+ 'service_description' : 'Sync status',
+ 'snmp_info' : ('.1.3.6.1.4.1.11256.1.11', [
+ '8', #
STORMSHIELD-POLICY-MIB::snsHASyncStatus
]),
'snmp_scan_function' : stormshield_scan_function,
'includes' : [ 'stormshield.include' ],