Module: check_mk
Branch: master
Commit: a49a04c2a55301b47e5c2f5c29b2feee5b67de5f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a49a04c2a55301…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Mar 20 17:29:10 2014 +0100
enterasys_cpu_util enterasys_powersupply: New Checks for CPU Utilization and Power Supplies on enterasys switches
---
.werks/144 | 8 +++
ChangeLog | 1 +
checkman/enterasys_cpu_util | 20 ++++++++
checkman/enterasys_powersupply | 16 ++++++
checks/enterasys_cpu_util | 51 +++++++++++++++++++
checks/enterasys_powersupply | 67 +++++++++++++++++++++++++
pnp-templates/check_mk-enterasys_cpu_util.php | 1 +
7 files changed, 164 insertions(+)
diff --git a/.werks/144 b/.werks/144
new file mode 100644
index 0000000..29ff606
--- /dev/null
+++ b/.werks/144
@@ -0,0 +1,8 @@
+Title: enterasys_cpu_util enterasys_powersupply: New Checks for CPU Utilization and Power Supplies on enterasys switches
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1395332854
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index cf117b4..940f932 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -111,6 +111,7 @@
* 0141 ups_socomec_capacity: Battery Capacity Check for Socomec UPS Devices.
* 0705 arcserve_backup: improved documentation (check manpage and comments in the agent plugin)
* 0143 ups_socomec_in_voltage, ups_socomec_out_voltage: Socomec UPS Devices, Input and Output Voltages...
+ * 0144 enterasys_cpu_util enterasys_powersupply: New Checks for CPU Utilization and Power Supplies on enterasys switches
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/enterasys_cpu_util b/checkman/enterasys_cpu_util
new file mode 100644
index 0000000..184d140
--- /dev/null
+++ b/checkman/enterasys_cpu_util
@@ -0,0 +1,20 @@
+title: Enterasys Switch: CPU utilization
+agents: snmp
+catalog: hw/network/enterasys
+license: GPL
+distribution: check_mk
+description:
+ This check shows the current cpu utilization of a casa module
+
+
+inventory:
+ One check will be created
+
+perfdata:
+ The actual utilization, together with it's warn and crit levels
+
+[parameters]
+warning (int): The percentage of CPU usage that triggers
+ a WARNING state
+critical (int): The percentage of CPU usage that triggers
+ a CRITICAL state
diff --git a/checkman/enterasys_powersupply b/checkman/enterasys_powersupply
new file mode 100644
index 0000000..9fece26
--- /dev/null
+++ b/checkman/enterasys_powersupply
@@ -0,0 +1,16 @@
+title: Enterasys: Power Supplies
+agents: snmp
+catalog: hw/network/enterasys
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the health of power supplies. If the operating
+ state change or the supplie is not longer redundant then the check
+ returns {CRIT}.
+
+item:
+ The id of the power supply as output from the SNMP agent.
+
+inventory:
+ One check is created for each power supply.
+
diff --git a/checks/enterasys_cpu_util b/checks/enterasys_cpu_util
new file mode 100644
index 0000000..2f99fce
--- /dev/null
+++ b/checks/enterasys_cpu_util
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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.
+enerasys_cpu_default_levels = (90, 95)
+
+def inventory_enterasys_cpu_util(info):
+ return [ ( None, "enerasys_cpu_default_levels" )]
+
+def check_enterasys_cpu_util(_no_item, params, info):
+ util = 0
+ for core_util in info:
+ util += saveint(core_util[0]) / 60
+ num_cpus = len(info)
+ usage = util / num_cpus
+ return check_cpu_util(usage, params)
+
+
+check_info["enterasys_cpu_util"] = {
+ "check_function" : check_enterasys_cpu_util,
+ "inventory_function" : inventory_enterasys_cpu_util,
+ "service_description" : "CPU utilization",
+ "snmp_info" : ( ".1.3.6.1.4.1.5624.1.2.49.1.1.1.1", [ 3 ]), #util in last 1min
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.5624.2.1.169",
+ "has_perfdata" : True,
+ "group" : "cpu_utilization",
+ "includes" : [ "cpu_util.include" ],
+
+}
+
diff --git a/checks/enterasys_powersupply b/checks/enterasys_powersupply
new file mode 100644
index 0000000..81267fe
--- /dev/null
+++ b/checks/enterasys_powersupply
@@ -0,0 +1,67 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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.
+# 1.3.6.1.4.1.52.4.3.1.2.1.1.1 ctChasPowerSupplyNum
+# 1.3.6.1.4.1.52.4.3.1.2.1.1.2 ctChasPowerSupplyState
+# 1.3.6.1.4.1.52.4.3.1.2.1.1.3 ctChasPowerSupplyType
+# 1.3.6.1.4.1.52.4.3.1.2.1.1.4 ctChasPowerSupplyRedundancy
+
+def inventory_enterasys_powersupply(info):
+ inventory = []
+ for num, state, typ, redun in info:
+ if state == '3':
+ inventory.append(( num, None ))
+ return inventory
+
+def check_enterasys_powersupply(item, _no_params, info):
+ supply_types = {
+ '1' : 'ac-dc',
+ '2' : 'dc-dc',
+ '3' : 'notSupported',
+ '4' : 'highOutput',
+ }
+ redundancy_types = {
+ '1' : 'redundant',
+ '2' : 'notRedundant',
+ '3' : 'notSupported',
+ }
+
+ for num, state, typ, redun in info:
+ if num == item:
+ if state == '4':
+ return 2, 'PSU installed and not operating'
+ if redun != '1':
+ return 1, 'PSU %s' % redundancy_types[redyn]
+ return 0, 'PSU working and redundant (%s)' % supply_types[typ]
+
+
+check_info["enterasys_powersupply"] = {
+ "check_function" : check_enterasys_powersupply,
+ "inventory_function" : inventory_enterasys_powersupply,
+ "service_description" : "PSU %s",
+ "snmp_info" : ( ".1.3.6.1.4.1.52.4.3.1.2.1.1", [ OID_END, 2, 3, 4 ]),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.5624.2.1.169",
+}
+
diff --git a/pnp-templates/check_mk-enterasys_cpu_util.php b/pnp-templates/check_mk-enterasys_cpu_util.php
new file mode 120000
index 0000000..a7d9073
--- /dev/null
+++ b/pnp-templates/check_mk-enterasys_cpu_util.php
@@ -0,0 +1 @@
+check_mk-esx_vsphere_hostsystem.cpu_usage.php
\ No newline at end of file
Module: check_mk
Branch: master
Commit: cc73d1321b3c2cdf8df47a268ffef933db90b033
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cc73d1321b3c2c…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Thu Mar 20 12:22:22 2014 +0100
EMC VNX: special agent can alternatively authenticate via security files
If you leave user name and password empty, the special agent tries to
authenticate against the EMC VNX device by Security Files.
These need to be created manually before using. Therefor run as
instance user (if using OMD) or Nagios user (if not using OMD)
a command like
<tt>naviseccli -AddUserSecurity -scope 0 -password PASSWORD -user USER</tt>
This creates <tt>SecuredCLISecurityFile.xml</tt> and
<tt>SecuredCLIXMLEncrypted.key</tt> in the home directory of the user
and these files are used then.
---
.werks/706 | 16 ++++++++++++++++
ChangeLog | 1 +
agents/special/agent_emcvnx | 13 ++++++++++++-
checks/agent_emcvnx | 6 ++++--
web/plugins/wato/datasource_programs.py | 14 ++++++++++++--
5 files changed, 45 insertions(+), 5 deletions(-)
diff --git a/.werks/706 b/.werks/706
new file mode 100644
index 0000000..17969b3
--- /dev/null
+++ b/.werks/706
@@ -0,0 +1,16 @@
+Title: EMC VNX: special agent can alternatively authenticate via security files
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1395314250
+Class: feature
+
+If you leave user name and password empty, the special agent tries to
+authenticate against the EMC VNX device by Security Files.
+These need to be created manually before using. Therefor run as
+instance user (if using OMD) or Nagios user (if not using OMD)
+a command like
+<tt>naviseccli -AddUserSecurity -scope 0 -password PASSWORD -user USER</tt>
+This creates <tt>SecuredCLISecurityFile.xml</tt> and
+<tt>SecuredCLIXMLEncrypted.key</tt> in the home directory of the user
+and these files are used then.
diff --git a/ChangeLog b/ChangeLog
index 27b8ef6..e7cd1a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -115,6 +115,7 @@
* 0716 Add Linux caching agent also to normal agent RPM...
* 0594 dell_poweredge_netdev: new check to monitor the status of network devices on Dells Poweredge Servers
* 0733 mem, solaris_mem: now able to configure amount of free memory...
+ * 0706 EMC VNX: special agent can alternatively authenticate via security files...
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/agents/special/agent_emcvnx b/agents/special/agent_emcvnx
index 35e5e89..7394f23 100755
--- a/agents/special/agent_emcvnx
+++ b/agents/special/agent_emcvnx
@@ -58,6 +58,13 @@ OPTIONS:
-h, --help Show this help message and exit
-u USER, --user USER Username for EMC VNX login
-p PASSWORD, --password PASSWORD Password for EMC VNX login
+
+ If you do not give USER and PASSWORD:
+ We try to use naviseccli with security files.
+ These need to be created in advance by running as
+ the instance user:
+ naviseccli -AddUserSecurity -scope 0 -password PASSWORD -user USER
+
--debug Debug mode: write some debug messages,
let Python exceptions come through
@@ -156,7 +163,11 @@ except ValueError:
# fetch information by calling naviseccli
#############################################################################
-basecmd="naviseccli -h %s -User %s -Password '%s' -Scope 0 " % (host_address, user, password)
+if (user == None or user == '') and (password == None or password == ''):
+ # try using security files
+ basecmd="naviseccli -h %s -Scope 0 " % host_address
+else:
+ basecmd="naviseccli -h %s -User %s -Password '%s' -Scope 0 " % (host_address, user, password)
#
# check_mk section of agent output
diff --git a/checks/agent_emcvnx b/checks/agent_emcvnx
index 683afa3..7570b0c 100644
--- a/checks/agent_emcvnx
+++ b/checks/agent_emcvnx
@@ -26,8 +26,10 @@
def agent_emcvnx_arguments(params, hostname, ipaddress):
args = ''
- args += " -u " + quote_shell_string(params["user"])
- args += " -p " + quote_shell_string(params["password"])
+ if params["user"] != "":
+ args += " -u " + quote_shell_string(params["user"])
+ if params["password"] != "":
+ args += " -p " + quote_shell_string(params["password"])
args += " -i " + ",".join(params["infos"])
args += " " + quote_shell_string(ipaddress)
diff --git a/web/plugins/wato/datasource_programs.py b/web/plugins/wato/datasource_programs.py
index 97c55de..c4d51d0 100644
--- a/web/plugins/wato/datasource_programs.py
+++ b/web/plugins/wato/datasource_programs.py
@@ -186,13 +186,23 @@ register_rule(group,
( "user",
TextAscii(
title = _("EMC VNX admin user name"),
- allow_empty = False,
+ allow_empty = True,
+ help = _("If you leave user name and password empty, the special agent tries to "
+ "authenticate against the EMC VNX device by Security Files. "
+ "These need to be created manually before using. Therefor run as "
+ "instance user (if using OMD) or Nagios user (if not using OMD) "
+ "a command like "
+ "<tt>naviseccli -AddUserSecurity -scope 0 -password PASSWORD -user USER</tt> "
+ "This creates <tt>SecuredCLISecurityFile.xml</tt> and "
+ "<tt>SecuredCLIXMLEncrypted.key</tt> in the home directory of the user "
+ "and these files are used then."
+ ),
)
),
( "password",
Password(
title = _("EMC VNX admin user password"),
- allow_empty = False,
+ allow_empty = True,
)
),
( "infos",
Module: check_mk
Branch: master
Commit: 56643b35a79889dc37ea23139901316f626cf084
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=56643b35a79889…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 20 11:58:10 2014 +0100
fixed syntax error in declare_custom_view_permissions
---
web/htdocs/views.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 95d9f34..fd104d9 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -311,7 +311,7 @@ def declare_custom_view_permissions():
config.declare_permission("view." + name, view["title"],
view["description"], ['admin','user','guest'])
except:
- if opt_debug:
+ if config.debug:
raise
# Get the list of views which are available to the user