Module: check_mk
Branch: master
Commit: a461ae2f4841877fdbeaf423cfe3f4c01547b7e6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a461ae2f484187…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 31 18:10:18 2011 +0200
BI: error handling of unused variables
---
ChangeLog | 3 ---
web/htdocs/bi.py | 13 +++++++++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6b2c7fe..b23ebd2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,9 +17,6 @@
BI:
* Added new component BI to Multisite.
- * New third argument for worst and best: the worst possible
- state (see docu)
- * Make PENDING be slightly worst than OK
WATO:
* Allow moving hosts from one to another config file
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index c032fc3..b7a036a 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -272,10 +272,13 @@ def compile_aggregation(rule, args, lvl = 0):
# value for all SINGLE arguments
groups = {}
+ used_parameters = set([])
single_names = [ varname for (varname, (expansion, value)) in arginfo.items() if expansion == SINGLE ]
for instargs, node in elements:
# Honor that some variables might be unused and thus not contained in instargs
key = tuple([ (varname, instargs[varname]) for varname in single_names if varname in instargs ])
+ for var in instargs:
+ used_parameters.add(var)
nodes = groups.get(key, [])
nodes.append(node)
groups[key] = nodes
@@ -375,6 +378,7 @@ def compile_aggregation(rule, args, lvl = 0):
while bilateral_mergegroups(groups):
pass
+
# Check for unmergeable entries, fill up missing values
# from parameters (assuming they are not regexes)
for ikey, inodes in groups.items():
@@ -386,6 +390,15 @@ def compile_aggregation(rule, args, lvl = 0):
newkey = tuple(d.items())
groups[newkey] = inodes
del groups[ikey]
+
+ # track unused parameters - if we are not empty anyway
+ if len(groups) > 0:
+ for var in single_names:
+ if var not in used_parameters:
+ raise MKConfigError("<h1>Invalid rule</h1>"
+ "The rule '<tt>%s</tt>' never uses the variable '<tt>%s</tt>'.<br>"
+ "This is not allowed. All singleton parameters must be used in the rule." \
+ % (description, var))
# now sort groups after instantiations
def cmp_group(a, b):
Module: check_mk
Branch: master
Commit: 62bb065dee91b3b030b5286dc75b6e3f5087d60a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=62bb065dee91b3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 31 12:25:39 2011 +0200
Updated bug entries
---
.bugs/223 | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/.bugs/223 b/.bugs/223
new file mode 100644
index 0000000..c77bb2c
--- /dev/null
+++ b/.bugs/223
@@ -0,0 +1,12 @@
+Title: Service search and PNP search should be linked
+Component: multisite
+Benefit: 3
+State: open
+Cost: 2
+Date: 2011-03-31 12:24:42
+Class: feature
+
+When you make service service and find some services,
+then you should be able to press a button and go to
+the view with the PNP search - that way viewing the
+graphs of the found services.
Module: check_mk
Branch: master
Commit: f4fedf1ce91192ecdfa0473589e8740c35a91692
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f4fedf1ce91192…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 31 09:25:43 2011 +0200
if/if64: also show perf-o-meter if speed is unknown
---
ChangeLog | 7 ++++---
web/plugins/perfometer/check_mk.py | 5 +++--
web/plugins/views/perfometer.py | 12 ++++++++++++
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 58d78af..6b2c7fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,12 +36,13 @@
* FIX: mk_logwatch: improve implementation in order to save RAM
* FIX: mk_oracle: Updated tablespace query to use 'used blocks' instead of 'user blocks'
* FIX: bluecoat_sensors: Using scale parameter provided by the host for reported values
+ * FIX: fjdarye60_devencs, fjdarye60_disks.summary: added snmp scan functions
+ * FIX: decru_*: added snmp scan functions
* printer_supply: Changed order of tests. When a printer reports -3 this
is used before the check if maxlevel is -2.
* printer_supply: Skipping inventory of supplies which have current value
and maxlevel both set to -2.
* cisco_locif: The check has been removed. Please switch to if/if64
- * if/if64: scan function now also detects devices where the first port
has not the index 1
* cisco_temp/cisco_temp_perf: scan function handles sensors not beginning
with index 1
@@ -50,8 +51,6 @@
* printer_alerts: Added new check for monitoring alert states reported by
printers using the PRINTER-MIB
* diskstat: rewritten check: now show different devices, r+w in one check
- * FIX: fjdarye60_devencs, fjdarye60_disks.summary: added snmp scan functions
- * FIX: decru_*: added snmp scan functions
* canon_pages: Added new check for monitoring processed pages on canon
printer/multi-function devices
* strem1_sensors: added check to monitor sensors attached to Sensatorinc EM1 devices
@@ -61,6 +60,8 @@
* lnx_if: new check for Linux NICs compatible with if/if64 replacing
netif.* and netctr.
* if/if64: also output performance data if operstate not as expected
+ * if/if64: scan function now also detects devices where the first port
+ * if/if64: also show perf-o-meter if speed is unknown
1.1.10:
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index c8bb4e2..454170e 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -220,10 +220,11 @@ def performeter_check_mk_if(row, check_command, perf_data):
in_bytes = savefloat(perf_data[0][1])
out_bytes = savefloat(perf_data[5][1])
MB = 1000000.0
- text = "%.1fM/s %.1fM/s" % (in_bytes/MB, out_bytes/MB)
+ text = "%s/s %s/s" % (
+ number_human_readable(in_bytes), number_human_readable(out_bytes))
return text, perfometer_logarithmic_dual(
- in_bytes, "#0e6", out_bytes, "#2af", 1000000, 10)
+ in_bytes, "#0e6", out_bytes, "#2af", 1000000, 5)
perfometers["check_mk-if"] = performeter_check_mk_if
perfometers["check_mk-if64"] = performeter_check_mk_if
diff --git a/web/plugins/views/perfometer.py b/web/plugins/views/perfometer.py
index 2fdac40..f05040f 100644
--- a/web/plugins/views/perfometer.py
+++ b/web/plugins/views/perfometer.py
@@ -89,6 +89,18 @@ def perfometer_logarithmic_dual(value_left, color_left, value_right, color_right
return result + '</tr></table>'
+def number_human_readable(n):
+ n = float(n)
+ if abs(n) > 1024 * 1024 * 1024:
+ return "%.1fG" % (n / (1024.0 * 1024 * 1024))
+ elif abs(n) > 1024 * 1024:
+ return "%.1fM" % (n / (1024.0 * 1024))
+ elif abs(n) > 1024:
+ return "%.fK" % (n / 1024.0)
+ else:
+ return "%.1fB" % n
+
+
perfometer_plugins_dir = defaults.web_dir + "/plugins/perfometer"
for fn in os.listdir(perfometer_plugins_dir):
if fn.endswith(".py"):