check is no longer wanted by customer, everything he needs (
detecting
failed/removed disks) is now included in the disks plugin
Message-ID: <52ce9866.X7avPcSlGF6r+SfJ%bs(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 185f52be20767a7770640fb74d183eb440dc2715
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=185f52be20767a…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Thu Aug 1 14:55:41 2013 +0200
removed emc_storage.raidgroup_status, check is no longer wanted by customer, everything he needs (detecting failed/removed disks) is now included in the disks plugin
---
checkman/emc_storage.disks | 5 +++--
checkman/emc_storage.raidgroup_status | 28 ----------------------------
checkman/emcvnx_hwstatus | 2 +-
checks/emcvnx_hwstatus | 2 +-
4 files changed, 5 insertions(+), 32 deletions(-)
diff --git a/checkman/emc_storage.disks b/checkman/emc_storage.disks
index 8e3041d..68704c3 100644
--- a/checkman/emc_storage.disks
+++ b/checkman/emc_storage.disks
@@ -6,11 +6,12 @@ distribution: check_mk
description:
Reports the status and the I/O rate of a disk in an EMC storage system.
- Returns {OK} if the number of Hard Read Errors is 0 and the number
+ Returns {OK} if the state of a disk is "Unbound" or "Hot Spare Ready" or "Enabled",
+ the number of Hard Read Errors is 0 and the number
of Hard Write Errors is 0. {CRIT} is returned otherwise.
Hint for implementation: Look for "Hard Read Errors:" and "Hard Write Errors:"
- lines in section "Bus x Enclosure y Disk z" lines found under
+ and "State:" lines in section "Bus x Enclosure y Disk z" lines found under
"All Disks Information"
I/O rates (in Bytes/sec) are just informational and do not trigger any state
diff --git a/checkman/emc_storage.raidgroup_status b/checkman/emc_storage.raidgroup_status
deleted file mode 100644
index a4595a1..0000000
--- a/checkman/emc_storage.raidgroup_status
+++ /dev/null
@@ -1,28 +0,0 @@
-title: EMC Storage: Status of RAID groups
-agents: emc
-catalog: hw/storage
-license: GPL
-distribution: check_mk
-description:
- Reports the status of RAID groups in EMC storage systems.
-
- Returns {OK} if ... and {CRIT} on ...
- (to be defined)
-
- Hint for implementation: Look for "RaidGroup State:" line and following
- in section "RaidGroup ID: <my ID>" under "All RAID Groups Information"
- Which states are good states and which are bad states is to be defined
-
-item:
- The RAID group ID as returned by the special agent.
- E. g. "4"
-
- Hint for implementation: Look for "RaidGroup ID:" line in section
- "All RAID Groups Information"
-
-perfdata:
- None
-
-inventory:
- Automatically configures one check for every RAID group listed
- in the agent output.
diff --git a/checkman/emcvnx_hwstatus b/checkman/emcvnx_hwstatus
index 8cd77e7..4f71531 100644
--- a/checkman/emcvnx_hwstatus
+++ b/checkman/emcvnx_hwstatus
@@ -4,7 +4,7 @@ catalog: hw/storage
license: GPL
distribution: check_mk
description:
- Reports the status of Power Supplies, SPS, SPS Cabeling, LCC, CPU Modules,
+ Reports the status of Power Supplies, SPS, SPS Cabeling, LCC, SP, CPU Modules,
SP I/O Modules and DIMM Modules on EMC storage systems.
Returns {OK} if the agent reports "Present" or "Valid" status and {CRIT}
diff --git a/checks/emcvnx_hwstatus b/checks/emcvnx_hwstatus
index 0234e2f..7a14337 100644
--- a/checks/emcvnx_hwstatus
+++ b/checks/emcvnx_hwstatus
@@ -86,7 +86,7 @@ def parse_emcvnx_hwstatus(info):
encid = line[2] + "/" + line[4]
enc = {}
parsed[encid] = enc
- elif line[-2] == "State:":
+ elif len(line) > 2 and line[-2] == "State:":
if line[0] == "SP":
device = line[0] + " " + line[1]
else:
Module: check_mk
Branch: master
Commit: 6f6dddeac2219373527663b2986bfd47b0f48508
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6f6dddeac22193…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Fri Aug 2 10:30:30 2013 +0200
emc_storage.sp_status not needed any longer, integrated in emcvnx_hwstatus now
---
checkman/emc_storage.sp_status | 26 --------------------------
1 file changed, 26 deletions(-)
diff --git a/checkman/emc_storage.sp_status b/checkman/emc_storage.sp_status
deleted file mode 100644
index eeee52b..0000000
--- a/checkman/emc_storage.sp_status
+++ /dev/null
@@ -1,26 +0,0 @@
-title: EMC Storage: Status of StorageProcessors (sp)
-agents: emc
-catalog: hw/storage
-license: GPL
-distribution: check_mk
-description:
- Reports the status of StorageProcessors (sp) on EMC storage systems.
-
- Returns {OK} if the agent reports "Present" status and {CRIT} on every other
- status.
-
- Hint for implementation: Look for "SP * State:" line in section
- "Array Information", Present -> OK, everything else -> CRIT
-
-item:
- The name of the storage processor as returned by the special agent.
- E. g. "A"
-
- Hint for implementation: see at description
-
-perfdata:
- None
-
-inventory:
- Automatically configures one check for every storage processor listed
- in the agent output.
Module: check_mk
Branch: master
Commit: 530eee4d9d55d56067de49bb021e6e0006462352
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=530eee4d9d55d5…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Fri Aug 2 12:10:30 2013 +0200
new check emcvnx_hba added (including manpage and pnp-template)
---
checkman/{emc_storage.hba => emcvnx_hba} | 8 --
checks/emcvnx_hba | 133 ++++++++++++++++++++++++++++++
pnp-templates/check_mk-emcvnx_disks.php | 1 +
pnp-templates/check_mk-emcvnx_hba.php | 60 ++++++++++++++
4 files changed, 194 insertions(+), 8 deletions(-)
diff --git a/checkman/emc_storage.hba b/checkman/emcvnx_hba
similarity index 58%
rename from checkman/emc_storage.hba
rename to checkman/emcvnx_hba
index 58bd975..c90339b 100644
--- a/checkman/emc_storage.hba
+++ b/checkman/emcvnx_hba
@@ -9,18 +9,10 @@ description:
The values for Blocks Read/sec and Blocks Written/sec are just informational.
The check always returns {OK}
- Hint for implementation: Look for "Blocks Read:" and "Blocks Written:"
- lines in section "SP Name: <my Name>" and "SP Port ID: <my ID>" lines found under
- "Information about each SPPORT:". Remember values of last check and devide by the
- time since last check.
-
item:
Consists of the SP Name and the SP Port ID as returned by the agent.
E. g. "SP A Port 0"
- Hint for implementation: Look for "SP Name:" and "SP Port ID:" lines in section
- "Information about each SPPORT:"
-
perfdata:
Two values: Blocks Read/sec and Blocks Written/sec
diff --git a/checks/emcvnx_hba b/checks/emcvnx_hba
new file mode 100644
index 0000000..a0df51c
--- /dev/null
+++ b/checks/emcvnx_hba
@@ -0,0 +1,133 @@
+#!/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.
+
+# Example output from agent:
+#<<<emcvnx_hba>>>
+#Information about each SPPORT:
+#
+#SP Name: SP A
+#SP Port ID: 0
+#SP UID: 50:06:01:60:BE:A0:5D:E5:50:06:01:60:3E:A0:5D:E5
+#Link Status: Up
+#Port Status: Online
+#Switch Present: YES
+#Switch UID: 10:00:00:27:F8:28:52:5B:20:02:00:27:F8:28:52:5B
+#SP Source ID: 66048
+#ALPA Value: 0
+#Speed Value : 8Gbps
+#Auto Negotiable : NO
+#Available Speeds:
+#2Gbps
+#4Gbps
+#8Gbps
+#Auto
+#Requested Value: Auto
+#MAC Address: Not Applicable
+#SFP State: Online
+#Reads: 426729
+#Writes: 8683578
+#Blocks Read: 4917783
+#Blocks Written: 12008476
+#Queue Full/Busy: 0
+#I/O Module Slot: Onboard
+#Physical Port ID: 2
+#Usage: Mirrorview
+#SFP/Connector EMC Part Number: 019-078-042
+#SFP/Connector EMC Serial Number: 00000000000
+#SFP/Connector Vendor Part Number: AFBR-57D7APZ-E2
+#SFP/Connector Vendor Serial Number: AGL1213A3188822
+#SFP/Connector Supported Speeds:
+#2Gbps
+#4Gbps
+#8Gbps
+#
+#SP Name: SP A
+#SP Port ID: 1
+#SP UID: 50:06:01:60:BE:A0:5D:E5:50:06:01:61:3E:A0:5D:E5
+#Link Status: Up
+#Port Status: Online
+#Switch Present: YES
+#[...]
+
+# Parse agent output into a dict of the form:
+# parsed = {
+# {'SP A Port 0': {'Blocks Read': 4917783, 'Blocks Written': 12008476},
+# 'SP A Port 1': {'Blocks Read': 363283639, 'Blocks Written': 218463965},
+# 'SP A Port 2': {'Blocks Read': 2, 'Blocks Written': 0},
+# 'SP B Port 0': {'Blocks Read': 0, 'Blocks Written': 4348086},
+# }
+
+def parse_emcvnx_hba(info):
+ parsed = {}
+ for line in info:
+ if len(line) > 2 and line[0] == "SP" and line[1] == "Name:":
+ hba_id = " ".join(line[2:])
+ elif len(line) > 2 and line[0] == "SP" and line[1] == "Port" and line[2] == "ID:":
+ hba_id += " Port " + line[-1]
+ hba = {}
+ parsed[hba_id] = hba
+ elif len(line) > 2 and line[0] == "Blocks" and line[1] in ("Read:", "Written:"):
+ hba["Blocks " + line[1].replace(":", "")] = saveint(line[-1])
+ return parsed
+
+
+def inventory_emcvnx_hba(info):
+ parsed = parse_emcvnx_hba(info)
+ import pprint; pprint.pprint(parsed)
+ inventory = []
+ for hba in parsed:
+ inventory.append( (hba, None) )
+ return inventory
+
+
+def check_emcvnx_hba(item, _no_params, info):
+ now = time.time()
+ perfdata = []
+ try:
+ read_blocks = parse_emcvnx_hba(info)[item]["Blocks Read"]
+ write_blocks = parse_emcvnx_hba(info)[item]["Blocks Written"]
+ countername_r = "emcvnx_hba.read_blocks.%s" % item.replace(" ", "_")
+ countername_w = "emcvnx_hba.write_blocks.%s" % item.replace(" ", "_")
+ timedif, read_blocks_per_sec = get_counter(countername_r, now, read_blocks)
+ timedif, write_blocks_per_sec = get_counter(countername_w, now, write_blocks)
+ read_blocks_per_sec = saveint(read_blocks_per_sec)
+ write_blocks_per_sec = saveint(write_blocks_per_sec)
+ perfdata.append(("read_blocks", read_blocks_per_sec))
+ perfdata.append(("write_blocks", write_blocks_per_sec))
+ #print "read blocks: %s, %s/sec" % (read_blocks, read_blocks_per_sec)
+ #print "write blocks: %s, %s/sec" % (write_blocks, write_blocks_per_sec)
+
+ return 0, "Read: %s Blocks/s, Write: %s Blocks/s" % (read_blocks_per_sec, write_blocks_per_sec), perfdata
+
+ except KeyError:
+ return 3, "HBA %s not found in agent output" % item
+
+
+check_info['emcvnx_hba'] = {
+ "inventory_function" : inventory_emcvnx_hba,
+ "check_function" : check_emcvnx_hba,
+ "service_description" : "HBA %s",
+ 'has_perfdata' : True,
+}
diff --git a/pnp-templates/check_mk-emcvnx_disks.php b/pnp-templates/check_mk-emcvnx_disks.php
new file mode 120000
index 0000000..8b45325
--- /dev/null
+++ b/pnp-templates/check_mk-emcvnx_disks.php
@@ -0,0 +1 @@
+check_mk-diskstat.php
\ No newline at end of file
diff --git a/pnp-templates/check_mk-emcvnx_hba.php b/pnp-templates/check_mk-emcvnx_hba.php
new file mode 100644
index 0000000..9823030
--- /dev/null
+++ b/pnp-templates/check_mk-emcvnx_hba.php
@@ -0,0 +1,60 @@
+<?php
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+// Make data sources available via names
+$RRD = array();
+foreach ($NAME as $i => $n) {
+ $RRD[$n] = "$RRDFILE[$i]:$DS[$i]:MAX";
+ $WARN[$n] = $WARN[$i];
+ $CRIT[$n] = $CRIT[$i];
+ $MIN[$n] = $MIN[$i];
+ $MAX[$n] = $MAX[$i];
+}
+
+$servicedesc = str_replace("_", " ", $servicedesc);
+
+$opt[1] = "--vertical-label 'I/O (Blocks/s)' -X0 --title \"iSCSI traffic $hostname / $servicedesc\" ";
+
+$def[1] =
+ "HRULE:0#a0a0a0 ".
+# read
+ "DEF:read_blocks=$RRD[read_blocks] ".
+ "AREA:read_blocks#40c080:\"Read \" ".
+ "GPRINT:read_blocks:LAST:\"%8.1lf Blocks/s last\" ".
+ "GPRINT:read_blocks:AVERAGE:\"%6.1lf Blocks/s avg\" ".
+ "GPRINT:read_blocks:MAX:\"%6.1lf Blocks/s max\\n\" ";
+
+# write
+$def[1] .=
+ "DEF:write_blocks=$RRD[write_blocks] ".
+ "CDEF:write_blocks_neg=write_blocks,-1,* ".
+ "AREA:write_blocks_neg#4080c0:\"Write \" ".
+ "GPRINT:write_blocks:LAST:\"%6.1lf Blocks/s last\" ".
+ "GPRINT:write_blocks:AVERAGE:\"%6.1lf Blocks/s avg\" ".
+ "GPRINT:write_blocks:MAX:\"%6.1lf Blocks/s max\\n\" ".
+ "";
+
+?>
+
Module: check_mk
Branch: master
Commit: d91c852cdcbf0b91e19ec6b1daeeb162142a3dc2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d91c852cdcbf0b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 9 12:35:04 2014 +0100
FIX cups_queues: fix exception in case of alternative time format
In some cases the time format output by CUPS was not correctly
parsed by the check. An example is <tt>Thu 29 Aug 2013 06:25:55 AM CEST</tt>.
This has now been fixed.
---
.werks/404 | 12 ++++++++++++
ChangeLog | 1 +
checks/cups_queues | 20 +++++++++++++-------
3 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/.werks/404 b/.werks/404
new file mode 100644
index 0000000..6691b60
--- /dev/null
+++ b/.werks/404
@@ -0,0 +1,12 @@
+Title: cups_queues: fix exception in case of alternative time format
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1389267220
+Targetversion: future
+
+In some cases the time format output by CUPS was not correctly
+parsed by the check. An example is <tt>Thu 29 Aug 2013 06:25:55 AM CEST</tt>.
+This has now been fixed.
diff --git a/ChangeLog b/ChangeLog
index 210825a..8b8df37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -86,6 +86,7 @@
* 0322 FIX: timemachine: Check now also works if there are spaces in the name of the backup volume or the hostname
* 0253 FIX: windows agent: fixed crash on processing eventlog records...
* 0403 FIX: mem.used: Prefer statgrab on FreeBSD for supporting more than 4GB...
+ * 0404 FIX: cups_queues: fix exception in case of alternative time format...
Multisite:
* 0371 Added log class filter to hostsvcevents view
diff --git a/checks/cups_queues b/checks/cups_queues
index fa1a092..80c493e 100644
--- a/checks/cups_queues
+++ b/checks/cups_queues
@@ -45,8 +45,6 @@
#lpr2-2 root 1024 Tue Jun 29 09:02:35 2010
#lpr2-3 root 1024 Tue Jun 29 09:05:54 2010
-import time, datetime
-
# Default thresholds
# ("<Warning max entries>", "<Critical num entries>", "<Warning entry age in seconds>", "<Critical entry age>")
cups_queues_default_levels = (5, 10, 360, 720)
@@ -59,7 +57,7 @@ def check_cups_queues(item, params, info):
state = 3
output = "Queue not found"
numJobs = 0
- now = datetime.datetime.now()
+ now = time.time()
oldest = now
for num, line in enumerate(info):
if line[0] == 'printer' and line[1] == item:
@@ -82,17 +80,25 @@ def check_cups_queues(item, params, info):
elif line[0].startswith(item+'-'):
# This is a queue item count the number of items and check the max age
numJobs += 1
- dt = datetime.datetime(*time.strptime(' '.join(line[3:]), '%a %b %d %H:%M:%S %Y')[:6])
+ # Try to parse different time formats
+ timestring = ' '.join(line[3:])
+ try:
+ # Tue Jun 29 09:05:54 2010
+ parsed = time.strptime(timestring, '%a %b %d %H:%M:%S %Y')
+ except:
+ # Thu 29 Aug 2013 12:41:42 AM CEST
+ parsed = time.strptime(timestring, '%a %d %b %Y %H:%M:%S %p %Z')
+ dt = time.mktime(parsed)
if dt < oldest:
oldest = dt
jobOutput = 'Jobs: %d' % numJobs
if numJobs > 0:
- if oldest < now - datetime.timedelta(seconds=critAge) or numJobs > critNum:
+ if oldest < now - critAge or numJobs > critNum:
state = 2
- elif oldest < now - datetime.timedelta(seconds=warnAge) or numJobs > warnNum:
+ elif oldest < now - warnAge or numJobs > warnNum:
state = 1
- jobOutput += ', Oldest job is from %s' % oldest
+ jobOutput += ', Oldest job is from %s' % time.strftime("%c", time.localtime(oldest))
return (state, output + " - " + jobOutput, [ ("jobs", numJobs, warnNum, critNum, 0) ])