Module: check_mk
Branch: master
Commit: d44140a219112bcf88adc79c84ed99239866f08b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d44140a219112b…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Sep 3 13:37:37 2015 +0200
#2568 FIX apache_status: fixed computation of bytes and requests per second
Bytes/second and Requests/second were previously averages since the start of the server and did
therefore not hold useful information about the current server load.
Now these values are "live" rates, calculated based on changes in Total Accesses and Total kBytes.
---
.werks/2568 | 12 ++++++++++++
ChangeLog | 1 +
checks/apache_status | 14 +++++++++++++-
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/.werks/2568 b/.werks/2568
new file mode 100644
index 0000000..de65a2a
--- /dev/null
+++ b/.werks/2568
@@ -0,0 +1,12 @@
+Title: apache_status: fixed computation of bytes and requests per second
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1441279892
+
+Bytes/second and Requests/second were previously averages since the start of the server and did
+therefore not hold useful information about the current server load.
+Now these values are "live" rates, calculated based on changes in Total Accesses and Total kBytes.
diff --git a/ChangeLog b/ChangeLog
index 7535d8f..509e1de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -160,6 +160,7 @@
* 2567 FIX: jolokia_metrics: fixed crash if agent output is missing memory metrics
* 2577 FIX: printer_input, printer_output: Fix exception on Brother NC-340h
* 2554 FIX: oracle_recovery_status: Fixed exception when files have no checkpoints
+ * 2568 FIX: apache_status: fixed computation of bytes and requests per second...
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce unhandled exceptions...
diff --git a/checks/apache_status b/checks/apache_status
index 344a5d9..14c2109 100644
--- a/checks/apache_status
+++ b/checks/apache_status
@@ -74,7 +74,7 @@ def apache_status_parse(info):
data = {}
for line in info:
address, port = line[:2]
- if len(line) != 4:
+ if len(line) != 4 and not (len(line) == 5 and line[2] == 'Total'):
continue # Skip unexpected lines
label = (' '.join(line[2:-1])).rstrip(':')
value = _apache_status_fields[label][1](line[-1])
@@ -115,6 +115,18 @@ def check_apache_status(item, params, info):
if item not in all_data:
return (3, 'Unable to find instance in agent output')
data_dict = all_data[item]
+
+ this_time = int(time.time())
+
+ if "Total Accesses" in data_dict:
+ data_dict["ReqPerSec"] = get_rate("apache_status_%s_accesses" % item, this_time,
+ data_dict["Total Accesses"])
+ del(data_dict["Total Accesses"])
+ if "Total kBytes" in data_dict:
+ data_dict["BytesPerSec"] = get_rate("apache_status_%s_bytes" % item, this_time,
+ data_dict["Total kBytes"] * 1024)
+ del(data_dict["Total kBytes"])
+
data = data_dict.items()
worst_state = 0
Module: check_mk
Branch: master
Commit: f6d8275447ecc5b15d81d6bd29a30b0b9144f9ed
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f6d8275447ecc5…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Sep 3 11:34:09 2015 +0200
#2567 FIX jolokia_metrics: fixed crash if agent output is missing memory metrics
---
.werks/2567 | 10 ++++++++++
ChangeLog | 1 +
checks/jolokia_metrics | 9 +++++++++
3 files changed, 20 insertions(+)
diff --git a/.werks/2567 b/.werks/2567
new file mode 100644
index 0000000..39d3a09
--- /dev/null
+++ b/.werks/2567
@@ -0,0 +1,10 @@
+Title: jolokia_metrics: fixed crash if agent output is missing memory metrics
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1441272789
+
+
diff --git a/ChangeLog b/ChangeLog
index a818cc6..8c4ffcf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -157,6 +157,7 @@
* 2566 FIX: ups_modulys_battery.temp: fixed missing manpage
* 2585 FIX: include file for elecritcal phases handles warn/crit levels correct
* 2576 FIX: symantec_av_updates: fix crash due to missing datetime module, also handle DD.MM.YYYY date format
+ * 2567 FIX: jolokia_metrics: fixed crash if agent output is missing memory metrics
* 2577 FIX: printer_input, printer_output: Fix exception on Brother NC-340h
Multisite:
diff --git a/checks/jolokia_metrics b/checks/jolokia_metrics
index 2f06d7f..f0c22a9 100644
--- a/checks/jolokia_metrics
+++ b/checks/jolokia_metrics
@@ -142,6 +142,10 @@ def inventory_jolokia_metrics(info, what):
for instance, data in parsed.items():
if what == 'uptime' and "Uptime" not in data:
continue
+ if what == 'mem' and ("HeapMemoryUsage" not in data or "NonHeapMemoryUsage" not in data
+ or "HeapMemoryMax" not in data or "NonHeapMemoryMax" not in data):
+ # don't add memory check if we don't have the necessary data
+ continue
yield instance, levels
@@ -259,6 +263,11 @@ def check_jolokia_metrics_mem(item, params, info):
d = parsed[item]
mb = 1024 * 1024.0
+
+ if "HeapMemoryUsage" not in d or "NonHeapMemoryUsage" not in d\
+ or "HeapMemoryMax" not in d or "NonHeapMemoryMax" not in d:
+ return 3, "data in agent output incomplete"
+
heap = saveint(d["HeapMemoryUsage"]) / mb
heapmax = saveint(d.get("HeapMemoryMax",-1)) / mb
nonheap = saveint(d["NonHeapMemoryUsage"]) / mb