Module: check_mk
Branch: master
Commit: 1d4179a02c2fd81ef79cbae1c4807cfd847c9b7e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1d4179a02c2fd8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 18 15:32:39 2016 +0100
#2902 Hosts can now be added by regular network scans of configured IP ranges
For each WATO folder a new attribute <i>Network Scan</i> can now be configured.
This network scan will ping all IP addresses in all configured IP ranges in the
configured interval for new reachable hosts / IP addresses.
When such a network scan of a folder discovers a new host, the discovery mechanism
tries to resolve the host name via DNS. If found, it uses the DNS name as hostname.
Otherwise the IP address will be used as host name. Then it will be created as new
host and added to this folder.
Hosts found by the network scan are added as disabled host. You can enable monitoring
of these hosts by setting the <i>Criticality</i> host tag of this host to another
value. Additionally you may want to configure other attributes like the agent type
of this host before adding it to your regular monitoring.
If you want to exclude a found host from your monitoring, add the IP address to the
list of excluded IP addresses and then delete the found host from this folder.
The result of a network scan is written to the <i>Last Scan Result<i> attribute
of a folder. So if you like to know when the last scan for a folder was performed,
take a look at that folders properties.
If you experience issues with the network scan, take a look at the log of the Web GUI
(<tt>var/log/web.log</tt>).
---
.werks/2902 | 31 +++
ChangeLog | 1 +
web/htdocs/wato.py | 321 +++++++++++++++++++++++++++++---
web/htdocs/watolib.py | 60 +++++-
web/plugins/cron/network_scan.py | 29 +++
web/plugins/wato/builtin_attributes.py | 163 ++++++++++++++++
6 files changed, 568 insertions(+), 37 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=1d4179a02c…
Module: check_mk
Branch: master
Commit: c4ae1a7163a3c0fd91ad8e75d74b48fc66b090fe
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c4ae1a7163a3c0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 15 16:46:51 2016 +0100
Improved error handling of web cron jobs (exceptions are logged to web.log now)
---
web/htdocs/cron.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/web/htdocs/cron.py b/web/htdocs/cron.py
index e98dd1e..7812478 100644
--- a/web/htdocs/cron.py
+++ b/web/htdocs/cron.py
@@ -49,6 +49,9 @@ def load_plugins(force):
# Page called by some external trigger (usually cron job in OMD site)
# Note: this URL is being called *without* any login. We have no
# user. Everyone can call this! We must not read any URL variables.
+#
+# There is no output written to the user in regular cases. Exceptions
+# are written to the web log.
def page_run_cron():
now = time.time()
# Prevent cron jobs from being run too often, also we need
@@ -61,4 +64,10 @@ def page_run_cron():
aquire_lock(lock_file)
for cron_job in multisite_cronjobs:
- cron_job()
+ try:
+ cron_job()
+ except Exception, e:
+ html.write("An exception occured. Take a look at the web.log.\n")
+ import traceback
+ logger(LOG_ERR, "Exception in cron_job [%s]:\n%s" %
+ (cron_job.__name__, traceback.format_exc()))
Module: check_mk
Branch: master
Commit: 14e32860bc378b16d6724d9e1da5b7717f14c126
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=14e32860bc378b…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Jan 18 11:21:14 2016 +0100
#2826 FIX Disabled BI Aggregations no longer causing crashes when using "Precompile aggregations on demand"
This fixes the error <i>AttributeError: class DISABLED has no attribute 'lower'</i>, which is shown in
the BI sidebar snapin or written to the file <i>~/var/log/web.log</i>.
Because of this bug most of the aggregation views were empty.
---
.werks/2826 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/bi.py | 2 ++
3 files changed, 15 insertions(+)
diff --git a/.werks/2826 b/.werks/2826
new file mode 100644
index 0000000..22d1bee
--- /dev/null
+++ b/.werks/2826
@@ -0,0 +1,12 @@
+Title: Disabled BI Aggregations no longer causing crashes when using "Precompile aggregations on demand"
+Level: 2
+Component: bi
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i4
+Date: 1453112096
+
+This fixes the error <i>AttributeError: class DISABLED has no attribute 'lower'</i>, which is shown in
+the BI sidebar snapin or written to the file <i>~/var/log/web.log</i>.
+Because of this bug most of the aggregation views were empty.
diff --git a/ChangeLog b/ChangeLog
index 73be677..f0e7912 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -258,6 +258,7 @@
BI:
* 2882 Reorganize BI configuration into packs, add contacts and permissions...
+ * 2826 FIX: Disabled BI Aggregations no longer causing crashes when using "Precompile aggregations on demand"...
Reporting & Availability:
* 2823 FIX: Availability: Fixed division by zero error on rendering the availability table
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 2d6f37e..0ab83f8 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -179,6 +179,8 @@ def aggregation_groups():
# on demand: show all configured groups
group_names = set([])
for a in config.aggregations + config.host_aggregations:
+ if a[0] == config.DISABLED:
+ continue
if type(a[0]) == list:
group_names.update(a[0])
else:
Module: check_mk
Branch: master
Commit: b673ffc6d49c8564dc95a84994d800d1e32d9349
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b673ffc6d49c85…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jan 18 10:51:05 2016 +0100
WATO BI: prevent deletion of rules that are in use
The delete button was already correctly removed in that case,
we just address the rare case of URI modifications or race
conditions
---
web/plugins/wato/bi.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/web/plugins/wato/bi.py b/web/plugins/wato/bi.py
index add024d..e512195 100644
--- a/web/plugins/wato/bi.py
+++ b/web/plugins/wato/bi.py
@@ -1061,6 +1061,11 @@ class ModeBIRules(ModeBI):
self.must_be_contact_for_pack()
if html.var("_del_rule"):
ruleid = html.var("_del_rule")
+ aggr_refs, rule_refs, level = self.count_rule_references(ruleid)
+ if aggr_refs:
+ raise MKUserError(None, _("You cannot delete this rule: it is still used by aggregations."))
+ if rule_refs:
+ raise MKUserError(None, _("You cannot delete this rule: it is still used by other rules."))
c = wato_confirm(_("Confirm rule deletion"),
_("Do you really want to delete the rule with "
"the id <b>%s</b>?") % ruleid)
@@ -1112,7 +1117,7 @@ class ModeBIRules(ModeBI):
tree_url = html.makeuri([("mode", "bi_rule_tree"), ("id", ruleid)])
html.icon_button(tree_url, _("This is a top-level rule. Show rule tree"), "bitree")
if refs == 0:
- delete_url = html.makeactionuri([("mode", "bi_rules"), ("_del_rule", ruleid)])
+ delete_url = html.makeactionuri_contextless([("mode", "bi_rules"), ("_del_rule", ruleid), ("pack", self._pack_id)])
html.icon_button(delete_url, _("Delete this rule"), "delete")
table.cell(_("Level"), level or "", css="number")
table.cell(_("ID"), '<a href="%s">%s</a>' % (edit_url, ruleid))
Module: check_mk
Branch: master
Commit: d0ae4a86f668b9dee616b3f70b722bb391f7d5ce
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d0ae4a86f668b9…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Jan 18 09:25:05 2016 +0100
#2921 printer_supply_ricoh: check now tries to handle negative readings properly
Negative values are used by the device to report "special" conditions. Unfortunately these aren't
documented so current interpretation is only based on observation.
---
.werks/2921 | 10 ++++++++++
ChangeLog | 1 +
checks/printer_supply_ricoh | 46 ++++++++++++++++++++++++++++++++-----------
3 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/.werks/2921 b/.werks/2921
new file mode 100644
index 0000000..913959e
--- /dev/null
+++ b/.werks/2921
@@ -0,0 +1,10 @@
+Title: printer_supply_ricoh: check now tries to handle negative readings properly
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453105397
+Class: feature
+
+Negative values are used by the device to report "special" conditions. Unfortunately these aren't
+documented so current interpretation is only based on observation.
diff --git a/ChangeLog b/ChangeLog
index de09450..73be677 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -83,6 +83,7 @@
* 2919 hp_webmgmt_status: New check for health status of various Hewlett-Packard devices...
* 2920 hr_cpu: this check can now also supports per-core features...
* 1322 solaris_prtdiag: New Check for Solaris Hardware State based on prtdiag
+ * 2921 printer_supply_ricoh: check now tries to handle negative readings properly...
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/checks/printer_supply_ricoh b/checks/printer_supply_ricoh
index 3f55903..7b418b7 100644
--- a/checks/printer_supply_ricoh
+++ b/checks/printer_supply_ricoh
@@ -62,6 +62,37 @@ def inventory_printer_supply_ricoh(parsed):
def check_printer_supply_ricoh(item, params, parsed):
+ def handle_regular(supply_level):
+ infotext = "%.0f%%" % supply_level
+
+ if supply_level <= crit:
+ state = 2
+ elif supply_level <= warn:
+ state = 1
+ else:
+ state = 0
+
+ if state > 0:
+ infotext += " (warn/crit at %.0f%%/%.0f%%)" % (warn, crit)
+ return state, infotext, supply_level
+
+ def handle_negative(code):
+ # the following codes are based on the MP C2800
+ if code == -100:
+ # does not apply level. Since we don't get a proper reading
+ # the best we could do would be test against 0
+ return 2, "almost empty (<10%)", 0
+ elif code == -2:
+ # cartridge removed?
+ return 3, "unknown level", 0
+ elif code == -3:
+ # -3 = full is based on user claim, but other walks also show
+ # the device itself does not alert in this state
+ return 0, "100%", 100
+ else:
+ # unknown code
+ return handle_regular(0)
+
if type(params) == tuple:
params = { "levels" : params }
@@ -70,19 +101,10 @@ def check_printer_supply_ricoh(item, params, parsed):
for name, supply_level in parsed.items():
if item == name:
if supply_level < 0:
- supply_level = 0
-
- infotext = "%.0f%%" % supply_level
-
- if supply_level <= crit:
- state = 2
- elif supply_level <= warn:
- state = 1
+ # negative levels usually have special meaning
+ state, infotext, supply_level = handle_negative(supply_level)
else:
- state = 0
-
- if state > 0:
- infotext += " (warn/crit at %.0f%%/%.0f%%)" % (warn, crit)
+ state, infotext, supply_level = handle_regular(supply_level)
if "black" in name.lower():
perf_type = "black"
Module: check_mk
Branch: master
Commit: db79bf97e2fb8e14cf6adc8cc667dbcb5c15ea86
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=db79bf97e2fb8e…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Fri Jan 15 17:18:27 2016 +0100
fixed wrong result when retrieving single oids from snmp walks in very rare cases
for this bug to occur, the following things had to be true
a) working with a snmp walk
b) the requested single oid does not exist in the walk itself ...
c) ... but has a single sub-oid
In this case the value of the sub-oid was returned instead of nothing
---
modules/check_mk.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index e8c1ad4..74361b0 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1611,7 +1611,9 @@ def get_single_oid(hostname, ipaddress, oid):
vverbose(" Getting OID %s: " % oid)
if opt_use_snmp_walk or is_usewalk_host(hostname):
walk = get_stored_snmpwalk(hostname, oid)
- if len(walk) == 1:
+ # get_stored_snmpwalk returns all oids that start with oid but here
+ # we need an exact match
+ if len(walk) == 1 and oid == walk[0][0]:
value = walk[0][1]
else:
value = None
Module: check_mk
Branch: master
Commit: 25ca0b0090761319c602aa8340ff527b081a7ae5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=25ca0b00907613…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Jan 15 16:24:13 2016 +0100
#1322 solaris_prtdiag: New Check for Solaris Hardware State based on prtdiag
---
.werks/1322 | 9 +++++
ChangeLog | 1 +
agents/check_mk_agent.solaris | 5 +++
agents/plugins/mk_inventory.solaris | 6 ----
checkman/solaris_prtdiag | 12 +++++++
checks/solaris_prtdiag | 64 +++++++++++++++++++++++++++++++++++
6 files changed, 91 insertions(+), 6 deletions(-)
diff --git a/.werks/1322 b/.werks/1322
new file mode 100644
index 0000000..8f78dc6
--- /dev/null
+++ b/.werks/1322
@@ -0,0 +1,9 @@
+Title: solaris_prtdiag: New Check for Solaris Hardware State based on prtdiag
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1452871427
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index b9a65ac..de09450 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -82,6 +82,7 @@
* 2918 agent_jolokia: jolokia can now be monitored using a special agent
* 2919 hp_webmgmt_status: New check for health status of various Hewlett-Packard devices...
* 2920 hr_cpu: this check can now also supports per-core features...
+ * 1322 solaris_prtdiag: New Check for Solaris Hardware State based on prtdiag
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 499ead4..ab79199 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -244,6 +244,11 @@ then
/usr/bin/top | grep '^Memory:'
fi
+if type prtdiag >/dev/null 2>&1
+ then
+ echo '<<<solaris_prtdiag:sep(10)>>>'
+ run_cached prtdiag 300 '/usr/sbin/prtdiag -v;echo "SerialNumber: $(sneep -t serial)";echo "PRTDIAG_OVERALL_STATE : $(echo $?)"'
+fi
# TCP Connection stats
echo '<<<tcp_conn_stats>>>'
diff --git a/agents/plugins/mk_inventory.solaris b/agents/plugins/mk_inventory.solaris
index 14d423a..222d8f4 100755
--- a/agents/plugins/mk_inventory.solaris
+++ b/agents/plugins/mk_inventory.solaris
@@ -46,12 +46,6 @@ then
echo "<<<solaris_uname:sep(61):persist($UNTIL)>>>"
uname -X
- if type prtdiag > /dev/null; then
- echo "<<<solaris_prtdiag:sep(10):persist($UNTIL)>>>"
- serial=`sneep -t serial`;echo "SerialNumber: $serial"
- prtdiag -v
- fi
-
if type psrinfo > /dev/null; then
echo "<<<solaris_psrinfo:persist($UNTIL)>>>"
psrinfo -p -v
diff --git a/checkman/solaris_prtdiag b/checkman/solaris_prtdiag
new file mode 100644
index 0000000..8db3ea9
--- /dev/null
+++ b/checkman/solaris_prtdiag
@@ -0,0 +1,12 @@
+title: Prtdiag based health check for solaris
+agents: solaris
+catalog: os/solaris
+license: GPL
+distribution: check_mk
+description:
+ This check looks for the return value of the prtdiag -v command on solaris based systems.
+ A return value of 0 is interpreted as OK as documented in the prtdiag man page. Each other return value
+ results in a CRITICAL state.
+ CAVEAT:
+ The extend of the hardware that is considered in the prtdiag command varies from solaris platform to platform (i.e. huge differences between e.g. M series and T series systems.)
+ Please have a look at the documentation of prtdiag for your system.
diff --git a/checks/solaris_prtdiag b/checks/solaris_prtdiag
new file mode 100644
index 0000000..bb73b5a
--- /dev/null
+++ b/checks/solaris_prtdiag
@@ -0,0 +1,64 @@
+#!/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:
+# .
+# .
+# .
+# SPARC64-VII mode
+#
+# PRTDIAG_OVERALL_STATE : 0
+# SerialNumber: BDF112567
+
+
+def inventory_solaris_prtdiag(info):
+ for line in info:
+ # We have to search in the agent section if we find
+ # that state
+ if line[0].startswith("PRTDIAG_OVERALL_STATE"):
+ return [(None, None)]
+
+def check_solaris_prtdiag(_no_item, _no_params, info):
+ for line in info:
+ if line[0].startswith("PRTDIAG_OVERALL_STATE"):
+ # 0 No failures or errors are detected in the system.
+ # 1 Failures or errors are detected in the system.
+ state = int(info[-1][0].split(':')[1])
+
+ # If we not find the status in the agent output, raise error
+ if state == 0:
+ return 0, "No failures or errors are detected in the system"
+ else:
+ return 2, "Failures or errors are detected in the system, please check details via prtdiag -v"
+
+check_info['solaris_prtdiag'] = {
+ "inventory_function" : inventory_solaris_prtdiag,
+ "check_function" : check_solaris_prtdiag,
+ "service_description" : "Hardware Overall State"
+}
+
+
+