Module: check_mk
Branch: master
Commit: deaaaafd768e24d73757a8c12410c08a032a9a16
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=deaaaafd768e24…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jan 25 10:25:45 2011 +0100
Updated bug entries
---
.bugs/104 | 4 ++++
.bugs/107 | 9 +++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/.bugs/104 b/.bugs/104
index d2283c0..5fada4f 100644
--- a/.bugs/104
+++ b/.bugs/104
@@ -8,3 +8,7 @@ Class: bug
The search field (text entry) is not centered in Firefox.
Also tactical overview seems unprecise.
+
+This has been introduced since 1.1.8. In OMD 0.44 everything is
+still fine. Might have todo with the fixing of the bullet indentation.
+
diff --git a/.bugs/107 b/.bugs/107
new file mode 100644
index 0000000..6c90e63
--- /dev/null
+++ b/.bugs/107
@@ -0,0 +1,9 @@
+Title: Snapin Serverperformance: number should be bold
+Component: multisite
+Benefit: 1
+State: open
+Cost: 1
+Date: 2011-01-25 10:03:20
+Class: cleanup
+
+The numbers had been bold once. This looked better. Make them bold again.
Module: check_mk
Branch: master
Commit: 42ac4fe4e39d1677763f826177db2bc667bc21c4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=42ac4fe4e39d16…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jan 25 14:42:37 2011 +0100
New HP-UX Agent and check for CPU load
---
ChangeLog | 2 +
agents/check_mk_agent.hpux | 136 +++++++++++++++++++++++++++++++++
checkman/hpux_cpu | 39 ++++++++++
checks/hpux_cpu | 53 +++++++++++++
pnp-rraconf/check_mk-hpux_cpu.rra.cfg | 1 +
pnp-templates/check_mk-hpux_cpu.php | 1 +
6 files changed, 232 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dc5c53a..66ad7a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
* megaraid_ldisks: remove debug output
* fc_brocade_port: hide on SNMP scan, prefer fc_brocade_port_detailed
* fc_brocade_port_detailed: improve scan function, find more devices
+ * New agent for HP-UX
+ * New check hpux_cpu: CPU load average on HP-UX
1.1.9i5:
diff --git a/agents/check_mk_agent.hpux b/agents/check_mk_agent.hpux
new file mode 100755
index 0000000..c7ef27b
--- /dev/null
+++ b/agents/check_mk_agent.hpux
@@ -0,0 +1,136 @@
+#!/usr/bin/ksh
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 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.
+
+export PATH=$PATH:/usr/sbin:/usr/bin:/usr/contrib/bin
+
+export MK_LIBDIR="/omd/versions/0.45.20110123/lib/check_mk_agent"
+export MK_CONFDIR="/etc/check_mk"
+
+# All executables in PLUGINSDIR will simply be executed and their
+# ouput appended to the output of the agent. Plugins define their own
+# sections and must output headers with '<<<' and '>>>'
+PLUGINSDIR=$MK_LIBDIR/plugins
+
+# All executables in LOCALDIR will by executabled and their
+# output inserted into the section <<<local>>>. Please
+# refer to online documentation for details about local checks.
+LOCALDIR=$MK_LIBDIR/local
+
+exec <&- 2>/dev/null
+
+echo '<<<check_mk>>>'
+echo Version: 1.1.9i5
+echo AgentOS: hpux
+echo PluginsDirectory: $PLUGINSDIR
+echo LocalDirectory: $LOCALDIR
+echo AgentDirectory: $MK_CONFDIR
+
+# Filesystems. HP-UX does not provide a filesystem type. We assume
+# modern systems with vxfs only here. The filesystem type is currently
+# not used by the check anyway.
+echo '<<<df>>>'
+df -Pkl | sed -e 's/ / vxfs /' -e 1d
+
+# Process table: HP-UX does not provide a resident size of processes.
+# We send a 0 here for RSZ.
+echo '<<<ps>>>'
+UNIX95=yes ps -ef -o user,vsz,pcpu,args | sed -e 1d -e 's/ *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) */(\1,\2,0,\3) /'
+
+
+echo '<<<hpux_cpu>>>'
+uptime
+machinfo | grep 'logical proc'
+
+# Several machine performance counters
+echo '<<<hpux_vmstat>>>'
+vmstat -s
+
+# Memory information
+echo '<<<hpux_mem>>>'
+machinfo | grep ^Memory
+vmstat | sed -n 3p
+
+# TCP connection states
+echo '<<<tcp_conn_stats>>>'
+netstat -f inet -n | awk ' /^tcp/ { c[$6]++; } END { for (x in c) { print x, c[x]; } }'
+
+# Network interfaces
+echo '<<<hpux_nics>>>'
+netstat -niw | sed 1d
+for nic in `nwmgr -g | sed -n '/^lan/s/\(^[^ ]* \).*/\1/p'`
+do
+ nwmgr -A speed,link_state -c $nic --script
+done
+
+# Logical Volume Manager
+echo '<<<hpux_lvm:sep(58)>>>'
+vgdisplay -v -F
+
+# Multipathing
+scsimgr lun_map | egrep '^[[:space:]]*(LUN PATH|State)'
+
+echo '<<<ntp>>>'
+# remove heading, make first column space separated
+ntpq -p | sed -e 1,2d -e 's/^\(.\)/\1 /' -e 's/^ /%/'
+
+
+# Einbinden von lokalen Plugins, die eine eigene Sektion ausgeben
+if cd $PLUGINSDIR
+then
+ for skript in $(ls)
+ do
+ if [ -x "$skript" ] ; then
+ ./$skript
+ fi
+ done
+fi
+
+
+# Lokale Einzelchecks
+echo '<<<local>>>'
+if cd $LOCALDIR
+then
+ for skript in $(ls)
+ do
+ if [ -x "$skript" ] ; then
+ ./$skript
+ fi
+ done
+fi
+
+
+# MK's Remote Plugin Executor
+if [ -e "$MK_CONFDIR/mrpe.cfg" ]
+then
+ echo '<<<mrpe>>>'
+ grep -Ev '^[[:space:]]*($|#)' "$MK_CONFDIR/mrpe.cfg" | \
+ while read descr cmdline
+ do
+ PLUGIN=${cmdline%% *}
+ OUTPUT=$(eval "$cmdline")
+ echo -n "(${PLUGIN##*/}) $descr $? $OUTPUT" | tr \\n \\1
+ echo
+ done
+fi
diff --git a/checkman/hpux_cpu b/checkman/hpux_cpu
new file mode 100644
index 0000000..7812bf2
--- /dev/null
+++ b/checkman/hpux_cpu
@@ -0,0 +1,39 @@
+title: Check CPU load on HP-UX
+agents: hpux
+author: Mathias Kettner <mk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check measures and checks the averaged CPU load. The values
+ for 1, 5 and 15 minute average are sent, although the PNP template
+ shipped with check_mk only displays the 1 and 15 min average load.
+
+ This check is compatible with the check {cpu.loads} of the linux
+ agent.
+
+examples:
+ # Set default levels to a load of 4 and 8 per CPU
+ cpuload_default_levels = (4.0, 8.0).
+
+ checks = [
+ # Use levels 4 per CPU (warning) and 8 per CPU (critical)
+ # on all hosts with the tag "linux"
+ (["hp"], ALL_HOSTS, "hpux_cpu", None, (4, 8)),
+ ]
+perfdata:
+ Three values: The load average for 1, 5 and 15 minutes.
+
+inventory:
+ One service is created if the agent outputs valid data.
+
+[parameters]
+warning (int): 15 minute average load {per processor} at which a
+ warning is triggered. If you set this value to 2 on a 16 CPU
+ machine, then a warning will be reached at a load of 32.
+critical (int): 15 minute average load per processor at which
+ a critical state is triggered.
+
+[configuration]
+cpuload_default_levels (int, int): A pair of floats or integers: The default
+ levels. These levels are used for inventorized checks. This variable
+ is preset to {(5, 10)}
diff --git a/checks/hpux_cpu b/checks/hpux_cpu
new file mode 100644
index 0000000..6aadd32
--- /dev/null
+++ b/checks/hpux_cpu
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 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.
+
+# <<<hpux_cpu>>>
+# 2:23pm up 196 days, 4:47, 5 users, load average: 0.05, 0.04, 0.04
+# 8 logical processors (2 per socket)
+
+cpuload_default_levels = (5, 10)
+
+def inventory_hpux_cpu_load(checkname, info):
+ if len(info) == 2 and 'load' in info[0]:
+ return [(None, "cpuload_default_levels")]
+
+def check_hpux_cpu_load(item, params, info):
+ load = [ float(l.strip(',')) for l in info[0][-3:] ]
+ num_cpus = int(info[1][0])
+
+ warn, crit = params # apply on 15min average, relative to number of CPUs
+ warn = warn * num_cpus
+ crit = crit * num_cpus
+ perfdata = [ ('load' + str(z), l, warn, crit, 0 ) for (z, l) in [ (1, load[0]), (5, load[1]), (15, load[2]) ] ]
+
+ if load[2] >= crit:
+ return (2, "CRIT - 15min Load %.2f at %s CPUs (critical at %.2f)" % (load[2], num_cpus, crit), perfdata)
+ elif load[2] >= warn:
+ return (1, "WARN - 15min Load %.2f at %s CPUs (warning at %.2f)" % (load[2], num_cpus, warn), perfdata)
+ else:
+ return (0, "OK - 15min Load %.2f at %s CPUs" % (load[2], num_cpus), perfdata)
+
+check_info['hpux_cpu'] = (check_hpux_cpu_load, "CPU load", 1, inventory_hpux_cpu_load )
diff --git a/pnp-rraconf/check_mk-hpux_cpu.rra.cfg b/pnp-rraconf/check_mk-hpux_cpu.rra.cfg
new file mode 120000
index 0000000..19dbf77
--- /dev/null
+++ b/pnp-rraconf/check_mk-hpux_cpu.rra.cfg
@@ -0,0 +1 @@
+max.rra.cfg
\ No newline at end of file
diff --git a/pnp-templates/check_mk-hpux_cpu.php b/pnp-templates/check_mk-hpux_cpu.php
new file mode 120000
index 0000000..ade8b37
--- /dev/null
+++ b/pnp-templates/check_mk-hpux_cpu.php
@@ -0,0 +1 @@
+check_mk-cpu.loads.php
\ No newline at end of file
Module: check_mk
Branch: master
Commit: bee29d9e49cb2c0635be17338d4e0dcabf60dee3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bee29d9e49cb2c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 13 10:32:47 2011 +0100
Removed df.trend check for inclusion in releases after 1.4
---
checks/df | 133 -------------------------------------------------------------
1 files changed, 0 insertions(+), 133 deletions(-)
diff --git a/checks/df b/checks/df
index 1555b66..a809e35 100644
--- a/checks/df
+++ b/checks/df
@@ -101,136 +101,3 @@ def inventory_df(checkname, info):
return inventory
check_info['df'] = (check_df, "fs_%s", 1, inventory_df)
-
-
-
-# New check: df.trend with checks the amount of space
-# which has been allocated in a given time range
-#
-# Author: Lars Michelsen <lm(a)mathias-kettner.de
-
-df_trend_default_levels = (86400, 1.0, 2.0, 10, None)
-
-# This stores the current value and compares it with the value
-# which before "backlog" seconds. If there is no value found
-# with this age (check is too new) the oldest known value is used.
-def get_trend(itemname, this_time, this_val, backlog):
-
- # first call: take current value
- if not itemname in g_counters:
- g_counters[itemname] = (this_time, this_val)
-
- if opt_dont_submit:
- return 0, this_val
- raise MKCounterWrapped(itemname, 'Counter initialization')
-
- # Get previous value and time difference
- last_time, last_val = g_counters.get(itemname)
- timedif = this_time - last_time
-
- # Only update when old data is older than 24h
- if this_time - last_time > backlog:
- print "get_trend: Saving new val"
- g_counters[itemname] = (this_time, this_val)
-
- return timedif, (this_val - last_val)
-
-def inventory_df_trend(checkname, info):
- inventory = []
- for line in info:
- try:
- fs_type = line[1]
- size_kb = int(line[2])
- if size_kb == 0 or line[5] == '-':
- continue # exclude filesystems without size
- item = " ".join(line[6:]).replace('\\', '/') # Windows \ is replaced with /
-
- # exclude some filesystem types and some items
- if fs_type not in inventory_df_exclude_fs and item not in inventory_df_exclude_mountpoints:
- inventory.append((item, 'df_trend_default_levels'))
- except ValueError,e:
- sys.stderr.write("Invalid plugin output '%s'\n" % (line,))
- pass # ignore e.g. entries for /proc, etc. if plugin sends any
-
- return inventory
-
-# FIXME: There is some duplicate code with the df check. Maybe move to include file
-def check_df_trend(item, params, info):
- # df outputs seven columns:
- # DEVICE FS-TYPE SIZE(KB) USED(KB) AVAIL(KB) USED(%) MOUNTPOINT
- # The mount point may contain spaces (seen on VMWare volumes)
-
- used_list = [ l for l in info if " ".join(l[6:]).replace('\\','/') == item ]
-
- if len(used_list) == 0:
- return (3, "UNKNOWN - %s missing or not a partition" % item )
- used = used_list[0] # might be listed twice. We take the first occurance
-
- # In some rare cases the item may contain a space (happened on ESX).
- if len(used) > 7:
- used = used[0:6] + [ " ".join(used[6:]) ]
-
- if len(used) != 7 or used[5][-1] != '%':
- return (3, "UNKNOWN - Invalid output from agent (%s)" % (' '.join(used),))
-
- bytes_total = saveint(used[2]) * 1024
- bytes_used = bytes_total - (saveint(used[4]) * 1024)
-
- # Get trend within the given timerange. When there are no information
- # for the whole range get the oldest available data
- try:
- timedif, trend = get_trend("df.trend.%s" % item, time.time(), saveint(bytes_used), params[0])
- except MKCounterWrapped, e:
- return (3, "UNKNOWN - Initialized value -> Skipping check result")
-
- # Check thresholds: percentage trend
- perc_used = 100 * (bytes_used / float(bytes_total))
- perc_trend = 100 * (trend / float(bytes_total))
- status = 0
- status_txt = ''
- if params[2] and perc_trend > params[2]:
- status = 2
- status_txt = ' (grew more than %s%%)' % params[2]
- elif params[1] and perc_trend > params[1]:
- status = 1
- status_txt = ' (grew more than %s%%)' % params[1]
-
- # Format the timedif
- (hours, seconds) = divmod(timedif, 3600)
- (minutes, seconds) = divmod(seconds, 60)
- timedif_txt = '%02d:%02d:%02d' % (int(hours), int(minutes), int(seconds))
-
- perfdata = [
- ( 'trend_mb', '%.2fMB' % (trend / 1024 / 1024), '', '', 0, '%.2f' % (bytes_total / 1024 / 1024)),
- ( 'trend_perc', '%.2f%%' % perc_trend, params[1], params[2], 0, 100 ),
- ]
-
- output = "%s trend is %s (%.2f%%) for last %s%s" % \
- (item, get_bytes_human_readable(trend), perc_trend, timedif_txt, status_txt)
-
- # Calculate the time left, assuming linear growing
- sec_left = -1
- if trend > 0:
- bytes_per_sec = trend / timedif
- sec_left = bytes_total / bytes_per_sec
-
- if params[4] and params[4] * 86400 > sec_left:
- status = 2
- status_txt = ' (CRIT: less than %d days left)' % params[4]
- elif params[3] and params[3] * 86400 > sec_left:
- if status < 1:
- status = 1
- status_txt = ' (WARN: less than %d days left)' % params[3]
-
- # Fortmat the output
- (days, seconds) = divmod(sec_left, 86400)
- (hours, seconds) = divmod(seconds, 3600)
- (minutes, seconds) = divmod(seconds, 60)
- output += ' - %d days, %d hours, %d minutes, %d seconds left%s' % \
- (int(days), int(hours), int(minutes), int(seconds), status_txt)
-
- perfdata += [('sec_left', sec_left, params[3], params[4])]
-
- return (status, '%s - %s' % (nagios_state_names[status], output), perfdata)
-
-check_info['df.trend'] = (check_df_trend, "Disk Usage Trend %s", 1, inventory_df_trend)