Module: check_mk
Branch: master
Commit: 11575c7db70ddca435f7f92c266cfaa21c8d0ee9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=11575c7db70ddc…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Tue Jul 1 16:15:26 2014 +0200
FIX: missing laser power information is ignored for service interfaces
---
checkman/adva_fsp_if | 4 ++++
checks/adva_fsp_if | 18 ++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/checkman/adva_fsp_if b/checkman/adva_fsp_if
index dac243f..e0c2eca 100644
--- a/checkman/adva_fsp_if
+++ b/checkman/adva_fsp_if
@@ -15,6 +15,10 @@ description:
and output (transmit) power of the laser. Per default, not limits are imposed,
since meaningful values depend on the type of interface.
+ A {WARN} state is triggered if no laser power information can be found.
+ Service interfaces (item name beginning with "S") do not have laser power
+ information, so that non-existent laser power information is ignored for these
+ interfaces.
item:
There are three allowed ways to specify an interface: {1}: the last component
diff --git a/checks/adva_fsp_if b/checks/adva_fsp_if
index 8a8c854..a5cdb4c 100644
--- a/checks/adva_fsp_if
+++ b/checks/adva_fsp_if
@@ -80,9 +80,9 @@ def check_adva_fsp_if(item, params, info):
if line[0] == index:
state = 0
admintxt, adminstate = adva_fsp_if_adminstates[line[3]]
- state = max(adminstate,state)
+ state = max(adminstate, state)
opertxt, operstate = adva_fsp_if_operstates[line[4]]
- state = max(operstate,state)
+ state = max(operstate, state)
if state == 2:
statesym = "(!!)"
elif state == 1:
@@ -100,15 +100,16 @@ def check_adva_fsp_if(item, params, info):
state = 2
osym = "(!!)"
elif owarn and output_power < owarn:
- state = max(1,state)
+ state = max(1, state)
osym = "(!)"
else:
osym = ""
infotext += ", Output Power: %.1f%s" % ( output_power, osym )
perfdata.append( ("output_power", str(output_power)+"dBm", str(owarn)+":", str(ocrit)+":") )
except:
- infotext += ", Output Power: n.a. (!)"
- state = max(1,state)
+ if not re.match("S", item): # service interface does not have power parameter
+ infotext += ", Output Power: n.a. (!)"
+ state = max(1,state)
try:
@@ -118,15 +119,16 @@ def check_adva_fsp_if(item, params, info):
state = 2
isym = "(!!)"
elif iwarn and input_power < iwarn:
- state = max(1,state)
+ state = max(1, state)
isym = "(!)"
else:
isym = ""
infotext += ", Input Power: %.1f%s" % ( input_power, isym )
perfdata.append( ("input_power", str(input_power)+"dBm", str(iwarn)+":", str(icrit)+":") )
except:
- infotext += ", Input Power: n.a. (!)"
- state = max(1,state)
+ if not re.match("S", item): # service interface does not have power parameter
+ infotext += ", Input Power: n.a. (!)"
+ state = max(1,state)
return(state, infotext, perfdata)
Module: check_mk
Branch: master
Commit: 01e6308268a519208ba6858509597b8011b0165e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=01e6308268a519…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jul 1 15:42:35 2014 +0200
aix_diskiod: new check for disk IO on AIX
---
.werks/1039 | 8 ++++
ChangeLog | 1 +
agents/check_mk_agent.aix | 10 +++++
checkman/aix_diskiod | 77 ++++++++++++++++++++++++++++++++
checks/aix_diskiod | 69 ++++++++++++++++++++++++++++
pnp-templates/check_mk-aix_diskiod.php | 1 +
web/plugins/perfometer/check_mk.py | 1 +
7 files changed, 167 insertions(+)
diff --git a/.werks/1039 b/.werks/1039
new file mode 100644
index 0000000..e597bc9
--- /dev/null
+++ b/.werks/1039
@@ -0,0 +1,8 @@
+Title: aix_diskiod: new check for disk IO on AIX
+Level: 2
+Component: checks
+Version: 1.2.5i5
+Date: 1404222142
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 5ac7e61..5bfe9ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
* 1034 Always provide also 64 bit version of Windows agent
* 0170 hp_proliant_power: New check to monitor the Power Meter on Prolaint Servers and iLO Boards
* 0172 zfsget: Check is now usable in cluster_mode...
+ * 1039 aix_diskiod: new check for disk IO on AIX
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output of if checks...
diff --git a/agents/check_mk_agent.aix b/agents/check_mk_agent.aix
index c42abe6..401b858 100755
--- a/agents/check_mk_agent.aix
+++ b/agents/check_mk_agent.aix
@@ -23,6 +23,10 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+# Remove locale settings to eliminate localized outputs where possible
+export LC_ALL=C
+unset LANG
+
export MK_LIBDIR="/to/be/changed"
export MK_CONFDIR="/to/be/changed"
@@ -66,6 +70,12 @@ fi
echo '<<<vmstat_aix>>>'
vmstat | tail -n1
+echo '<<<aix_diskiod>>>'
+iostat -d | tr -s ' ' | grep hdisk
+
+echo '<<<aix_memory>>>'
+vmstat -v | tr -s ' ' | cut -d " " -f 2
+
echo '<<<mpstat_aix>>>'
mpstat -a | tail -n1
diff --git a/checkman/aix_diskiod b/checkman/aix_diskiod
new file mode 100644
index 0000000..3615add
--- /dev/null
+++ b/checkman/aix_diskiod
@@ -0,0 +1,77 @@
+title: Throughput on AIX hard disks
+agents: aix
+catalog: os/storage
+license: GPL
+distribution: check_mk
+description:
+
+ This check measures the disk IO of hard disks on AIX. The agent provides this
+ information via the command {diskio -d}. This check is compatible with {diskstat},
+ but only supports throughput, no latency and queue lengths. Please read further
+ details in the man page of {diskstat}.
+
+item:
+ Either {"SUMMARY"} for a summarized check of alls LUNs or the
+ name of the disk device, e.g. {"hdisk15"}.
+
+examples:
+ # create one check for all disks
+ diskstat_inventory_mode = "summary"
+
+ # Set default levels for diskstat
+ diskstat_default_levels = {
+ "read" : (10, 20), # level for read MB/sec
+ "write" : (20, 40), # level for write MB/sec
+ "average" : 15, # averaging in minutes
+ }
+
+ # Alternative: just enable averaging over 10 minutes,
+ # do not apply levels:
+ diskstat_default_levels = {
+ "average" : 15
+ }
+
+ # Settings for certain hosts:
+ check_parameters += [
+ ( {"write" : (20, 50), "average" : 10 }, [ "oracle" ], ALL_HOSTS, [ "Disk IO" ])
+ ]
+
+perfdata:
+ The disk throughput for read and write in bytes per second. If averaging
+ is turned on, then two additional values are sent: the averaged read and
+ write throughput.
+
+inventory:
+ The inventory is configured via {diskstat_inventory_mode}. If this is set
+ to {"single"} (the default), then one check will be created for each
+ disk. If it is set to {"summary"} then only one service per host will be
+ created that has at least one hard disk. If set to {"legacy"} then a
+ separate check for read and write will be created (deprecated).
+
+[parameters]
+"read": The levels to be applied to the read throughput. It this entry is
+ {None} or missing in the dictionary, then no levels are applied. This is
+ the defaut. The values are in MB per second. Setting {"read"} to {(20, 40)}
+ will warn if 20 MB/s is exceeded and make the check critical at 40 MB/s.
+ If averaging is turned on, then the levels are applied to the averaged
+ values!
+
+"write": The levels for the write throughput.
+
+"average": If this is not {None}, it will be interpreted as a time range
+ in minutes to do averaging over. Set this to {15} in order to have
+ the levels applied to a 15-minute average instead of the current
+ values (approx.). Turning the average on will also create two additional
+ performance values. Make sure that your graphing tool is setup to
+ a changing number of variables.
+
+[configuration]
+diskstat_defaul_levels(dict): The default parameter used for inventorized
+ checks. This is preset to the empty dictionary.
+ That means that no averaging is done and no
+ levels are applied.
+
+diskstat_inventory_mode(string): Either {"single"} for one service per disk
+ or {"summary"} for the throughput of all disks summed up in one service.
+ Also possible is {"legacy"} for the old style mode (see above). Default
+ is {"single"}.
diff --git a/checks/aix_diskiod b/checks/aix_diskiod
new file mode 100644
index 0000000..7a8d3e3
--- /dev/null
+++ b/checks/aix_diskiod
@@ -0,0 +1,69 @@
+#!/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.
+
+# <<<aix_diskiod>>>
+# hdisk3 0.9 237.0 9.1 1337054478 1628926522
+# hdisk5 0.9 237.1 8.8 1333731705 1633897629
+# hdisk7 0.9 256.2 10.1 1537047014 1669194644
+# hdisk6 0.9 236.6 9.1 1334163361 1626627852
+# hdisk2 0.9 237.6 9.1 1334458233 1639383130
+# hdisk9 0.8 239.4 9.3 1337740029 1658392394
+# hdisk8 0.9 238.3 8.9 1332262996 1649741796
+# hdisk4 0.9 237.4 8.8 1332426157 1638419364
+# hdisk13 0.5 238.1 8.3 394246756 2585031872
+# hdisk11 0.5 238.3 8.3 397601918 2584807275
+
+# Columns means:
+# 1. device
+# 2. % tm_act
+# 3. Kbps
+# 4. tps
+# 5. Kb_read -> Kilobytes read since system boot
+# 6. Kb_wrtn -> Kilobytes written since system boot
+
+def aix_diskiod_convert(info):
+ converted = []
+ for device, tm_act, kbps, tps, kb_read, kb_written in info:
+ converted.append((device, int(kb_read) * 1024, int(kb_written) * 1024))
+ return converted
+
+
+def inventory_aix_diskiod(info):
+ return inventory_diskstat_generic(aix_diskiod_convert(info))
+
+
+def check_aix_diskiod(item, params, info):
+ return check_diskstat_generic(item, params, time.time(), aix_diskiod_convert(info))
+
+check_info["aix_diskiod"] = {
+ 'check_function': check_aix_diskiod,
+ 'inventory_function': inventory_aix_diskiod,
+ 'service_description': 'Disk IO %s',
+ 'has_perfdata': True,
+ 'group': 'disk_io',
+ 'includes': [ "diskstat.include" ],
+}
+
diff --git a/pnp-templates/check_mk-aix_diskiod.php b/pnp-templates/check_mk-aix_diskiod.php
new file mode 120000
index 0000000..8b45325
--- /dev/null
+++ b/pnp-templates/check_mk-aix_diskiod.php
@@ -0,0 +1 @@
+check_mk-diskstat.php
\ No newline at end of file
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 7cf2b33..74c4bf7 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -583,6 +583,7 @@ def perfometer_check_mk_diskstat(row, check_command, perf_data):
perfometers["check_mk-diskstat"] = perfometer_check_mk_diskstat
perfometers["check_mk-winperf_phydisk"] = perfometer_check_mk_diskstat
perfometers["check_mk-hpux_lunstats"] = perfometer_check_mk_diskstat
+perfometers["check_mk-aix_diskiod"] = perfometer_check_mk_diskstat
perfometers["check_mk-mysql.innodb_io"] = perfometer_check_mk_diskstat
perfometers["check_mk-esx_vsphere_counters.diskio"] = perfometer_check_mk_diskstat
perfometers["check_mk-emcvnx_disks"] = perfometer_check_mk_diskstat
Module: check_mk
Branch: master
Commit: f45ee7f38ad6d1a6406d63f87a8f2fdb10a44633
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f45ee7f38ad6d1…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Jul 1 14:07:44 2014 +0200
zfsget: Check is now usable in cluster_mode
Until now, it was not possible to move zfs filesystems to a check_mk defined cluster host. This is now possible. It was nescessary to rewrite
the hole check logic, so it's possible that we introduced new bugs, so please double-check the output of the plugin.
---
.werks/172 | 9 ++++
ChangeLog | 1 +
checks/zfsget | 152 ++++++++++++++++++++++++++++-----------------------------
3 files changed, 85 insertions(+), 77 deletions(-)
diff --git a/.werks/172 b/.werks/172
new file mode 100644
index 0000000..63cb209
--- /dev/null
+++ b/.werks/172
@@ -0,0 +1,9 @@
+Title: zfsget: Check is now usable in cluster_mode
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1404216186
+Class: feature
+
+Until now, it was not possible to move zfs filesystems to a check_mk defined cluster host. This is now possible. It was nescessary to rewrite
+the hole check logic, so it's possible that we introduced new bugs, so please double-check the output of the plugin.
diff --git a/ChangeLog b/ChangeLog
index ea05c6d..dcc47cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
* 0169 websphere_mq_channels,ebsphere_mq_queues: New Checks to monitor IBM Websphere MQ Queues and Channels...
* 1034 Always provide also 64 bit version of Windows agent
* 0170 hp_proliant_power: New check to monitor the Power Meter on Prolaint Servers and iLO Boards
+ * 0172 zfsget: Check is now usable in cluster_mode...
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output of if checks...
diff --git a/checks/zfsget b/checks/zfsget
index c97e526..f4b0ec5 100644
--- a/checks/zfsget
+++ b/checks/zfsget
@@ -59,27 +59,11 @@
# tsrdb10exp 5128704 21 4982717 1% /tsrdb10exp
# tsrdb10dat 30707712 19914358 10789464 65% /u01
-
-def parse_zfsget(info):
+def parse_zfs_entrie(info):
def mb(x):
return saveint(x) / (1024.0 * 1024)
-
- entries = []
- entry = None
- lineno = 0
- last_name = None
- start_of_df = None
- for line in info:
- lineno += 1
- if line == ['[df]']:
- start_of_df = lineno
- break
- name, what, value = line[:3]
- if last_name != name:
- if entry:
- entries.append(entry)
- entry = {}
- last_name = name
+ entry = {}
+ for name, what, value in info:
if what in ["used", "available"]:
entry[what] = mb(value)
elif what == "quota":
@@ -87,79 +71,93 @@ def parse_zfsget(info):
entry[what] = mb(value)
elif what in [ 'mountpoint', 'type', 'name' ]:
entry[what] = value
-
if entry:
- entries.append(entry)
-
- # parsed has the device name as key, because there may exist
- # several device names per mount point, and we know only
- # later which one to take
- parsed = {}
- for entry in entries:
- if entry["mountpoint"].startswith("/"):
- entry["is_pool"] = '/' not in entry["name"]
- if entry['available'] !=0 and entry['type'] == 'filesystem':
- parsed[entry["name"]] = entry
-
- # parsed_df and parsed_final have the mount point as key
- parsed_final = {}
- if start_of_df != None:
- parsed_df = zfsget_parse_df_info(parsed, info[start_of_df:])
- for mountpoint, entry_df in parsed_df.items():
- found = False
- # for every mount point in the df section, if the device name
- # is also present in the "parsed" variable, we take those data
- for name, entry in parsed.items():
- if entry_df["name"] == name:
- parsed_final[mountpoint] = entry
- found = True
- # if a mount point in the df section is not present in the
- # parsed variable, we take the data from the df section
- if not found:
- parsed_final[mountpoint] = entry_df
- else:
- # if there is no df section we take the other data,
- # should there be several device names per mount point,
- # (not sure if this can happen) the last one wins
- for name, entry in parsed.items():
- parsed_final[entry["mountpoint"]] = entry
-
- return parsed_final
+ return entry
-def zfsget_parse_df_info(entries, info):
- new_entries = {}
-
- for entry in info:
- if len(entry) == 6:
- device, kbytes, used, avail, percent, mountpoint = entry
- else:
- device, fs_type, kbytes, used, avail, percent, mountpoint = entry
- if mountpoint.startswith("/"):
- entry = {}
- total = int(kbytes) / 1024.0
- entry["name"] = device
- entry["total"] = total
- entry["used"] = int(used) / 1024.0
- entry["available"] = total - entry["used"]
- entry["mountpoint"] = mountpoint
- new_entries[mountpoint] = entry
+def parse_zfsget(info):
+ run_zfs = True
+ run_df = False
+ last_name = None
+ zfs_agent_data = []
+ zfs_converted = []
+ df_parsed = {}
+ for line in info:
+ if line == ['[zfs]']:
+ run_zfs = True
+ run_df = False
+ continue
+ if line == ['[df]']:
+ run_df = True
+ run_zfs = False
+ continue
+
+ if run_zfs:
+ name = line[0]
+ # New block so parse everthing and go on collecting more blocks
+ if last_name != name:
+ last_name = name
+ if zfs_agent_data:
+ zfs_converted.append(parse_zfs_entrie(zfs_agent_data))
+ zfs_agent_data = []
+ zfs_agent_data.append(line[:3])
+
+ if run_df:
+ if len(line) == 6:
+ device, kbytes, used, avail, percent, mountpoint = line
+ else:
+ device, fs_type, kbytes, used, avail, percent, mountpoint = line
+ if mountpoint.startswith("/"):
+ entry = {}
+ total = int(kbytes) / 1024.0
+ entry["name"] = device
+ entry["total"] = total
+ entry["used"] = int(used) / 1024.0
+ entry["available"] = total - entry["used"]
+ entry["mountpoint"] = mountpoint
+ df_parsed[mountpoint] = entry
# Now remove duplicate entries for the root filesystem, such
# as /dev/ or /lib/libc.so.1. We do this if size, used and
# avail is equal. I hope that it will not happen too often
# that this is per chance the case for different passed-through
# filesystems
- root_entry = new_entries.get("/")
+ root_entry = df_parsed.get("/")
if root_entry:
t_u_a = (root_entry["total"], root_entry["used"], root_entry["available"])
drop = []
- for mountpoint, entry in new_entries.items():
+ for mountpoint, entry in df_parsed.items():
if mountpoint != "/" and \
t_u_a == (entry["total"], entry["used"], entry["available"]):
drop.append(mountpoint)
for mp in drop:
- del new_entries[mp]
- return new_entries
+ del df_parsed[mp]
+
+ # parsed has the device name as key, because there may exist
+ # several device names per mount point, and we know only
+ # later which one to take
+ zfs_parsed = {}
+ for entry in zfs_converted:
+ if entry["mountpoint"].startswith("/"):
+ entry["is_pool"] = '/' not in entry["name"]
+ if entry['available'] !=0 and entry['type'] == 'filesystem':
+ zfs_parsed[entry["name"]] = entry
+
+ # parsed_df and parsed_final have the mount point as key
+ parsed_final = {}
+ for mountpoint, entry_df in df_parsed.items():
+ found = False
+ # for every mount point in the df section, if the device name
+ # is also present in the "parsed" variable, we take those data
+ for name, entry in zfs_parsed.items():
+ if entry_df["name"] == name:
+ parsed_final[mountpoint] = entry
+ found = True
+ # if a mount point in the df section is not present in the
+ # parsed variable, we take the data from the df section
+ if not found:
+ parsed_final[mountpoint] = entry_df
+
+ return parsed_final
def inventory_zfsget(info):
mplist = []