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)]),