Module: check_mk
Branch: master
Commit: b3597d8071061f494e38182d432d10a7457bfabd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b3597d8071061f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 7 08:52:52 2013 +0100
Removed fritz.uptime check and moved the value to the connection check
---
checkman/fritz.uptime | 28 ----------------------------
checks/fritz | 33 +++++++++------------------------
2 files changed, 9 insertions(+), 52 deletions(-)
diff --git a/checkman/fritz.uptime b/checkman/fritz.uptime
deleted file mode 100644
index 5b7e0ae..0000000
--- a/checkman/fritz.uptime
+++ /dev/null
@@ -1,28 +0,0 @@
-title: Uptime of Fritz!Box
-agents: fritzbox
-catalog: hw/network/avm
-license: GPL
-distribution: check_mk
-description:
- This check is always OK and simply outputs the uptime of the target
- Fritz!Box device (when the last boot was and how much time has elapsed since).
-
- The check uses data provided by the fritzbox special agent. You need to
- configure this agent to be used for the Fritz!Box you like to monitor. The
- special agent uses uPnP to get the needed information from the device.
-
-perfdata:
- The uptime in seconds.
-
-inventory:
- One check per system is created if the agent has a section
{<<<fritz>>>} and
- the key {NewUptime} in this section.
-
-[parameters]
-parameters (dict): A dictionary with the following optional keys:
-
- {"min"}: Pair of integers of warn and crit: the minimum required uptime
- uptime in seconds.
-
- {"max"}: Pair of integers of warn and crit: the maximum allowed uptime
- uptime in seconds.
diff --git a/checks/fritz b/checks/fritz
index 2793506..812d519 100644
--- a/checks/fritz
+++ b/checks/fritz
@@ -60,13 +60,20 @@ def check_fritz_conn(_unused, _no_params, info):
if last_err and last_err != 'ERROR_NONE':
output += ', Last Error: %s' % last_err
- return nag_state, output
+ perfdata = []
+ if data.get('NewUptime'):
+ conn_time = check_uptime_seconds({}, float(data['NewUptime']))
+ output += ', %s' % conn_time[1]
+ perfdata = conn_time[2]
+
+ return nag_state, output, perfdata
check_info['fritz.conn'] = {
"inventory_function" : inventory_fritz_conn,
"check_function" : check_fritz_conn,
"service_description" : "Connection",
- "has_perfdata" : False,
+ "includes" : [ "uptime.include" ],
+ "has_perfdata" : True,
}
@@ -106,28 +113,6 @@ check_info['fritz.config'] = {
}
#
-# Uptime
-#
-
-def inventory_fritz_uptime(info):
- data = fritz_parse_info(info)
- if 'NewUptime' in data:
- return [ (None, {}) ]
-
-def check_fritz_uptime(_no_item, params, info):
- data = fritz_parse_info(info)
- return check_uptime_seconds(params, float(data['NewUptime']))
-
-check_info["fritz.uptime"] = {
- 'check_function': check_fritz_uptime,
- 'inventory_function': inventory_fritz_uptime,
- 'service_description': 'Uptime',
- 'has_perfdata': True,
- 'includes': [ 'uptime.include' ],
- 'group': 'uptime',
-}
-
-#
# WAN Interface Check
#