Module: check_mk
Branch: master
Commit: ac8999705155e36a16392dae1f46e00fcc172c3c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ac8999705155e3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Mar 9 10:57:50 2016 +0100
Added some missing comments in the plugins
---
agents/plugins/mk_db2.aix | 1 +
agents/plugins/mk_db2.linux | 89 ++++++++++++++++++++++---------------------
agents/plugins/mk_mongodb | 2 +
3 files changed, 48 insertions(+), 44 deletions(-)
diff --git a/agents/plugins/mk_db2.aix b/agents/plugins/mk_db2.aix
index 6ae1764..ed59cc3 100755
--- a/agents/plugins/mk_db2.aix
+++ b/agents/plugins/mk_db2.aix
@@ -1,4 +1,5 @@
#!/usr/bin/ksh
+# Monitor DB/2 databases on AIX
# $HOME/sqllib/db2profile
# This script can be called in two ways
diff --git a/agents/plugins/mk_db2.linux b/agents/plugins/mk_db2.linux
index 1004be6..cf1d0d5 100755
--- a/agents/plugins/mk_db2.linux
+++ b/agents/plugins/mk_db2.linux
@@ -1,4 +1,5 @@
#!/bin/bash
+# Monitor DB/2 databases on Linux
# $HOME/sqllib/db2profile
# This script can be called in two ways
@@ -157,49 +158,49 @@ WAITMAX
query_instances
exit 0
#else
- #### RUN CACHED #####
- function file_age {
- /usr/bin/perl -e 'if (! -f $ARGV[0]){die "0000000"};$mtime=(stat($ARGV[0]))[9];print ($^T-$mtime);' "$1"
- }
-
- if [ ! -d $MK_VARDIR/cache ]; then mkdir -p $MK_VARDIR/cache ; fi
- CACHEFILE="$MK_VARDIR/cache/mk_db2.aix.cache"
- MAXAGE=1
-
- # Check if the creation of the cache takes suspiciously long and return
- # nothing if the age (access time) of $CACHEFILE.new is twice the MAXAGE
- if [ -e "$CACHEFILE.new" ] ; then
- AGE=$(file_age "$CACHEFILE.new")
- if [ $AGE -ge $((MAXAGE * 2)) ] ; then
- return
- fi
- fi
-
- # Check if the creation of the cache takes way to long and delete this file
- # The process might have crashed...
- # Since the processes are called with waitmax it is very unlikely that
- # there are still unwanted processes soiling the system.
- if [ -e "$CACHEFILE.new" ] ; then
- AGE=$(file_age "$CACHEFILE.new")
- if [ $AGE -ge $((MAXAGE * 10)) ] ; then
- rm "$CACHEFILE.new"
- fi
- fi
-
- # Check if cache file exists and is recent enough
- USE_CACHEFILE=""
- if [ -s "$CACHEFILE" ] ; then
- AGE=$(file_age "$CACHEFILE")
- if [ $AGE -le $MAXAGE ] ; then USE_CACHEFILE=1 ; fi
- # Output the file in any case, even if it is
- # outdated. The new file will not yet be available
- cat "$CACHEFILE"
- fi
-
- # Cache file outdated and new job not yet running? Start it
- if [ -z "$USE_CACHEFILE" -a ! -e "$CACHEFILE.new" ] ; then
- echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; ./$0 query && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup ksh 2>/dev/null &
- fi
-fi
+# #### RUN CACHED #####
+# function file_age {
+# /usr/bin/perl -e 'if (! -f $ARGV[0]){die "0000000"};$mtime=(stat($ARGV[0]))[9];print ($^T-$mtime);' "$1"
+# }
+#
+# if [ ! -d $MK_VARDIR/cache ]; then mkdir -p $MK_VARDIR/cache ; fi
+# CACHEFILE="$MK_VARDIR/cache/mk_db2.aix.cache"
+# MAXAGE=1
+#
+# # Check if the creation of the cache takes suspiciously long and return
+# # nothing if the age (access time) of $CACHEFILE.new is twice the MAXAGE
+# if [ -e "$CACHEFILE.new" ] ; then
+# AGE=$(file_age "$CACHEFILE.new")
+# if [ $AGE -ge $((MAXAGE * 2)) ] ; then
+# return
+# fi
+# fi
+#
+# # Check if the creation of the cache takes way to long and delete this file
+# # The process might have crashed...
+# # Since the processes are called with waitmax it is very unlikely that
+# # there are still unwanted processes soiling the system.
+# if [ -e "$CACHEFILE.new" ] ; then
+# AGE=$(file_age "$CACHEFILE.new")
+# if [ $AGE -ge $((MAXAGE * 10)) ] ; then
+# rm "$CACHEFILE.new"
+# fi
+# fi
+#
+# # Check if cache file exists and is recent enough
+# USE_CACHEFILE=""
+# if [ -s "$CACHEFILE" ] ; then
+# AGE=$(file_age "$CACHEFILE")
+# if [ $AGE -le $MAXAGE ] ; then USE_CACHEFILE=1 ; fi
+# # Output the file in any case, even if it is
+# # outdated. The new file will not yet be available
+# cat "$CACHEFILE"
+# fi
+#
+# # Cache file outdated and new job not yet running? Start it
+# if [ -z "$USE_CACHEFILE" -a ! -e "$CACHEFILE.new" ] ; then
+# echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; ./$0 query && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup ksh 2>/dev/null &
+# fi
+#fi
exit 0
diff --git a/agents/plugins/mk_mongodb b/agents/plugins/mk_mongodb
index 74bce98..a61e8ad 100755
--- a/agents/plugins/mk_mongodb
+++ b/agents/plugins/mk_mongodb
@@ -1,4 +1,6 @@
#!/usr/bin/python
+# Monitor MongoDB on Linux
+
import sys
import time
import pprint
Module: check_mk
Branch: master
Commit: aa19cd613343584bff082c4cfd154493ae2821ea
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=aa19cd61334358…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Mar 9 09:44:34 2016 +0100
Fixed naming inventory -> discovery in logwatch check
---
checks/logwatch | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/checks/logwatch b/checks/logwatch
index 3967175..3cc8fad 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -666,7 +666,7 @@ def check_logwatch_ec(item, params, info):
infotexts = []
if params.get('monitor_logfilelist'):
if 'expected_logfiles' not in params:
- infotexts.append("You enabled monitoring the list of forwarded logfiles. You need to re-inventorize the check once.")
+ infotexts.append("You enabled monitoring the list of forwarded logfiles. You need to redo service discovery.")
status = 1
else:
expected = params['expected_logfiles']
Module: check_mk
Branch: master
Commit: b4a8bcb0c60c4d23a93cba9c9a82ccbb853021d1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b4a8bcb0c60c4d…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Mar 8 16:52:46 2016 +0100
3004 agent_vsphere: now able to configure used piggyback name for virtualmachines
In the ESX datasource program you can now set if used piggyback name is
taken from the ESX management view (most of the time an alias) or if the
actual hostname of the system should be used (if available).
The alias option is set as default.
---
.werks/3004 | 13 +++++++++++++
ChangeLog | 1 +
agents/special/agent_vsphere | 21 ++++++++++++++++-----
checks/agent_vsphere | 3 +++
web/plugins/wato/datasource_programs.py | 12 +++++++++++-
5 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/.werks/3004 b/.werks/3004
new file mode 100644
index 0000000..501d2a7
--- /dev/null
+++ b/.werks/3004
@@ -0,0 +1,13 @@
+Title: agent_vsphere: now able to configure used piggyback name for virtualmachines
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1457452277
+Class: feature
+
+In the ESX datasource program you can now set if used piggyback name is
+taken from the ESX management view (most of the time an alias) or if the
+actual hostname of the system should be used (if available).
+
+The alias option is set as default.
diff --git a/ChangeLog b/ChangeLog
index ad78576..ca94751 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
* 3001 fileinfo: now able to configure the checks status if the file is missing
* 3088 rstcli, rstcli.pdisks: new checks to monitor Intel RST raids
* 3093 isc_dhcpd: now interprets include statements when parsing the configuration file
+ * 3004 agent_vsphere: now able to configure used piggyback name for virtualmachines...
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index d0372a3..f441bbb 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -268,6 +268,7 @@ telegram_list = {
'<ns1:pathSet>guest.toolsVersion</ns1:pathSet>'\
'<ns1:pathSet>guestHeartbeatStatus</ns1:pathSet>'\
'<ns1:pathSet>name</ns1:pathSet>'\
+ '<ns1:pathSet>summary.guest.hostName</ns1:pathSet>'\
'<ns1:pathSet>summary.quickStats.compressedMemory</ns1:pathSet>'\
'<ns1:pathSet>summary.quickStats.swappedMemory</ns1:pathSet>'\
'<ns1:pathSet>summary.quickStats.guestMemoryUsage</ns1:pathSet>'\
@@ -817,6 +818,9 @@ OPTIONS:
after the first space, "underscore": replace with
underscores. Default is "underscore".
+ --vm_piggyname hostname|alias Here you can specify whether the virtual machines HOSTNAME or the ESX
+ system ALIAS name for this machine should be used on creating piggyback data
+
--vm_pwr_display WHERE Specifies where the virtual machines power state should be shown
Default (no option) is on the queried vCenter or ESX-Host
Possible WHERE options: * esxhost : show on ESX host
@@ -828,10 +832,11 @@ OPTIONS:
""")
-short_options = 'hi:u:s:Dat:H:Pp:S:'
+short_options = "hi:u:s:Dat:H:Pp:S:"
long_options = [
- 'help', 'user=', 'secret=', 'direct', 'agent', 'debug', 'modules=', 'timeout=', 'no-cert-check',
- 'hostname=', 'tracefile=', "pysphere", "port=", "spaces=", "host_pwr_display=", "vm_pwr_display="
+ "help", "user=", "secret=", "direct", "agent", "debug", "modules=", "timeout=", "no-cert-check",
+ "hostname=", "tracefile=", "pysphere", "port=", "spaces=", "host_pwr_display=", "vm_pwr_display=",
+ "vm_piggyname="
]
opt_debug = False
@@ -845,6 +850,7 @@ opt_pysphere = False
opt_tracefile = None
opt_host_pwr_display = None
opt_vm_pwr_display = None
+opt_vm_piggyname = "alias"
opt_spaces = "underscore"
opt_no_cert = False
@@ -890,6 +896,8 @@ for o,a in opts:
opt_timeout = int(a)
elif o in [ '-H', '--hostname' ]:
opt_hostname = a
+ elif o in [ '--vm_piggyname' ]:
+ opt_vm_piggyname = a
elif o in [ '--vm_pwr_display' ]:
opt_vm_pwr_display = a
elif o in [ '--host_pwr_display' ]:
@@ -1550,13 +1558,16 @@ if not error:
if key in vm_data:
vm_data[key] = transform(vm_data[key])
- vms[vm_data.get("name")] = vm_data
+ if opt_vm_piggyname == "hostname" and vm_data.get("summary.guest.hostName"):
+ vms[vm_data.get("summary.guest.hostName")] = vm_data
+ else:
+ vms[vm_data.get("name")] = vm_data
for key in sorted(vms.keys()):
data = vms[key]
if data.get("name"):
- output("<<<<%s>>>>" % convert_hostname(data.get("name")))
+ output("<<<<%s>>>>" % convert_hostname(key))
output("<<<esx_vsphere_vm>>>")
entries = list(data.items())
entries.sort()
diff --git a/checks/agent_vsphere b/checks/agent_vsphere
index cf1f0ad..8ac5141 100644
--- a/checks/agent_vsphere
+++ b/checks/agent_vsphere
@@ -62,6 +62,9 @@ def agent_vsphere_arguments(params, hostname, ipaddress):
if params.get("vm_pwr_display"):
args += ' --vm_pwr_display %s' % params.get("vm_pwr_display")
+ if params.get("vm_piggyname"):
+ args += ' --vm_piggyname %s' % params.get("vm_piggyname")
+
if params.get("host_pwr_display"):
args += ' --host_pwr_display %s' % params.get("host_pwr_display")
diff --git a/web/plugins/wato/datasource_programs.py b/web/plugins/wato/datasource_programs.py
index a67d8cb..6868be3 100644
--- a/web/plugins/wato/datasource_programs.py
+++ b/web/plugins/wato/datasource_programs.py
@@ -122,6 +122,16 @@ register_rule(group,
default = None,
)
),
+ ( "vm_piggyname",
+ DropdownChoice(
+ title = _("Piggyback name of virtual machines"),
+ choices = [
+ ( "alias", _("Use the name specified in the ESX system") ),
+ ( "hostname", _("Use the VMs hostname if set, otherwise fall back to ESX name") ),
+ ],
+ default = "alias",
+ )
+ ),
( "vm_pwr_display",
DropdownChoice(
title = _("Display VM power state on"),
@@ -178,7 +188,7 @@ register_rule(group,
)
),
],
- optional_keys = [ "tcp_port", "timeout", "vm_pwr_display", "host_pwr_display" ],
+ optional_keys = [ "tcp_port", "timeout", "vm_pwr_display", "host_pwr_display", "vm_piggyname" ],
),
title = _("Check state of VMWare ESX via vSphere"),
help = _("This rule selects the vSphere agent instead of the normal Check_MK Agent "
Module: check_mk
Branch: master
Commit: b3c5e7d430b0871cd5c5145696c219bd2e2e77a6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b3c5e7d430b087…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Mar 8 15:12:39 2016 +0100
3003 New treasure script: migrate_oldcmk2wato.py
This script parses old configuration files (pre-WATO) and converts them
into a WATO environment by creating hosts.mk and rules.mk files.
Note: This script is still experimental is not able to do a complete migration
of all configuration settings.
---
.werks/3003 | 14 +
ChangeLog | 1 +
doc/treasures/migrate_oldcmk2wato.py | 521 ++++++++++++++++++++++++++++++++++
3 files changed, 536 insertions(+)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=b3c5e7d430…
Module: check_mk
Branch: master
Commit: cdf4163585d35c0aff6522670e8905336c255351
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cdf4163585d35c…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Tue Mar 8 14:32:57 2016 +0100
3094 FIX cisco_temperature: fixed duplicated sensors on some devices
On some cisco devices, temperature sensors were discovered twice under different names.
This has now been fixed and best effort has been made to properly merge available information of the
two.
---
.werks/3094 | 12 ++++++++++
ChangeLog | 1 +
checks/cisco_temperature | 56 ++++++++++++++++++++++++++++++++++------------
3 files changed, 55 insertions(+), 14 deletions(-)
diff --git a/.werks/3094 b/.werks/3094
new file mode 100644
index 0000000..7ac0c92
--- /dev/null
+++ b/.werks/3094
@@ -0,0 +1,12 @@
+Title: cisco_temperature: fixed duplicated sensors on some devices
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1457443808
+
+On some cisco devices, temperature sensors were discovered twice under different names.
+This has now been fixed and best effort has been made to properly merge available information of the
+two.
diff --git a/ChangeLog b/ChangeLog
index eb82124..89424d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,7 @@
* 3278 FIX: fritz_wan_if: Fixed incorrect unit Bit used in check
* 3092 FIX: isc_dhcpd: fixed incorrect handling of timezones
* 3259 FIX: ad_replication: fixed wrong timestamp handling
+ * 3094 FIX: cisco_temperature: fixed duplicated sensors on some devices...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/cisco_temperature b/checks/cisco_temperature
index 3281bb3..68f51ff 100644
--- a/checks/cisco_temperature
+++ b/checks/cisco_temperature
@@ -58,6 +58,17 @@ cisco_entity_exponents = {
def parse_cisco_temperature(info):
+ def merge_dict(dest, src):
+ # recursively merge two dicts and don't overwrite
+ # if the source-field contains None
+ for k, v in src.iteritems():
+ if k not in dest:
+ dest[k] = v
+ elif isinstance(dest[k], dict) and isinstance(v, dict):
+ merge_dict(dest[k], v)
+ elif v is not None:
+ dest[k] = v
+
description_info, state_info, levels_info, perfstuff = info
# Parse OIDs described by CISCO-ENTITY-SENSOR-MIB
@@ -117,8 +128,19 @@ def parse_cisco_temperature(info):
}
parsed = {}
- for statustext, temp, max_temp, state, oid_end in perfstuff:
- item = cisco_sensor_item(statustext, oid_end)
+
+ for statustext, temp, max_temp, state, sensor_id in perfstuff:
+ if sensor_id in descriptions and descriptions[sensor_id] in entity_parsed:
+ # if this sensor is already in the dictionary, ensure we use the same name
+ item = descriptions[sensor_id]
+ prev_description = cisco_sensor_item(statustext, sensor_id)
+ # also register the name we would have used up to 1.2.8b4, so we can give
+ # the user a proper info message.
+ # It's the little things that show you care
+ parsed[prev_description] = {"obsolete": True}
+ else:
+ item = cisco_sensor_item(statustext, sensor_id)
+
if state in ['5', '6']:
parsed[item] = (3, "Sensor %s" % envmon_states[state])
elif int(temp) == 0:
@@ -129,33 +151,39 @@ def parse_cisco_temperature(info):
else:
parsed[item] = {}
parsed[item]['temp'] = int(temp)
- if max_temp and int(max_temp):
+
+ if state == '1':
+ parsed[item]['dev_status'] = 0
+ elif state == '2':
+ parsed[item]['dev_status'] = 1
+ elif state in ['3', '4']:
+ parsed[item]['dev_status'] = 2
+ else:
parsed[item]['dev_status'] = None
+
+ # TODO using max_temp as a crit level is not really practical as, according
+ # to the mib, the device will be shut down at this temperature!
+ if max_temp and int(max_temp):
parsed[item]['dev_levels'] = (int(max_temp), int(max_temp))
else:
parsed[item]['dev_levels'] = None
- if state == '1':
- parsed[item]['dev_status'] = 0
- elif state == '2':
- parsed[item]['dev_status'] = 1
- elif state in '34':
- parsed[item]['dev_status'] = 2
- else:
- parsed[item] = (3, "Sensor reports unknown status code")
# Merge the two dicts, preferring keys generated from ENTITY data
- parsed.update(entity_parsed)
+ merge_dict(parsed, entity_parsed)
return parsed
def inventory_cisco_temperature(parsed):
- for item in parsed.keys():
- yield item, {}
+ for item, value in parsed.iteritems():
+ if not value.get("obsolete", False):
+ yield item, {}
def check_cisco_temperature(item, params, parsed):
if item in parsed:
+ if parsed[item].get("obsolete", False):
+ return 3, "This sensor is obsolete, please rediscover"
if type(parsed[item]) == tuple:
return parsed[item]
else: