Module: check_mk
Branch: master
Commit: c85d392d7443a3ddeedb8c79202ed7b3b4b0ebcb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c85d392d7443a3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jul 30 12:42:05 2012 +0200
vms_queuejobs: new check for monitoring current VMS queue jobs
---
ChangeLog | 1 +
checks/vms_diskstat | 18 +++++++++----
checks/vms_if | 12 ++++++++-
checks/vms_queuejobs | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 87 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 880289a..71a8917 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
* vms_if: new check for network interfaces on OpenVMS
* vms_system.ios: new check for total direct/buffered IOs on OpenVMS
* vms_system.procs: new check for number of processes on OpenVMS
+ * vms_queuejobs: new check for monitoring current VMS queue jobs
* FIX: mssql agent: Added compatibility code for MSSQL 9
* f5_bigip_temp: add performance data
* added perf-o-meters for a lot of temperature checks
diff --git a/checks/vms_diskstat b/checks/vms_diskstat
index a202499..d9289f3 100644
--- a/checks/vms_diskstat
+++ b/checks/vms_diskstat
@@ -26,17 +26,23 @@
# Example output from agent:
# <<<vms_diskstat>>>
-# OVMS084 8380080 6430128 0.09
-# DATA 4110480 4090912 0.00
-
+# $1$DGA1122: TEST_WORK 1171743836 1102431184 0.00
+# DSA1: SHAD_1 66048000 58815666 0.00
+# DSA2: SHAD_2 66048000 47101824 0.07
+# DSA3: SHAD_3 66048000 46137546 1.57
+# DSA4: SHAD_4 66048000 36087093 0.00
+# DSA5: SHAD_5 66048000 32449914 0.00
+# $1$DGA1123: TEST_WORK 2171743836 1102431184 0.00
+# $1$DGA1124: TEMP_02 3171743836 102431184 1.10
+# $1$DGA1125: DATA_01 1171743836 202431184 0.20
def inventory_vms_diskstat_fs(info):
- return df_inventory([ line[0] for line in info ])
+ return df_inventory([ line[1] for line in info ])
def check_vms_diskstat_fs(item, params, info):
for line in info:
- if line[0] == item:
- label, size, used, ios = line
+ if line[1] == item:
+ device, label, size, used, ios = line
size_mb = int(size) * 512 / (1024.0 * 1024.0)
avail_mb = int(used) * 512 / (1024.0 * 1024.0)
return df_check_filesystem(g_hostname, item, size_mb, avail_mb, params)
diff --git a/checks/vms_if b/checks/vms_if
index e18e236..abcc3b6 100644
--- a/checks/vms_if
+++ b/checks/vms_if
@@ -25,10 +25,20 @@
# Boston, MA 02110-1301 USA.
def convert_vms_if(info):
+ # Due to signed 32-bit arithmetics we sometimes get negative values. Those
+ # must be converted to positive ones.
+ def wrap_negative(c):
+ if c < 0:
+ return c + 2**32
+ else:
+ return c
+
new_info = []
ifIndex = 0
for line in info:
- ifDescr, ifInOctets, ifInErrors, ifOutOctets, ifOutErrors, ifInDiscards =
line[:6]
+ ifDescr = line[0]
+ ifInOctets, ifInErrors, ifOutOctets, ifOutErrors, ifInDiscards =
map(wrap_negative, line[1:6])
+
ifIndex += 1
new_info.append((
str(ifIndex),
diff --git a/checks/vms_queuejobs b/checks/vms_queuejobs
new file mode 100644
index 0000000..0d37e53
--- /dev/null
+++ b/checks/vms_queuejobs
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 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:
+# <<<vms_queuejobs>>>
+# 2036F23D SRV_WATCHPROD LEF 0 05:10:00.39 945007498 7721395
+# 20201AF1 DRS_WATCHDOG_22 LEF 0 00:01:39.97 284611 2030
+
+def inventory_vms_queuejobs(info):
+ return [(None, {})]
+
+def check_vms_queuejobs(_no_item, params, info):
+ names = []
+ max_cpu_secs = 0
+ max_cpu_job = None
+ for id, name, state, cpu_days, cpu_time, ios, pgfaults in info:
+ names.append(name)
+ hours, minutes, seconds = map(float, cpu_time.split(":"))
+ cpu_secs = int(cpu_days) * 86400 + hours * 3600 + minutes * 60 + seconds
+ if cpu_secs > max_cpu_secs:
+ max_cpu_secs = cpu_secs
+ max_cpu_job = name
+
+ infotext = " - %d jobs" % len(info)
+ if max_cpu_job:
+ minutes, seconds = divmod(max_cpu_secs, 60)
+ hours, minutes = divmod(minutes, 60)
+ days, hours = divmod(hours, 24)
+ infotext += ', most CPU used by %s (%d days, %02d:%02d:%02d.%02d)' % \
+ (max_cpu_job, days, hours, minutes, int(seconds), int(seconds * 100))
+
+ return 0, "OK" + infotext
+
+
+check_info['vms_queuejobs'] = {
+ "check_function" : check_vms_queuejobs,
+ "inventory_function" : inventory_vms_queuejobs,
+ "service_description" : "Queue Jobs",
+ "has_perfdata" : False,
+}