Module: check_mk
Branch: master
Commit: 249351e091275ac8ed3f9bc4bc09a9544417a948
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=249351e091275a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 5 17:25:45 2013 +0100
Migrated to new check api
---
checks/lsi | 28 ++++++++++++++++++++--------
checks/smart | 23 +++++++++++++++++++----
2 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/checks/lsi b/checks/lsi
index f5523d7..cc9c35d 100644
--- a/checks/lsi
+++ b/checks/lsi
@@ -24,8 +24,6 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-
-
def inventory_lsi(check_type, info):
# convert [ 0, 1, 2, 3, 4, 5, ...] into [ (0,1), (2,3), (4,5), ... ]
@@ -46,6 +44,7 @@ def inventory_lsi(check_type, info):
else:
return [(id, '"%s"' % state) for (id, state) in disks]
+
def check_lsi_array(item, _no_params, info):
volumeid = -1
for line in info:
@@ -59,6 +58,16 @@ def check_lsi_array(item, _no_params, info):
return (2, 'CRIT - Status is %s' % (status,))
return (2, 'CRIT - RAID volume %d not existing' % item)
+check_info["lsi.array"] = {'check_function': check_lsi_array,
+ 'default_levels_variable': None,
+ 'group': 'raid',
+ 'has_perfdata': False,
+ 'inventory_function': lambda info: inventory_lsi('lsi.array', info),
+ 'node_info': False,
+ 'service_description': 'RAID array %s',
+ 'snmp_info': None,
+ 'snmp_scan_function': None}
+
def check_lsi_disk(item, target_state, info):
target_id = -1
@@ -73,9 +82,12 @@ def check_lsi_disk(item, target_state, info):
return (2, 'CRIT - disk has state %s (should be %s)' % (state,
target_state))
return (2, 'CRIT - disk not present')
-
-check_info['lsi.array'] = (check_lsi_array, "RAID array %s", 0, lambda
info: inventory_lsi('lsi.array', info))
-checkgroup_of['lsi.array'] = "raid"
-
-check_info['lsi.disk'] = (check_lsi_disk, "RAID disk %s", 0, lambda
info: inventory_lsi('lsi.disk', info))
-checkgroup_of['lsi.disk'] = "raid_disk"
+check_info["lsi.disk"] = {'check_function': check_lsi_disk,
+ 'default_levels_variable': None,
+ 'group': 'raid_disk',
+ 'has_perfdata': False,
+ 'inventory_function': lambda info: inventory_lsi('lsi.disk', info),
+ 'node_info': False,
+ 'service_description': 'RAID disk %s',
+ 'snmp_info': None,
+ 'snmp_scan_function': None}
diff --git a/checks/smart b/checks/smart
index a605e86..f36e0d2 100644
--- a/checks/smart
+++ b/checks/smart
@@ -117,6 +117,16 @@ def check_smart_stats(item, params, info):
return (status, '%s - %s' % (nagios_state_names[status], ',
'.join(output)), perfdata)
+check_info["smart.stats"] = {'check_function': check_smart_stats,
+ 'default_levels_variable': None,
+ 'group': 'smart.stats',
+ 'has_perfdata': True,
+ 'inventory_function': lambda info: inventory_smart("smart.stats",
info),
+ 'node_info': False,
+ 'service_description': 'SMART %s Stats',
+ 'snmp_info': None,
+ 'snmp_scan_function': None}
+
# Written by Benjamin Odenthal
#
http://exchange.check-mk.org/index.php?option=com_remository&Itemid=53&…
@@ -135,7 +145,12 @@ def check_smart_temp(item, params, info):
return (0, "OK - Temperature is %dC" % celsius, perfdata)
return (3, "UNKNOWN - Temperature_Celsius not found in agent output for disk
%s" % item)
-
-check_info['smart.stats'] = (check_smart_stats, "SMART %s Stats",
1, lambda info: inventory_smart("smart.stats", info))
-check_info['smart.temp'] = (check_smart_temp, "Temperature SMART %s",
1, lambda info: inventory_smart("smart.temp", info))
-checkgroup_of['smart.temp'] = "hw_temperature"
+check_info["smart.temp"] = {'check_function': check_smart_temp,
+ 'default_levels_variable': None,
+ 'group': 'hw_temperature',
+ 'has_perfdata': True,
+ 'inventory_function': lambda info: inventory_smart("smart.temp",
info),
+ 'node_info': False,
+ 'service_description': 'Temperature SMART %s',
+ 'snmp_info': None,
+ 'snmp_scan_function': None}