Module: check_mk
Branch: master
Commit: 51dea9a4dc31b0d8a4cb014cd5a41feb89bfeb73
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=51dea9a4dc31b0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 26 10:15:14 2015 +0100
#2166 LDAP: Multiple LDAP groups can be configured for assigning single roles to users
In previous versions only one LDAP group per role could be configured to assign this
role the the members of the LDAP group. It's now possible to use multiple ldap groups
for a single role.
---
.werks/2166 | 11 +++++++++
ChangeLog | 1 +
web/plugins/userdb/ldap.py | 54 ++++++++++++++++++++++++++++++--------------
3 files changed, 49 insertions(+), 17 deletions(-)
diff --git a/.werks/2166 b/.werks/2166
new file mode 100644
index 0000000..47f3445
--- /dev/null
+++ b/.werks/2166
@@ -0,0 +1,11 @@
+Title: LDAP: Multiple LDAP groups can be configured for assigning single roles to users
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i1
+Date: 1427361208
+Class: feature
+
+In previous versions only one LDAP group per role could be configured to assign this
+role the the members of the LDAP group. It's now possible to use multiple ldap groups
+for a single role.
diff --git a/ChangeLog b/ChangeLog
index 70f79e2..f1bf387 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -302,6 +302,7 @@
* 2042 Services are now sorted in a natural way, this affects services containing numbers...
* 2140 Remove PNP Timeranges from range selection, put these ranges directly into the list...
* 1239 Fixed /treasures/downtime script to work with the new visuals
+ * 2166 LDAP: Multiple LDAP groups can be configured for assigning single roles to users...
* 1781 FIX: Fix broken grouping by host/service group in availability
* 1783 FIX: Finish the view "History of Scheduled Downtimes"...
* 1206 FIX: Hostname not longer shown as column in host views
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index e0c0ae0..54ef6f6 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -904,8 +904,16 @@ ldap_attribute_plugins['groups_to_contactgroups'] = {
def ldap_convert_groups_to_roles(plugin, params, user_id, ldap_user, user):
# Load the needed LDAP groups, which match the DNs mentioned in the role sync plugin config
- ldap_groups = dict(ldap_group_members([ dn.lower() for role_id, dn in params.items() if isinstance(dn, str) ],
- filt_attr = 'distinguishedname', nested = params.get('nested', False)))
+ groups_to_fetch = []
+ for role_id, distinguished_names in params.items():
+ if type(distinguished_names) == list:
+ groups_to_fetch += [ dn.lower() for dn in distinguished_names ]
+ elif type(distinguished_names) == str:
+ groups_to_fetch.append(distinguished_names.lower())
+
+ ldap_groups = dict(ldap_group_members(groups_to_fetch,
+ filt_attr = 'distinguishedname',
+ nested = params.get('nested', False)))
# posixGroup objects use the memberUid attribute to specify the group
# memberships. This is the username instead of the users DN. So the
@@ -915,14 +923,18 @@ def ldap_convert_groups_to_roles(plugin, params, user_id, ldap_user, user):
roles = set([])
# Loop all roles mentioned in params (configured to be synchronized)
- for role_id, dn in params.items():
- if not isinstance(dn, str):
- continue # skip non configured ones
- dn = dn.lower() # lower case matching for DNs!
+ for role_id, distinguished_names in params.items():
+ if type(distinguished_names) != list:
+ distinguished_names = [distinguished_names]
+
+ for dn in distinguished_names:
+ if not isinstance(dn, str):
+ continue # skip non configured ones (old valuespecs allowed None)
+ dn = dn.lower() # lower case matching for DNs!
- # if group could be found and user is a member, add the role
- if dn in ldap_groups and user_cmp_val in ldap_groups[dn]['members']:
- roles.add(role_id)
+ # if group could be found and user is a member, add the role
+ if dn in ldap_groups and user_cmp_val in ldap_groups[dn]['members']:
+ roles.add(role_id)
# Load default roles from default user profile when the user got no role
# by the role sync plugin
@@ -934,14 +946,22 @@ def ldap_convert_groups_to_roles(plugin, params, user_id, ldap_user, user):
def ldap_list_roles_with_group_dn():
elements = []
for role_id, role in load_roles().items():
- elements.append((role_id, LDAPDistinguishedName(
- title = role['alias'] + ' - ' + _("Specify the Group DN"),
- help = _("Distinguished Name of the LDAP group to add users this role. "
- "e. g. <tt>CN=cmk-users,OU=groups,DC=example,DC=com</tt><br> "
- "This group must be defined within the scope of the "
- "<a href=\"wato.py?mode=ldap_config&varname=ldap_groupspec\">LDAP Group Settings</a>."),
- size = 80,
- enforce_suffix = ldap_replace_macros(config.ldap_groupspec.get('dn', '')),
+ elements.append((role_id, Transform(
+ ListOf(
+ LDAPDistinguishedName(
+ size = 80,
+ enforce_suffix = ldap_replace_macros(config.ldap_groupspec.get('dn', '')),
+ allow_empty = False,
+ ),
+ title = role['alias'] + ' - ' + _("Specify the Group DN"),
+ help = _("Distinguished Names of the LDAP groups to add users this role. "
+ "e. g. <tt>CN=cmk-users,OU=groups,DC=example,DC=com</tt><br> "
+ "This group must be defined within the scope of the "
+ "<a href=\"wato.py?mode=ldap_config&varname=ldap_groupspec\">LDAP Group Settings</a>."),
+ movable = False,
+ ),
+ # Convert old single distinguished names to list of :Ns
+ forth = lambda v: type(v) != list and [v] or v,
)))
elements.append(
Module: check_mk
Branch: master
Commit: 849fe7b01334aa0b639a68e19134a72fbc9fe8d0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=849fe7b01334aa…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 26 09:36:57 2015 +0100
#2165 aix_agent: Local checks can now also be executed in run cached mode
Thanks to Matthias Haehnel for providing the patch.
---
.werks/2165 | 9 +++++++++
ChangeLog | 1 +
2 files changed, 10 insertions(+)
diff --git a/.werks/2165 b/.werks/2165
new file mode 100644
index 0000000..97a2b0c
--- /dev/null
+++ b/.werks/2165
@@ -0,0 +1,9 @@
+Title: aix_agent: Local checks can now also be executed in run cached mode
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1427358961
+Class: feature
+
+Thanks to Matthias Haehnel for providing the patch.
diff --git a/ChangeLog b/ChangeLog
index c86e6da..70f79e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -141,6 +141,7 @@
* 2155 siemens_plc_counter: added new check for monitoring increasing counter values
* 2106 aix_sap_processlist: new check and agent plugin to monitor the process list of SAP Application Server Instances on AIX systems
* 2156 Interface-Checks: Can now be configured to use predictive traffic levels
+ * 2165 aix_agent: Local checks can now also be executed in run cached mode...
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
Module: check_mk
Branch: master
Commit: 4c227c5dbb8055d58c074c519a76606dc6fce112
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4c227c5dbb8055…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 26 09:20:19 2015 +0100
#2163 FIX printer_supply: Now auto detects whether or not a supply is consumable or filling up
This change is intended mainly as fix for an exception which occured for filling up
supplies which report a maximum capacity of 0. Meaning when the level reaches zero
it is fully filled up.
---
.werks/2163 | 12 ++++++++++
ChangeLog | 1 +
checks/printer_supply | 34 +++++++++++++++++++---------
web/plugins/wato/check_parameters.py | 41 ++++++++++++++++++++++------------
4 files changed, 64 insertions(+), 24 deletions(-)
diff --git a/.werks/2163 b/.werks/2163
new file mode 100644
index 0000000..7d9248a
--- /dev/null
+++ b/.werks/2163
@@ -0,0 +1,12 @@
+Title: printer_supply: Now auto detects whether or not a supply is consumable or filling up
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1427357861
+
+This change is intended mainly as fix for an exception which occured for filling up
+supplies which report a maximum capacity of 0. Meaning when the level reaches zero
+it is fully filled up.
diff --git a/ChangeLog b/ChangeLog
index e29441f..50ecc9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -283,6 +283,7 @@
* 2159 FIX: netapp_api_disk.summary: Changed default thresholds to WARN on the first broken disk, CRIT on 50%...
* 2161 FIX: heartbeat_crm: Fixed UnboundLocalError exception on some systems
* 2162 FIX: citrix_sessions: Handle not set thresholds on single values correctly...
+ * 2163 FIX: printer_supply: Now auto detects whether or not a supply is consumable or filling up...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request, added mailto link for error report...
diff --git a/checks/printer_supply b/checks/printer_supply
index 80f46d4..9c5a7f6 100644
--- a/checks/printer_supply
+++ b/checks/printer_supply
@@ -61,16 +61,20 @@ def printer_supply_fix_infos(info):
new_info = []
for index, line in enumerate(info):
line_0 = snmp_decode_string(line[0]) # give chance for latin1->utf8 decoding
+
+ # For toners or drum units add the color (if available)
if line_0.startswith('Toner Cartridge') \
or line_0.startswith('Image Drum Unit'):
- if line[3]:
- colors += [ line[3] ]
- color = line[3]
- elif line[3] == '':
+ if line[4]:
+ colors += [ line[4] ]
+ color = line[4]
+ elif line[4] == '':
color = colors[index - len(colors)]
line_0 = '%s %s' % (color.title(), line_0)
+
if " S/N:" in line_0:
line_0 = line_0[:line_0.find(" S/N:")]
+
new_info.append([line_0] + line[1:])
return new_info
@@ -84,13 +88,23 @@ def inventory_printer_supply(info):
def check_printer_supply(item, params, info):
for line in printer_supply_fix_infos(info):
if line[0].rstrip('\0') == item:
- maxlevel = int(line[1])
- current = saveint(line[2])
+ maxlevel = int(line[1])
+ current = saveint(line[2])
+
+ # When unit type is
+ # 1 = other
+ # 3 = supplyThatIsConsumed
+ # 4 = supplyThatIsFilled
+ # the value is contains the current level if this supply is a container
+ # but when the remaining space if this supply is a receptacle
+ unit_type = int(line[3])
+
if len(params) == 2:
warn, crit = params # in percent
upturn = False
else:
warn, crit, upturn = params
+
perfdata = [ ("pages", current, warn / 100.0 * maxlevel, crit / 100.0 * maxlevel, 0, maxlevel ) ]
# handle cases with partial data
@@ -105,10 +119,11 @@ def check_printer_supply(item, params, info):
# no percentage possible. We compare directly against levels
return (0, "current level is %d" % current, [("pages", current)])
- if upturn:
+ if upturn or unit_type == 4: # it's filling up!
leftperc = 100 - current
else:
leftperc = 100.0 * current / maxlevel
+
infotext = "%.0f%% (levels at %.0f%% / %.0f%%)" % (leftperc, warn, crit)
if leftperc <= crit:
return (2, infotext, perfdata)
@@ -117,8 +132,6 @@ def check_printer_supply(item, params, info):
else:
return (0, infotext, perfdata)
- return (3, 'not found')
-
check_config_variables.append("printer_supply_some_remaining_status")
check_info["printer_supply"] = {
@@ -131,7 +144,8 @@ check_info["printer_supply"] = {
'11.1.1.6', # Printer-MIB::prtMarkerSuppliesDescription
'11.1.1.8', # Printer-MIB::prtMarkerSuppliesMaxCapacity
'11.1.1.9', # Printer-MIB::prtMarkerSuppliesLevel
- '12.1.1.4',
+ '11.1.1.4', # Printer-MIB::prtMarkerSuppliesClass
+ '12.1.1.4', # Printer-MIB::prtMarkerColorantValue
]
),
'snmp_scan_function': \
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 1c3afa8..dc88f7f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3371,20 +3371,33 @@ register_check_parameters(
_("Printer cartridge levels"),
Transform(
Tuple(
- help = _("Levels for printer cartridges."),
- elements = [
- Percentage(title = _("Warning remaining"), allow_int = True, default_value = 20.0),
- Percentage(title = _("Critical remaining"), allow_int = True, default_value = 10.0),
- Checkbox(
- title = _("Upturn toner levels"),
- label = _("Printer sends <i>used</i> material instead of <i>remaining</i>"),
- help = _("Some Printers (eg. Konica for Drum Cartdiges) returning the available"
- " fuel instead of what is left. In this case it's possible"
- " to upturn the levels to handle this behavior"
- )
- ),]
- ),
- forth = transform_printer_supply,
+ elements = [
+ Percentage(
+ title = _("Warning remaining"),
+ allow_int = True,
+ default_value = 20.0,
+ help = _("For consumable supplies, this is configured as the percentage of "
+ "remaining capacity. For supplies that fill up, this is configured "
+ "as remaining space."),
+ ),
+ Percentage(
+ title = _("Critical remaining"),
+ allow_int = True,
+ default_value = 10.0,
+ help = _("For consumable supplies, this is configured as the percentage of "
+ "remaining capacity. For supplies that fill up, this is configured "
+ "as remaining space."),
+ ),
+ Checkbox(
+ title = _("Upturn toner levels"),
+ label = _("Printer sends <i>used</i> material instead of <i>remaining</i>"),
+ help = _("Some Printers (eg. Konica for Drum Cartdiges) returning the available"
+ " fuel instead of what is left. In this case it's possible"
+ " to upturn the levels to handle this behavior")
+ ),
+ ]
+ ),
+ forth = transform_printer_supply,
),
TextAscii(
title = _("cartridge specification"),
Module: check_mk
Branch: master
Commit: 57c9a610ba11fa7f4a5d97404c4c8beafadeb68a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=57c9a610ba11fa…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 26 08:42:25 2015 +0100
#2162 FIX citrix_sessions: Handle not set thresholds on single values correctly
When a user sets citrix_sessions_default_levels to a value which misses one of
the needed thresholds, the check results in an exception. This is now more
robust.
However, the check should better use the factory defaults mechanism.
---
.werks/2162 | 14 ++++++++++++++
ChangeLog | 1 +
checks/citrix_sessions | 6 +++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/.werks/2162 b/.werks/2162
new file mode 100644
index 0000000..749d042
--- /dev/null
+++ b/.werks/2162
@@ -0,0 +1,14 @@
+Title: citrix_sessions: Handle not set thresholds on single values correctly
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1427355497
+
+When a user sets citrix_sessions_default_levels to a value which misses one of
+the needed thresholds, the check results in an exception. This is now more
+robust.
+
+However, the check should better use the factory defaults mechanism.
diff --git a/ChangeLog b/ChangeLog
index f35a259..e29441f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -282,6 +282,7 @@
* 1240 FIX: multipath: improved detection for not installed multipath
* 2159 FIX: netapp_api_disk.summary: Changed default thresholds to WARN on the first broken disk, CRIT on 50%...
* 2161 FIX: heartbeat_crm: Fixed UnboundLocalError exception on some systems
+ * 2162 FIX: citrix_sessions: Handle not set thresholds on single values correctly...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request, added mailto link for error report...
diff --git a/checks/citrix_sessions b/checks/citrix_sessions
index dc1abc9..2343b26 100644
--- a/checks/citrix_sessions
+++ b/checks/citrix_sessions
@@ -45,12 +45,12 @@ def check_citrix_sessions(_no_item, params, info):
messages = []
perf = []
for what in [ 'total', 'active', 'inactive' ]:
- warn, crit = params[what]
+ warn, crit = params.get(what, (None, None))
perf.append(( what, session[what], warn, crit ))
- if session[what] > crit:
+ if crit != None and session[what] > crit:
messages.append("%s: %s(!!)" % ( what, session[what] ))
state = 2
- elif session[what] > warn:
+ elif warn != None and session[what] > warn:
messages.append("%s: %s(!)" % ( what, session[what] ))
state = max(state, 1)
else: