Module: check_mk
Branch: master
Commit: 8fd4c4c0d87340369e7b6d3a0407fafbdcaf4c8a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fd4c4c0d87340…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Oct 23 16:13:02 2013 +0200
Check added for the fan state and rpm of genuscreen firewalls
---
checkman/genua_fan | 37 +++++++++++++++++++++++++
checks/genua_fan | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+)
diff --git a/checkman/genua_fan b/checkman/genua_fan
new file mode 100644
index 0000000..3c4b58b
--- /dev/null
+++ b/checkman/genua_fan
@@ -0,0 +1,37 @@
+title: Check for fan state and rpm on genua devices
+agents: snmp
+catalog: hw/network/genua
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the state and rpm of fans found on genuscreen firewalls.
+ Lower and upper levels for the rpm may be given.
+
+ The check is known to run with genuscreen version 3.0 and 4.1, and supports
+ genuas regular enterprise id 3717 as well as the id 3137 which was
+ introduced in a bug in some versions of genuscreen.
+
+perfdata:
+ The rpm of the fans
+
+inventory:
+ The inventory process checks if the device has a system description OID
+ of .1.3.6.1.2.1.1.2.0 and if the name of this OID contains "genuscreen"
+ (case insensitive).
+ If this is true and a fan is found, then the it is inventorized.
+
+item:
+ The name of the fan according to the snmp output
+
+[parameters]
+parameters(dict): parameters is a dictionary with two keys
+
+ {"lower"}: a tuple of lower warning and critical values for the fan rpm
+
+ {"upper"}: a tuple of upper warning and critical values for the fan rpm
+
+[configuration]
+genua_fan_default_levels(dict): This variable is preset to
+
+ {{ "lower": ( 2000, 1000), "upper": (8000, 8400) }}
+
diff --git a/checks/genua_fan b/checks/genua_fan
new file mode 100644
index 0000000..50eecc3
--- /dev/null
+++ b/checks/genua_fan
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+
+# Warning- und Criticalwerte (u/min)
+genua_fan_default_levels = { "lower": ( 2000, 1000), "upper": (8000, 8400) }
+
+def inventory_genua_fan(info):
+ # remove empty elements due to alternative enterprise id in snmp_info
+ info = filter(None, info)
+
+ inventory = []
+ for fanNo, fanName, fanRPM, fanState in info[0]:
+ inventory.append( (fanName, "genua_fan_default_levels") )
+ return inventory
+
+def check_genua_fan(item, params, info):
+
+ # remove empty elements due to alternative enterprise id in snmp_info
+ info = filter(None, info)
+
+ fanStateStr = { "1":"OK", "2":"Warning", "3":"Critical",
+ "4":"Unkown", "5":"Unkown", "6":"Unkown"}
+
+ lowerwarn, lowercrit = params["lower"]
+ upperwarn, uppercrit = params["upper"]
+ for line in info[0]:
+ fanNo, fanName, fanRPM, fanState = line
+ if fanName != item: continue
+
+ rpm = saveint(fanRPM)
+
+ if rpm > uppercrit or rpm < lowercrit:
+ rpmstate = 2
+ rpmsym = "(!!)"
+ elif rpm > upperwarn or rpm < lowerwarn:
+ rpmstate = 1
+ rpmsym = "(!)"
+ else:
+ rpmstate = 0
+ rpmsym = ""
+
+ if fanState in ( "3", "4", "5", "6" ):
+ statestate = 2
+ statesym = "(!!)"
+ elif fanState == "2":
+ statestate = 1
+ statesym = "(!)"
+ else:
+ statestate = 0
+ statesym = ""
+
+ perfdata = [ ( 'rpm', fanRPM, upperwarn, uppercrit, 0, uppercrit ) ]
+ infotext = "State: %s %s, RPM: %s %s" % \
+ (fanStateStr[fanState], statesym, fanRPM, rpmsym)
+ state = max(statestate,rpmstate)
+ return (state, infotext, perfdata)
+
+ return (3, "UNKNOWN - FAN %s not found in SNMP data" % item)
+
+check_info['genua_fan'] = {
+ "inventory_function" : inventory_genua_fan,
+ "check_function" : check_genua_fan,
+ "service_description": "FAN %s",
+ "has_perfdata" : True,
+ "snmp_info" : [( ".1.3.6.1.4.1.3717.2.1.1.1.1",[
+ "1", # "fanNo"
+ "2", # "fanName"
+ "3", # "fanRPM"
+ "4" # "fanState"
+ ]),
+ ( ".1.3.6.1.4.1.3137.2.1.1.1.1",[
+ "1", # "fanNo"
+ "2", # "fanName"
+ "3", # "fanRPM"
+ "4" # "fanState"
+ ])],
+ "snmp_scan_function" : lambda oid: "genuscreen" in oid(".1.3.6.1.2.1.1.1.0").lower()
+}
Module: check_mk
Branch: master
Commit: 22b9790bb52ef1447e6fb5449a372b76cbc04dad
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=22b9790bb52ef1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 23 15:49:09 2013 +0200
FIX: LDAP: Custom user attributes can now be synced again
---
ChangeLog | 1 +
web/plugins/userdb/ldap.py | 22 +++++++++++-----------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 99321d3..834cc10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,6 +39,7 @@
(This might break code which uses some uncommon chars for varnames)
* FIX: Fixed computation of perfometer values, which did not care about
the snmp_check_interval. Simplyfied computation of perfometer values
+ * FIX: LDAP: Custom user attributes can now be synced again
BI:
* FIX: Fix exception when showing BI tree in reporting time warp
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 77faf2e..a8c1056 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -608,7 +608,7 @@ def ldap_convert_simple(user_id, ldap_user, user, user_attr, attr):
else:
return {}
-def ldap_convert_mail(params, user_id, ldap_user, user):
+def ldap_convert_mail(plugin, params, user_id, ldap_user, user):
mail = ''
if ldap_user.get(params.get('attr', ldap_attr('mail'))):
mail = ldap_user[params.get('attr', ldap_attr('mail'))][0].lower()
@@ -641,7 +641,7 @@ ldap_attribute_plugins['alias'] = {
'help': _('Populates the alias attribute of the WATO user by syncrhonizing an attribute '
'from the LDAP user account. By default the LDAP attribute "cn" is used.'),
'needed_attributes': lambda params: [ params.get('attr', ldap_attr('cn')) ],
- 'convert': lambda params, user_id, ldap_user, user: \
+ 'convert': lambda plugin, params, user_id, ldap_user, user: \
ldap_convert_simple(user_id, ldap_user, user, 'alias',
params.get('attr', ldap_attr('cn'))),
'lock_attributes': [ 'alias' ],
@@ -657,7 +657,7 @@ ldap_attribute_plugins['alias'] = {
# Checks wether or not the user auth must be invalidated (increasing the serial).
# In first instance, it must parse the pw-changed field, then check wether or not
# a date has been stored in the user before and then maybe increase the serial.
-def ldap_convert_auth_expire(params, user_id, ldap_user, user):
+def ldap_convert_auth_expire(plugin, params, user_id, ldap_user, user):
changed_attr = params.get('attr', ldap_attr('pw_changed'))
if not changed_attr in ldap_user:
raise MKLDAPException(_('The "Authentication Expiration" attribute (%s) could not be fetched '
@@ -710,7 +710,7 @@ ldap_attribute_plugins['pager'] = {
'of the WATO user accounts, which is then forwarded to Nagios and can be used'
'for notifications. By default the LDAP attribute "mobile" is used.'),
'needed_attributes': lambda params: [ params.get('attr', ldap_attr('mobile')) ],
- 'convert': lambda params, user_id, ldap_user, user: \
+ 'convert': lambda plugin, params, user_id, ldap_user, user: \
ldap_convert_simple(user_id, ldap_user, user, 'pager',
params.get('attr', ldap_attr('mobile'))),
'lock_attributes': ['pager'],
@@ -729,10 +729,10 @@ def register_user_attribute_sync_plugins():
ldap_attribute_plugins[attr] = {
'title': val['valuespec'].title(),
'help': val['valuespec'].help(),
- 'needed_attributes': lambda params: [ params.get('attr', ldap_attr(attr)) ],
- 'convert': lambda params, user_id, ldap_user, user: \
- ldap_convert_simple(user_id, ldap_user, user, attr,
- params.get('attr', ldap_attr(attr))),
+ 'needed_attributes': lambda params: [ params.get('attr', ldap_attr(attr)).lower() ],
+ 'convert': lambda plugin, params, user_id, ldap_user, user: \
+ ldap_convert_simple(user_id, ldap_user, user, plugin,
+ params.get('attr', ldap_attr(plugin)).lower()),
'lock_attributes': [ attr ],
'parameters': [
('attr', TextAscii(
@@ -745,7 +745,7 @@ def register_user_attribute_sync_plugins():
register_user_attribute_sync_plugins()
-def ldap_convert_groups_to_contactgroups(params, user_id, ldap_user, user):
+def ldap_convert_groups_to_contactgroups(plugin, params, user_id, ldap_user, user):
groups = []
# 1. Fetch CNs of all LDAP groups of the user (use group_dn, group_filter)
ldap_groups = ldap_user_groups(user_id, ldap_user['dn'], nested = params.get('nested', False))
@@ -777,7 +777,7 @@ ldap_attribute_plugins['groups_to_contactgroups'] = {
],
}
-def ldap_convert_groups_to_roles(params, user_id, ldap_user, user):
+def ldap_convert_groups_to_roles(plugin, params, user_id, ldap_user, user):
groups = []
# 1. Fetch DNs of all LDAP groups of the user
ldap_groups = [ g.lower() for g in ldap_user_groups(user_id, ldap_user['dn'],
@@ -911,7 +911,7 @@ def ldap_sync(add_to_changelog, only_username):
# Gather config from convert functions of plugins
for key, params in config.ldap_active_plugins.items():
- user.update(ldap_attribute_plugins[key]['convert'](params or {}, user_id, ldap_user, user))
+ user.update(ldap_attribute_plugins[key]['convert'](key, params or {}, user_id, ldap_user, user))
if not mode_create and user == users[user_id]:
continue # no modification. Skip this user.
Module: check_mk
Branch: master
Commit: b4cf3591826eb06e67292aeca4aa3051577151f6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b4cf3591826eb0…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Oct 23 15:10:20 2013 +0200
missing ChangeLog entry for previous commit..
---
ChangeLog | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 99321d3..7d0a2e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,8 @@
* FIX: fixed error handling in SNMP scan, inventory check fails now
if SNMP agent is not responding
* FIX: Ignore snmp_check_interval cache in interactive situations (e.g. -nv)
+ * FIX: check_mk config generation: on computing the checks parameters
+ there is no longer a small chance that existing rules get modified
Event Console:
* check_mkevents now available as C binary: check_mkevents_c
Module: check_mk
Branch: master
Commit: 194f9f1d7a16b848e70abac590076f8785430cd1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=194f9f1d7a16b8…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Oct 23 13:49:23 2013 +0200
check now works with any number of carp interfaces greater than 1
---
checkman/genua_state_correlation | 18 ++++++++++--------
checks/genua_state_correlation | 20 ++++++++++----------
2 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/checkman/genua_state_correlation b/checkman/genua_state_correlation
index c459cf1..0005332 100644
--- a/checkman/genua_state_correlation
+++ b/checkman/genua_state_correlation
@@ -4,17 +4,19 @@ catalog: hw/network/genua
license: GPL
distribution: check_mk
description:
- This check monitors if the two carp interfaces found on genuscreen devices
- have the same carp state. If not, the check is critical.
+ This check monitors if the two or more carp interfaces found on genuscreen
+ devices have the same carp state. If not, the check is critical.
- The check is known to run with genuscreen version 3.0 and supports genuas regular
- enterprise id 3717 as well as the id 3137 which was introduced in a bug in some
- versions of genuscreen.
+ The check is known to run with genuscreen version 3.0 and 4.1, supports
+ genuas regular enterprise id 3717 as well as the id 3137 which was
+ introduced in a bug in some versions of genuscreen.
perfdata:
None
inventory:
- The inventory process checks if the device has a system description OIDs (.1.3.6.1.2.1.1.2.0)
- and if the name of this OID contains "genuscreen" (case insensitive).
- If this is true the system is inventorized.
+ The inventory process checks if the device has a system description OID
+ of .1.3.6.1.2.1.1.2.0 and if the name of this OID contains "genuscreen"
+ (case insensitive).
+ If this is true and at least two carp interfaces are found, then the system
+ is inventorized.
diff --git a/checks/genua_state_correlation b/checks/genua_state_correlation
index 482db93..54432cd 100644
--- a/checks/genua_state_correlation
+++ b/checks/genua_state_correlation
@@ -68,23 +68,23 @@ def check_genua_state(item, _no_params, info):
return(3, "Invalid Output from Agent")
state = 0
- output = "Node test:"
carp_info = []
for ifIndex, ifName, ifType, ifLinkState, ifCarpState in info[0]:
if ifType == "6":
carp_info.append((ifIndex, ifName, ifType, ifLinkState, ifCarpState))
- if len(carp_info) != 2:
- return(3, "Number of carp interfaces is %d, needs to be 2" % len(carp_info))
+ # critical if the carp interfaces dont have the same state
+ carp_states = [ 0, 0, 0 ]
+ for i in range (0, len(carp_info)):
+ carp_states[int(carp_info[i][4])] += 1
+ if carp_info[0][4] != carp_info[i][4]:
+ state = 2
- # Output formatieren
- output += " %s:%s %s:%s" % (carp_info[0][1], genua_state_str(carp_info[0][4])\
- , carp_info[1][1], genua_state_str(carp_info[1][4]))
-
- # critical if the two carp interfaces dont have the same state
- if carp_info[0][4] != carp_info[1][4]:
- state = 2
+ output = "Number of carp IFs in states "
+ for i in ('0', '1', '2'):
+ output += genua_state_str(i)
+ output += ":%d " % carp_states[int(i)]
return(state, output)
Module: check_mk
Branch: master
Commit: c88dc65e6fd9f162f969b52285c7e29d21e59350
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c88dc65e6fd9f1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 23 13:00:39 2013 +0200
FIX: Fixed computation of perfometer values (handle snmp_check_interval)
---
ChangeLog | 2 ++
web/htdocs/sidebar.py | 38 +++++++-------------------------------
2 files changed, 9 insertions(+), 31 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 43e6d79..99321d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,8 @@
* FIX: Hosttag filter now works in service related views
* FIX: Added code to prevent injection of bogus varnames
(This might break code which uses some uncommon chars for varnames)
+ * FIX: Fixed computation of perfometer values, which did not care about
+ the snmp_check_interval. Simplyfied computation of perfometer values
BI:
* FIX: Fix exception when showing BI tree in reporting time warp
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index f8c6ddc..1fe55bd 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -478,39 +478,15 @@ def ajax_speedometer():
# That way we save CPU resources since the computation of the
# scheduled checks rate needs to loop over all hosts and services.
if last_program_start != program_start:
-
- # 1. Get data of all active services and of passive/non-check_mk-services.
- # For passive services we assume that they are scheduled with the rate the
- # is configured via "check_interval". Nagios does not use this setting for i
- # passive checks, but we have no other option.
+ # These days, we configure the correct check interval for Check_MK checks.
+ # We do this correctly for active and for passive ones. So we can simply
+ # use the check_interval of all services. Hosts checks are ignored.
+ #
+ # Manually added services without check_interval could be a problem, but
+ # we have no control there.
scheduled_rate = html.live.query_summed_stats(
"GET services\n"
- "Stats: suminv check_interval\n"
- "Filter: active_checks_enabled = 1\n"
- "Filter: check_command ~ ^check_mk-\n"
- "Negate:\n"
- "Filter: active_checks_enabled = 0\n"
- "And: 2\n"
- "Or: 2\n")[0] / 60.0
-
- # 3. Acount for check_mk-checks. Here we need to check interval of the
- # Check_MK services on the host. Its check rate applies to the passive
- # checks. First get the check intervals of the check_mk checks:
- intervals = html.live.query_table(
- "GET services\n"
- "Columns: host_name check_interval\n"
- "Filter: description = Check_MK")
-
- # Now get the number of passive check_mk checks for each host and convert
- # it to a dict from host -> number of services
- num_svcs = dict(html.live.query_table(
- "GET services\n"
- "Columns: host_name\n"
- "Stats: check_command ~ ^check_mk-"))
-
- for host_name, check_interval in intervals:
- num_services = num_svcs.get(host_name, 0)
- scheduled_rate += float(num_services) / check_interval / 60.0
+ "Stats: suminv check_interval\n")[0] / 60.0
percentage = 100.0 * current_rate / scheduled_rate;
title = _("Scheduled service check rate: %.1f/s, current rate: %.1f/s, that is "