Module: check_mk
Branch: master
Commit: 4f9a0e78176356880fce646cc64a0ccf5a128f2f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4f9a0e78176356…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 18 18:35:00 2010 +0100
drbd checks handle unconfigured devices correctly now
---
ChangeLog | 2 ++
checkman/drbd | 3 ++-
checkman/drbd.disk | 3 ++-
checkman/drbd.net | 3 ++-
checkman/drbd.stats | 3 ++-
checks/drbd | 22 +++++++++++++++++-----
6 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 39d657f..3ca81d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -76,6 +76,8 @@
* j4p_performance.mem: added new experimental check for memory usage via JMX.
* if/if64: added Perf-O-Meter for Multisite
* Cleaned up several checks to meet the variable naming conventions
+ * drbd: Handling unconfigured drbd devices correctly. These devices are
+ ignored during nventory
Multisite:
* The custom open/close states of custom links are now stored for each
diff --git a/checkman/drbd b/checkman/drbd
index d907d00..b6fbf10 100644
--- a/checkman/drbd
+++ b/checkman/drbd
@@ -24,7 +24,8 @@ examples:
]
inventory:
- Each DRBD device will result in one service during inventory.
+ Each configured DRBD device will result in one service during inventory. All
+ devices with the connection state "Unconfigured" are skipped.
[parameters]
roles (list): The expected role of each node
diff --git a/checkman/drbd.disk b/checkman/drbd.disk
index 840849a..b80eecc 100644
--- a/checkman/drbd.disk
+++ b/checkman/drbd.disk
@@ -13,7 +13,8 @@ item:
The name of the DRBD device e.g. drbd0
inventory:
- Each DRBD device will result in one service during inventory.
+ Each configured DRBD device will result in one service during inventory. All
+ devices with the connection state "Unconfigured" are skipped.
perfdata:
It contains the current read and write disk I/O given as kb/s
diff --git
a/checkman/drbd.net b/checkman/drbd.net
index 29ae710..04482f0 100644
---
a/checkman/drbd.net
+++
b/checkman/drbd.net
@@ -14,7 +14,8 @@ item:
The name of the DRBD device e.g. drbd0
inventory:
- Each DRBD device will result in one service during inventory.
+ Each configured DRBD device will result in one service during inventory. All
+ devices with the connection state "Unconfigured" are skipped.
perfdata:
It contains the current inbound and outbound network load given as kb/s
diff --git a/checkman/drbd.stats b/checkman/drbd.stats
index 0049a03..5c0b5c4 100644
--- a/checkman/drbd.stats
+++ b/checkman/drbd.stats
@@ -19,7 +19,8 @@ item:
The name of the DRBD device e.g. drbd0
inventory:
- Each DRBD device will result in one service during inventory.
+ Each configured DRBD device will result in one service during inventory. All
+ devices with the connection state "Unconfigured" are skipped.
perfdata:
One dataset is appended for each of the counters above.
diff --git a/checks/drbd b/checks/drbd
index f415dbf..c9af72e 100644
--- a/checks/drbd
+++ b/checks/drbd
@@ -146,9 +146,9 @@ drbd_stats_default_levels = ( None, None, None, None, None, None,
None, None,
drbd_block_start_match = re.compile('^[0-9]+:')
drbd_general_map = [ 'cs', 'ro', 'ds' ]
-drbd_net_map = [ 'ns', 'nr' ]
-drbd_disk_map = [ 'dw', 'dr' ]
-drbd_stats_map = [ 'al', 'bm', 'lo', 'pe',
'ua', 'ap', 'ep', 'wo', 'oos' ]
+drbd_net_map = [ 'cs', 'ns', 'nr' ]
+drbd_disk_map = [ 'cs', 'dw', 'dr' ]
+drbd_stats_map = [ 'cs', 'al', 'bm', 'lo',
'pe', 'ua', 'ap', 'ep', 'wo', 'oos' ]
drbd_cs_map = {
'StandAlone': 1, 'Disconnecting': 1,
@@ -169,7 +169,11 @@ def inventory_drbd(checktype, info):
for line in info[2:]:
if drbd_block_start_match.search(line[0]) > 0:
parsed = drbd_parse_block(drbd_extract_block('drbd%s' % line[0][:-1],
info), checktype)
- if checktype == 'drbd':
+ # Skip unconfigured drbd devices
+ if parsed['cs'] == 'Unconfigured':
+ continue
+
+ if checktye == 'drbd':
levels = '( [ "%s", "%s" ], [ "%s",
"%s" ] )' % \
(parsed['ro'][0], parsed['ro'][1],
parsed['ds'][0], parsed['ds'][1])
@@ -235,7 +239,9 @@ def drbd_get_block(item, info, checktype):
def check_drbd_general(item, params, info):
parsed = drbd_get_block(item, info, 'drbd')
if not parsed is None:
- if not parsed['cs'] in drbd_cs_map:
+ if parsed['cs'] == 'Unconfigured':
+ return (2, 'CRITICAL - The device is "Unconfigured"')
+ elif not parsed['cs'] in drbd_cs_map:
return (3, 'UNKNOWN - Undefined "connection state" in drbd
output')
# Weight of connection state is calculated by the drbd_cs_map.
@@ -274,6 +280,8 @@ def drbd_get_counters(list):
def check_drbd_net(item, params, info):
parsed = drbd_get_block(item, info, 'drbd.net')
if not parsed is None:
+ if parsed['cs'] == 'Unconfigured':
+ return (2, 'CRITICAL - The device is "Unconfigured"')
output, perfdata = drbd_get_counters([ ('drbd.net', 'in', item,
int(parsed['nr']), 'kb'),
('drbd.net', 'out', item,
int(parsed['ns']), 'kb') ])
# FIXME: Maybe handle thresholds in the future
@@ -284,6 +292,8 @@ def check_drbd_net(item, params, info):
def check_drbd_disk(item, params, info):
parsed = drbd_get_block(item, info, 'drbd.disk')
if not parsed is None:
+ if parsed['cs'] == 'Unconfigured':
+ return (2, 'CRITICAL - The device is "Unconfigured"')
output, perfdata = drbd_get_counters([ ('drbd.disk', 'write',
item, int(parsed['dw']), 'kb'),
('drbd.disk', 'read',
item, int(parsed['dr']), 'kb') ])
# FIXME: Maybe handle thresholds in the future
@@ -294,6 +304,8 @@ def check_drbd_disk(item, params, info):
def check_drbd_stats(item, params, info):
parsed = drbd_get_block(item, info, 'drbd.stats')
if not parsed is None:
+ if parsed['cs'] == 'Unconfigured':
+ return (2, 'CRITICAL - The device is "Unconfigured"')
output = ''
perfdata = []
for key, label in [ ('al', 'activity log updates'),
('bm', 'bit map updates'),