Module: check_mk
Branch: master
Commit: 6ae4068f4f072918e828c2fb9ec61dea7e41c5ff
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6ae4068f4f0729…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Thu Dec 11 17:01:39 2014 +0100
#1457 FIX logins: new check renamed from "users" check
The "users" check and "mk_users" plugin have been renamed to "logins" and
"mk_logins". If you have utilized the "users" check before, you now need
to remove the "mk_users" plugin and install the "mk_logins" plugin on your
monitoring clients. Afterwards, you need to execute a new service discovery.
---
.werks/1457 | 13 ++++++++
ChangeLog | 4 +++
agents/plugins/mk_logins | 29 +++++++++++++++++
checks/logins | 59 ++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 6 ++--
5 files changed, 108 insertions(+), 3 deletions(-)
diff --git a/.werks/1457 b/.werks/1457
new file mode 100644
index 0000000..2187236
--- /dev/null
+++ b/.werks/1457
@@ -0,0 +1,13 @@
+Title: logins: new check renamed from "users" check
+Level: 1
+Component: checks
+Class: fix
+Compatible: incomp
+State: unknown
+Version: 1.2.7i1
+Date: 1418313533
+
+The "users" check and "mk_users" plugin have been renamed to "logins" and
+"mk_logins". If you have utilized the "users" check before, you now need
+to remove the "mk_users" plugin and install the "mk_logins" plugin on your
+monitoring clients. Afterwards, you need to execute a new service discovery.
diff --git a/ChangeLog b/ChangeLog
index 35a6d51..12ba867 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
Core & Setup:
* 1759 Packed RPM and DEB agent packages are now shipped with normal Check_MK package...
+ Checks & Agents:
+ * 1457 FIX: logins: new check renamed from "users" check...
+ NOTE: Please refer to the migration notes!
+
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request, added mailto link for error report...
diff --git a/agents/plugins/mk_logins b/agents/plugins/mk_logins
new file mode 100755
index 0000000..2005529
--- /dev/null
+++ b/agents/plugins/mk_logins
@@ -0,0 +1,29 @@
+#!/bin/bash
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+if type who >/dev/null; then
+ echo "<<<logins>>>"
+ who | wc -l
+fi
diff --git a/checks/logins b/checks/logins
new file mode 100644
index 0000000..ac9636c
--- /dev/null
+++ b/checks/logins
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+
+# Example output from agent:
+# <<<logins>>>
+# 3
+
+logins_default_levels = (20,30)
+
+def inventory_logins(info):
+ if info:
+ return [ (None, "logins_default_levels") ]
+
+def check_logins(_no_item, params, info):
+ if info:
+ logins = int(info[0][0])
+ warn, crit = params
+ state = 0
+ if logins >= crit:
+ state = 2
+ elif logins >= warn:
+ state = 1
+
+ infotext = "%d logins on system, levels at %d/%d" % ( users, warn, crit )
+ perfdata = [ ( "logins", logins, warn, crit, 0 ) ]
+ yield state, infotext, perfdata
+
+
+check_info["logins"] = {
+ 'check_function' : check_logins,
+ 'inventory_function' : inventory_logins,
+ 'service_description' : 'Logins',
+ 'has_perfdata' : True,
+ 'group' : 'logins',
+}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 1ee4798..ce93a8d 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -4244,10 +4244,10 @@ register_check_parameters(
register_check_parameters(
subgroup_os,
- "users",
- _("Number of Users Logged In"),
+ "logins",
+ _("Number of Logins on System"),
Tuple(
- help = _("This rule defines upper limits for the number of users logged in on a system."),
+ help = _("This rule defines upper limits for the number of logins on a system."),
elements = [
Integer(title = _("Warning at"), unit = _("users"), default_value = 20),
Integer(title = _("Critical at"), unit = _("users"), default_value = 30)]),
Module: check_mk
Branch: master
Commit: 6a57f3d4896c4af2ec4d41001c6ec6a2ff96a638
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6a57f3d4896c4a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 11 16:44:27 2014 +0100
#1761 FIX Ruleset search is now consistent for host & serviceparameters and manual checks
---
.werks/1761 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 21 +++++++++++----------
3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/.werks/1761 b/.werks/1761
new file mode 100644
index 0000000..4acf4f7
--- /dev/null
+++ b/.werks/1761
@@ -0,0 +1,10 @@
+Title: Ruleset search is now consistent for host & serviceparameters and manual checks
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1418312629
+
+
diff --git a/ChangeLog b/ChangeLog
index cb915b2..35a6d51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
WATO:
* 1760 Added search form to manual checks page
+ * 1761 FIX: Ruleset search is now consistent for host & serviceparameters and manual checks
1.2.6b1:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 4f4010b..d5e977f 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -13669,6 +13669,8 @@ def mode_ruleeditor(phase):
else:
html.write("<h3>%s: %s</h3>" % (_("Host"), only_host))
+ search_form(_("Search for rules: "), "rulesets")
+
# Group names are separated with "/" into main group and optional subgroup.
# Do not loose carefully manually crafted order of groups!
groupnames = []
@@ -13693,9 +13695,6 @@ def mode_ruleeditor(phase):
menu.append((url, title, icon, "rulesets", help))
render_main_menu(menu)
- html.write("<br>")
- search_form(_("Search for rules: "), "rulesets")
-
def search_form(title, mode=None):
html.begin_form("search")
html.write(title+' ')
@@ -13867,7 +13866,7 @@ def mode_rulesets(phase, group=None):
help = _("Here you can create explicit checks that are not being created by the automatic service discovery.")
only_used = False
elif search != None:
- title = _("Rules matching ") + html.attrencode(search)
+ title = _("Rules matching") + ": " + html.attrencode(search)
help = _("All rules that contain '%s' in their name") % html.attrencode(search)
only_used = False
else:
@@ -13905,7 +13904,7 @@ def mode_rulesets(phase, group=None):
render_folder_path(keepvarnames = ["mode", "local", "group"])
if search != None or group == 'static':
- search_form(_("Search for rules: "), "rulesets")
+ search_form(_("Search for rules: "), group != "static" and "rulesets")
if help != None:
help = "".join(help.split("\n", 1)[1:]).strip()
@@ -13926,7 +13925,7 @@ def mode_rulesets(phase, group=None):
# Select matching rule groups while keeping their configured order
groupnames = [ gn for gn, rulesets in g_rulespec_groups
- if only_used or search or gn == group or gn.startswith(group + "/") ]
+ if only_used or search != None or gn == group or (group and gn.startswith(group + "/")) ]
# In case of search we need to sort the groups since main chapters would
# appear more than once otherwise.
@@ -13961,9 +13960,11 @@ def mode_rulesets(phase, group=None):
and search not in varname:
continue
- if search != None and groupname.startswith("static/"):
- continue # search must not find these
-
+ # Show static checks rules only in on dedicated page and vice versa
+ if group != 'static' and groupname.startswith("static/"):
+ continue
+ elif group == 'static' and not groupname.startswith("static/"):
+ continue
# Handle case where a host is specified
rulespec = g_rulespecs[varname]
@@ -13980,7 +13981,7 @@ def mode_rulesets(phase, group=None):
if only_local and num_local_rules == 0:
continue
- if only_used or search != None:
+ if group != 'static' and (only_used or search != None):
titlename = g_rulegroups[groupname.split("/")[0]][0]
else:
if '/' in groupname: