Module: check_mk
Branch: master
Commit: 46785bf8654b1500e446b0e47f9a9badb08af56c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=46785bf8654b15…
Author: Sven Rueß <sr(a)mathias-kettner.de>
Date: Mon Apr 24 14:40:45 2017 +0200
8287 brocade_mlx_power: Added new standard OID for snChasPwrSupply2Table to receive all power supplies in stacked devices
Added new OID for snChasPwrSupply2Table to receive the information about all available power supplies
and fixed the item name for all power supplies. Now we take only the index as item name. This makes
rule creation equal to all temperature checks.
To get all power supplies automatically detected and renamed, you have to make a new service discovery.
With this servicce discovery it can happen that power supplies will be renamed. Now historic data and
rules exists for this check. So nothing special have to be done.
Change-Id: Ie6bfc213938cac30f6ce9de5ed967b7788abc1e3
---
.werks/8287 | 17 ++++++++++++
checks/brocade_mlx_power | 72 ++++++++++++++++++++++++++++++++----------------
2 files changed, 65 insertions(+), 24 deletions(-)
diff --git a/.werks/8287 b/.werks/8287
new file mode 100644
index 0000000..ab8664d
--- /dev/null
+++ b/.werks/8287
@@ -0,0 +1,17 @@
+Title: brocade_mlx_power: Added new standard OID for snChasPwrSupply2Table to receive all power supplies in stacked devices
+Level: 1
+Component: checks
+Compatible: incomp
+Edition: cee
+Version: 1.5.0i1
+Date: 1493037069
+Class: feature
+
+Added new OID for snChasPwrSupply2Table to receive the information about all available power supplies
+and fixed the item name for all power supplies. Now we take only the index as item name. This makes
+rule creation equal to all temperature checks.
+
+To get all power supplies automatically detected and renamed, you have to make a new service discovery.
+With this servicce discovery it can happen that power supplies will be renamed. Now historic data and
+rules exists for this check. So nothing special have to be done.
+
diff --git a/checks/brocade_mlx_power b/checks/brocade_mlx_power
index 2ee1825..f9a7d7d 100644
--- a/checks/brocade_mlx_power
+++ b/checks/brocade_mlx_power
@@ -24,40 +24,64 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-def brocade_mlx_power_combine_item(id, descr):
- if descr == "" or "AC " in descr:
- return id
+def parse_brocade_mlx_power(info):
+ parsed = {}
+
+ if len(info[1]) > 0:
+ # .1.3.6.1.4.1.1991.1.1.1.2.2.1
+ for power_unit, power_id, power_desc, power_state in info[1]:
+ if power_state != "1":
+ parsed[power_unit] = { 'desc' : power_desc,
+ 'state' : power_state }
else:
- return "%s %s" % (id, descr)
+ # .1.3.6.1.4.1.1991.1.1.1.2.1.1
+ for power_id, power_desc, power_state in info[0]:
+ if power_state != "1":
+ parsed[power_id] = { 'desc' : power_desc,
+ 'state' : power_state }
+ return parsed
+
-def inventory_brocade_mlx_power(info):
+def inventory_brocade_mlx_power(parsed):
inventory = []
- for power_id, power_descr, power_state in info:
- if power_state != "1":
- inventory.append( (brocade_mlx_power_combine_item(power_id, power_descr), None) )
+
+ for powersupply_id in parsed.keys():
+ inventory.append((powersupply_id, None))
return inventory
-def check_brocade_mlx_power(item, _no_params, info):
- for power_id, power_descr, power_state in info:
- if brocade_mlx_power_combine_item(power_id, power_descr) == item:
- if power_state == "2":
- return 0, "Power supply reports state: normal"
- elif power_state == "3":
- return 2, "Power supply reports state: failure"
- elif power_state == "1":
- return 3, "Power supply reports state: other"
+
+def check_brocade_mlx_power(item, _no_params, parsed):
+ if item not in parsed.keys():
+ yield 3, "Power supply not found"
+
+ for powersupply_id in parsed.keys():
+ if powersupply_id == item:
+ if parsed[powersupply_id]['state'] == "2":
+ yield 0, "Power supply reports state: normal"
+ elif parsed[powersupply_id]['state'] == "3":
+ yield 2, "Power supply reports state: failure"
+ elif parsed[powersupply_id]['state'] == "1":
+ yield 3, "Power supply reports state: other"
else:
- return 3, "Power supply reports an unhandled state (%s)" % power_state
- return 3, "Power supply not found"
+ yield 3, "Power supply reports an unhandled state (%s)" % parsed[powersupply_id]['state']
+
check_info["brocade_mlx_power"] = {
+ "parse_function" : parse_brocade_mlx_power,
"check_function" : check_brocade_mlx_power,
"inventory_function" : inventory_brocade_mlx_power,
"service_description" : "Power supply %s",
- "snmp_info" : ('.1.3.6.1.4.1.1991.1.1.1.2.1.1', [
- 1, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupplyIndex
- 2, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupplyDescription
- 3, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupplyOperStatus
- ]),
+ "snmp_info" : [ ('.1.3.6.1.4.1.1991.1.1.1.2.1.1', [
+ 1, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupplyIndex
+ 2, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupplyDescription
+ 3, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupplyOperStatus
+ ]),
+ ('.1.3.6.1.4.1.1991.1.1.1.2.2.1', [
+ 1, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupply2Unit
+ 2, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupply2Index
+ 3, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupply2Description
+ 4, # FOUNDRY-SN-AGENT-MIB::snChasPwrSupply2OperStatus
+ ])
+ ],
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.1991.1."),
}
Module: check_mk
Branch: master
Commit: eaf63f57c60d76d84198e07ac4a1c5eeed8e1e40
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eaf63f57c60d76…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Apr 24 11:17:20 2017 +0200
Updated some werks
Change-Id: I7dcd9574767e05c761606ff0673e74418b1605f9
---
.werks/2929 | 2 +-
.werks/4484 | 2 +-
.werks/8643 | 30 ++++++++++++++++--------------
3 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/.werks/2929 b/.werks/2929
index f1bbdc3..f7df3ee 100644
--- a/.werks/2929
+++ b/.werks/2929
@@ -1,5 +1,5 @@
Title: Show all metrics of a service in a nicely formatted table in the service details
-Level: 1
+Level: 2
Component: metrics
Compatible: compat
Version: 1.2.7i4
diff --git a/.werks/4484 b/.werks/4484
index a41ddbf..e54c2e4 100644
--- a/.werks/4484
+++ b/.werks/4484
@@ -1,4 +1,4 @@
-Title: Graph iime range previews can be disabled, default can be set
+Title: Graph time range previews can be disabled, default can be set
Level: 1
Component: metrics
Class: feature
diff --git a/.werks/8643 b/.werks/8643
index cae4f5d..fbcde05 100644
--- a/.werks/8643
+++ b/.werks/8643
@@ -1,5 +1,5 @@
Title: Web API: New API for fetching graph data
-Level: 1
+Level: 2
Edition: cee
Component: metrics
Compatible: compat
@@ -12,32 +12,34 @@ action is named <tt>get_graph</tt>.
The request object is structured like this:
-C+:
+F+:
{
"specification": [..., ...],
"data_range": {
"time_range" : [..., ...],
}
}
-C-:
+F-:
-The specification is using the Check_MK internal graph specification format. The
-first element is the specification type (<tt>template</tt>, <tt>custom</tt> or <tt>explicit</tt>.
-The structure of the second element depends on the type. Please take a look at the
-examples below to get an idea of it.
+The specification is using the Check_MK internal graph specification
+format. The first element is the specification type (<tt>template</tt>,
+<tt>custom</tt> or <tt>explicit</tt>. The structure of the second element
+depends on the type. Please take a look at the examples below to get an idea
+of it.
-The time range is given in two unix timestamps, the start time and the end time.
+The time range is given in two unix timestamps, the start time and the
+end time.
-For example this command can be used to fetch the first graph of the Check_MK service of
-the host myhost123:
+For example this command can be used to fetch the first graph of the Check_MK
+service of the host myhost123:
C+:
-# curl "http://mycmkserver/mysite/check_mk/webapi.py?action=get_graph&_username=aut…" -d 'request={"specification": ["template", {"service_description": "Check_MK", "site": "mysite", "graph_index": 0, "host_name": "myhost123" }], "data_range": {"time_range": [1480653120, 1480667520]}}'
+UP:curl "http://mycmkserver/mysite/check_mk/webapi.py?action=get_graph&_username=aut…" -d 'request={"specification": ["template", {"service_description": "Check_MK", "site": "mysite", "graph_index": 0, "host_name": "myhost123" }], "data_range": {"time_range": [1480653120, 1480667520]}}'
C-:
The answer may look like this:
-C+:
+F+:
{
"result": {
"step": 60,
@@ -54,10 +56,10 @@ C+:
},
"result_code": 0
}
-C-:
+F-:
This command is used to fetch the data of a custom graph named <tt>custom_graph_1</tt>:
C+:
-# curl "http://mycmkserver/mysite/check_mk/webapi.py?action=get_graph&_username=aut…" -d 'request={"specification": ["custom", "custom_graph_1"], "data_range": {"time_range": [1480653120, 1480667520]}}'
+UP:curl "http://mycmkserver/mysite/check_mk/webapi.py?action=get_graph&_username=aut…" -d 'request={"specification": ["custom", "custom_graph_1"], "data_range": {"time_range": [1480653120, 1480667520]}}'
C-:
Module: check_mk
Branch: master
Commit: 59fece037bc7f8dfdafc4a11df2f1d8e24e36ab1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=59fece037bc7f8…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Feb 23 13:31:26 2017 +0100
4487 check_mk_agent.aix, check_mk_agent.linux, check_mk_agent.solaris: Agents use either default MK_[LIB/CONF/VAR]DIR variables or environmental variables if configured
Change-Id: I12ece11a3f2fc532a9439031addfbf2171c3971a
---
.werks/4487 | 25 +++++++++++++++++++++++++
agents/check_mk_agent.aix | 6 +++---
agents/check_mk_agent.linux | 6 +++---
agents/check_mk_agent.solaris | 6 +++---
4 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/.werks/4487 b/.werks/4487
new file mode 100644
index 0000000..d8dd4d0
--- /dev/null
+++ b/.werks/4487
@@ -0,0 +1,25 @@
+Title: check_mk_agent.aix, check_mk_agent.linux, check_mk_agent.solaris: Agents use either default MK_[LIB/CONF/VAR]DIR variables or environmental variables if configured
+Level: 1
+Component: checks
+Class: feature
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1488966063
+
+
+On AIX the default variables are
+MK_LIBDIR /usr/check_mk/lib
+MK_CONFDIR /usr/check_mk/conf
+MK_VARDIR /tmp/check_mk
+
+On Linux the default variables are
+MK_LIBDIR /usr/lib/check_mk_agent
+MK_CONFDIR /etc/check_mk
+MK_VARDIR /var/lib/check_mk_agent
+
+On Solaris the default variables are
+MK_LIBDIR /usr/lib/check_mk_agent"
+MK_CONFDIR /etc/check_mk"
+MK_VARDIR /var/lib/check_mk_agent"
diff --git a/agents/check_mk_agent.aix b/agents/check_mk_agent.aix
index f258768..7df2f73 100755
--- a/agents/check_mk_agent.aix
+++ b/agents/check_mk_agent.aix
@@ -34,9 +34,9 @@ fi
export LC_ALL=C
unset LANG
-export MK_LIBDIR="/usr/check_mk/lib"
-export MK_CONFDIR="/usr/check_mk/conf"
-export MK_VARDIR="/tmp/check_mk"
+export MK_LIBDIR=${MK_LIBDIR-/usr/check_mk/lib}
+export MK_CONFDIR=${MK_CONFDIR-/usr/check_mk/conf}
+export MK_VARDIR=${MK_VARDIR-/tmp/check_mk}
# All executables in PLUGINSDIR will simply be executed and their
# ouput appended to the output of the agent. Plugins define their own
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 5abe471..5b2a580 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -28,9 +28,9 @@
export LC_ALL=C
unset LANG
-export MK_LIBDIR="/usr/lib/check_mk_agent"
-export MK_CONFDIR="/etc/check_mk"
-export MK_VARDIR="/var/lib/check_mk_agent"
+export MK_LIBDIR=${MK_LIBDIR:-/usr/lib/check_mk_agent}
+export MK_CONFDIR=${MK_CONFDIR:-/etc/check_mk}
+export MK_VARDIR=${MK_VARDIR:-/var/lib/check_mk_agent}
# Provide information about the remote host. That helps when data
# is being sent only once to each remote host.
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 20e46a1..dc4ec58 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -28,9 +28,9 @@
export LC_ALL=C
unset LANG
-export MK_LIBDIR="/usr/lib/check_mk_agent"
-export MK_CONFDIR="/etc/check_mk"
-export MK_VARDIR="/var/lib/check_mk_agent"
+export MK_LIBDIR=${MK_LIBDIR:-/usr/lib/check_mk_agent}
+export MK_CONFDIR=${MK_CONFDIR:-/etc/check_mk}
+export MK_VARDIR=${MK_VARDIR:-/var/lib/check_mk_agent}
# All executables in PLUGINSDIR will simply be executed and their
# ouput appended to the output of the agent. Plugins define their own