Module: check_mk
Branch: master
Commit: c71ddffce4c821615e8522d6ecdf31aa798c0995
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c71ddffce4c821…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Sep 3 11:43:04 2012 +0200
Merged ups_capacity with masterguard_capacity
---
checks/masterguard_capacity | 52 -------------------------------------------
checks/ups_capacity | 10 +++++--
2 files changed, 7 insertions(+), 55 deletions(-)
diff --git a/checks/masterguard_capacity b/checks/masterguard_capacity
deleted file mode 100644
index 6272a82..0000000
--- a/checks/masterguard_capacity
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# -*- encoding: utf-8; py-indent-offset: 4 -*-
-# +------------------------------------------------------------------+
-# | ____ _ _ __ __ _ __ |
-# | / ___| |__ ___ ___| | __ | \/ | |/ / |
-# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
-# | | |___| | | | __/ (__| < | | | | . \ |
-# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
-# | |
-# | Copyright Mathias Kettner 2012 mk(a)mathias-kettner.de |
-# +------------------------------------------------------------------+
-#
-# This file is part of Check_MK.
-# The official homepage is at
http://mathias-kettner.de/check_mk.
-#
-# check_mk is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation in version 2. check_mk is distributed
-# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
-# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE. See the GNU General Public License for more de-
-# ails. You should have received a copy of the GNU General Public
-# License along with GNU Make; see the file COPYING. If not, write
-# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-# Boston, MA 02110-1301 USA.
-
-
-# ==> Remaining capacity in estimated minutes
-# SNMPv2-SMI::mib-2.33.1.2.3.0 = INTEGER: 150
-
-masterguard_capacity_default_levels = (20, 10)
-
-def check_masterguard_capacity(item, params, info):
- warn, crit = params
- minutes = int(info[0][0])
- message = " - remaining capacity is estimated %d minutes" % minutes
- state = 0
- if minutes <= warn:
- state = 1
- if minutes <= crit:
- state = 2
- perf = [("capacity", minutes, warn, crit)]
- return (state, nagios_state_names[state] + message, perf )
-
-check_info['masterguard_capacity'] = {
- "inventory_function" : lambda info: [( None,
"masterguard_capacity_default_levels")],
- "check_function" : check_masterguard_capacity,
- "service_description" : "Battery capacity",
- "has_perfdata" : True,
- "snmp_info" : ( ".1.3.6.1.2.1.33.1.2", [ "3.0"
] ),
- "snmp_scan_function" : lambda oid: "masterguard" in
oid('.1.3.6.1.2.1.1.1.0').lower(),
-}
diff --git a/checks/ups_capacity b/checks/ups_capacity
index 228e7c6..4f12489 100644
--- a/checks/ups_capacity
+++ b/checks/ups_capacity
@@ -53,7 +53,7 @@ def check_ups_capacity(item, params, info):
if params != None:
warn, crit = params
else:
- warn, crit = ups_capacity_defaul_levels
+ warn, crit = (0, 0)
time_on_bat, minutes_left, percent_fuel = map(int, info[0])
perf = [
@@ -72,6 +72,10 @@ check_info["ups_capacity"] = {
"inventory_function" : inventory_ups_capacity,
"service_description" : "Battery capacity",
"has_perfdata" : True,
- "snmp_scan_function" : lambda oid:
(".1.3.6.1.2.1.33.1.2.3.0"),
- "snmp_info" : ( ".1.3.6.1.2.1.33.1.2", [
"2.0" , "3.0" ,"4.0" ] )
+ "snmp_info" : ( ".1.3.6.1.2.1.33.1.2", [
"2.0" , "3.0" ,"4.0" ] ),
+ "snmp_scan_function" : lambda oid:"masterguard" in
oid(".1.3.6.1.2.1.1.1.0").lower() or \
+ "CS121" in oid(".1.3.6.1.2.1.1.1.0") or
\
+ oid(".1.3.6.1.2.1.1.2.0") in \
+ [ ".1.3.6.1.4.1.818.1.100.1.1",
".1.3.6.1.2.1.33.2" ] \
+ or
oid('.1.3.6.1.2.1.33.1.1.1.0').startswith('RPS')
}