Module: check_mk
Branch: master
Commit: fb6098d94b12408c82534f4c141ae63a35440a72
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fb6098d94b1240…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Sep 26 09:42:08 2013 +0200
Updated bug entries #0987, #0956
---
.bugs/956 | 14 ++++++++++++++
.bugs/987 | 13 +++++++++++++
2 files changed, 27 insertions(+)
diff --git a/.bugs/956 b/.bugs/956
new file mode 100644
index 0000000..592a32e
--- /dev/null
+++ b/.bugs/956
@@ -0,0 +1,14 @@
+Title: Handle extra IP addresses of service boards intelligently
+Component: core
+State: open
+Date: 2013-09-26 09:30:22
+Targetversion: future
+Class: feature
+
+Many people have servers with service boards. The servers are monitored
+with TCP and maybe also SNMP. The service boards have different IP
+addresses and are monitored via SNMP. It would be *very* nice to have that
+services mapped onto the actual server, not onto a separate host in
+the monitoring.
+
+Find a good, simple solution with a simple and clear code impact.
diff --git a/.bugs/987 b/.bugs/987
new file mode 100644
index 0000000..2167aec
--- /dev/null
+++ b/.bugs/987
@@ -0,0 +1,13 @@
+Title: Manage members of a contactgroup in the contactgroup
+Component: wato
+State: open
+Date: 2013-09-26 09:32:08
+Targetversion: 1.4.0
+Class: feature
+
+It would be very nice if one could manage the members of
+a contactgroup also in the settings of the contact group, not only
+on that of the contacts.
+
+We could us the new membership valuespec that show two selection
+lists.
Module: check_mk
Branch: master
Commit: 796158cf9c4cdcc74418fcfeac2e45e2c78d3040
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=796158cf9c4cdc…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Sep 25 18:06:34 2013 +0200
levels for the ups_capacity check can now be configured in WATO
---
checkman/ups_capacity | 40 +++++++++++++++++++++----
checks/ups_capacity | 40 +++++++++++++++++++------
web/plugins/wato/check_parameters.py | 53 +++++++++++++++++++++++++++++++++-
3 files changed, 118 insertions(+), 15 deletions(-)
diff --git a/checkman/ups_capacity b/checkman/ups_capacity
index cca4fb4..8233e09 100644
--- a/checkman/ups_capacity
+++ b/checkman/ups_capacity
@@ -4,13 +4,43 @@ catalog: hw/power
license: GPL
distribution: check_mk
description:
- This checks monitors the remaining capacity in minutes of a UPS
- that supports the generic UPS-MIB
- (such as General Electric (GE) SitePro UPS). The check is always
- OK, there are currently neither levels nor other parameters.
+ This checks monitors a UPS that supports the generic UPS-MIB,
+ such as General Electric (GE) SitePro UPS, and many more.
+ The check monitors
+ the time the UPS is on battery (in seconds),
+ the battery capacity (in percent),
+ and the remaining runtime (in minutes).
+ Warning and critical levels can
+ be given for the time on battery and the capacity.
perfdata:
- The remaining capacity in minutes
+ The remaining runtime in minutes and the capacity in percent
inventory:
Supported.
+
+examples:
+ ups_capacity_default_levels = {
+ 'battime': (0, 0),
+ 'capacity': (90, 80)
+ }
+
+ checkgroup_parameters.setdefault('ups_capacity', [])
+
+ checkgroup_parameters['ups_capacity'] = [
+ ( {'capacity': ( 90, 80 ) }, ["prod"], ALL_HOSTS, ["ups_capacity"]' ),
+ ] + checkgroup_parameters['ups_capacity']
+
+[configuration]
+ups_capacity_default_levels(dict): This variable is preset to {{ 'battime': (0, 0), 'capacity': (95, 90) }}
+
+
+[parameters]
+parameters(dict): with the keys "battime" and "capacity"
+
+ 'battime' is a tuple containing warning and critical levels for the
+ time in seconds the USV is on battery. Default levels are (0, 0)
+
+ 'capacity' is a tuple containing the warning and critical levels for
+ the battery capacity in percent. Default levels are (95, 90)
+
diff --git a/checks/ups_capacity b/checks/ups_capacity
index 9039082..d376435 100644
--- a/checks/ups_capacity
+++ b/checks/ups_capacity
@@ -42,18 +42,24 @@
# SNMPv2-SMI::mib-2.33.1.3.1.0 = Counter32: 13
# SNMPv2-SMI::mib-2.33.1.3.2.0 = INTEGER: 3
-ups_capacity_defaul_levels = (0, 0)
+#ups_capacity_defaul_levels = (0, 0)
+ups_capacity_default_levels = { 'battime': (0, 0), 'capacity': (95, 90) }
def inventory_ups_capacity(info):
if len(info) > 0:
- return [(None, 'ups_capacity_defaul_levels')]
+ return [(None, 'ups_capacity_default_levels')]
def check_ups_capacity(item, params, info):
- #To support inventorys with the old version
- if params != None:
+ # To support inventories with the old version
+ if type(params) is tuple: # old format with 2 params in tuple
warn, crit = params
+ cap_warn, cap_crit = (95, 90)
+ elif type(params) is dict: # new dict format
+ warn,crit = params.get('battime',(0,0))
+ cap_warn,cap_crit = params.get('capacity',(95,90))
else:
warn, crit = (0, 0)
+ cap_warn, cap_crit = (95, 90)
time_on_bat, minutes_left, percent_fuel = map(int, info[0])
perf = [
@@ -61,19 +67,35 @@ def check_ups_capacity(item, params, info):
('percent', percent_fuel),
]
- info_text = "remaining capacity %d minutes (%d%%)" % (minutes_left, percent_fuel)
+ state = 0
+ time_label = ""
+ cap_label = ""
if time_on_bat > crit:
- return(2, "On battery since %ds(!!) " % time_on_bat + info_text, perf)
+ state = 2
+ time_label = "On battery since %ds(%ds/%dss)(!!), " % time_on_bat, warn, crit
+ #return(2, "On battery since %ds(!!) " % time_on_bat + info_text, perf)
elif time_on_bat > warn:
- return(1, "On battery since %ds(!) " % time_on_bat + info_text, perf)
- else:
- return(0, info_text, perf)
+ state = 1
+ time_label = "On battery since %ds(%ds/%dss)(!)" % time_on_bat, warn, crit
+ #return(1, "On battery since %ds(!) " % time_on_bat + info_text, perf)
+ if percent_fuel < cap_crit:
+ state = 2
+ cap_label = "(!!)"
+ elif percent_fuel < cap_warn:
+ state = 1
+ cap_label = "(!)"
+
+ info_text = "%sremaining capacity %dmin, percentage %d%% (%d/%d) %s" \
+ % (time_label, minutes_left, percent_fuel, cap_warn, cap_crit, cap_label )
+ return(state, info_text, perf)
+
check_info["ups_capacity"] = {
"check_function" : check_ups_capacity,
"inventory_function" : inventory_ups_capacity,
"service_description" : "Battery capacity",
"has_perfdata" : True,
+ "group" : "ups_capacity",
"snmp_info" : ( ".1.3.6.1.2.1.33.1.2", [ "2.0" , "3.0" ,"4.0" ] ),
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") in \
[ ".1.3.6.1.4.1.534.1", ".1.3.6.1.4.1.705.1", ".1.3.6.1.4.1.818.1.100.1.1",
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 123ed17..defab5d 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3189,7 +3189,7 @@ register_check_parameters(
elements = [
Integer(
title = _("Critical Battery Capacity"),
- help = _("The battery capacity in percent at and below which a critical state is be triggered"),
+ help = _("The battery capacity in percent at and below which a critical state is triggered"),
unit = _("%"),
default_value = 95,
),
@@ -3247,6 +3247,57 @@ register_check_parameters(
"first"
)
+register_check_parameters(
+ subgroup_environment,
+ "ups_capacity",
+ _("UPS Capacity"),
+ Dictionary(
+ title = _("Levels for battery parameters"),
+ optional_keys = False,
+ elements = [
+ ("capacity",
+ Tuple(
+ title = _("Battery Capacity"),
+ elements = [
+ Integer(
+ title = _("Warning Level"),
+ help = _("The battery capacity in percent at and below which a warning state is triggered"),
+ unit = _("%"),
+ default_value = 95,
+ ),
+ Integer(
+ title = _("Critical Level"),
+ help = _("The battery capacity in percent at and below which a critical state is triggered"),
+ unit = _("%"),
+ default_value = 90,
+ ),
+ ],
+ ),
+ ),
+ ("battime",
+ Tuple(
+ title = _("Time Left on Battery"),
+ elements = [
+ Integer(
+ title = _("Warning Level"),
+ help = _("Time left on Battery at and below which a warning state is triggered"),
+ unit = _("%"),
+ default_value = 0,
+ ),
+ Integer(
+ title = _("Critical Level"),
+ help = _("Time Left on Battery at and below which a critical state is triggered"),
+ unit = _("min"),
+ default_value = 0,
+ ),
+ ],
+ ),
+ )],
+ ),
+ None,
+ "first"
+)
+
syslog_facilities = [
(0, "kern"),
(1, "user"),