Module: check_mk
Branch: master
Commit: d0309f31c890c4abe61b9bd9d392275621d31831
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d0309f31c890c4…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Tue Mar 24 10:57:54 2015 +0100
aix_sap_processlist: check now displays start time and elapsed time of processes, incl.
performance data
---
checkman/aix_sap_processlist | 7 +++++++
checks/aix_sap_processlist | 19 +++++++++++++++----
web/plugins/metrics/check_mk.py | 21 +++++++++++++++++++++
3 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/checkman/aix_sap_processlist b/checkman/aix_sap_processlist
index 5cab3d7..7dc6c6d 100644
--- a/checkman/aix_sap_processlist
+++ b/checkman/aix_sap_processlist
@@ -8,8 +8,15 @@ description:
Application Server on AIX systems. The check requires the mk_sap.aix
agent plugin to be installed on your AIX system.
+ The check uses the status information retrieved from the device to determine
+ the state of the service. In addition it shows the start time of the
+ process and the elapsed time since then.
+
item:
The description and instance number of each process.
inventory:
One service is created for each discovered process on each instance.
+
+perfdata:
+ The runtime of the process.
diff --git a/checks/aix_sap_processlist b/checks/aix_sap_processlist
index 9c12159..f30099b 100644
--- a/checks/aix_sap_processlist
+++ b/checks/aix_sap_processlist
@@ -50,9 +50,15 @@ def parse_aix_sap_processlist(info):
instance = line[0][1:-1]
elif instance and line[0].startswith("FAIL:"):
instance = None
- elif instance and len(line) >= 7 and line[-1] != " pid":
+ elif instance and len(line) == 7 and line[-1] != " pid":
+ description, status, textstatus, start = map(lambda x: re.sub("^
","",x), line[1:5])
+ start_time = time.strptime(start, "%Y %m %d %H:%M:%S")
+ new_info.append([instance, description, status, textstatus, start_time])
+ elif instance and len(line) == 9:
description, status, textstatus = map(lambda x: re.sub("^
","",x), line[1:4])
- new_info.append([instance, description, status, textstatus])
+ start = re.sub("^ ","",line[6])
+ start_time = time.strptime(start, "%Y %m %d %H:%M:%S")
+ new_info.append([instance, description, status, textstatus, start_time])
return new_info
def inventory_aix_sap_processlist(info):
@@ -61,16 +67,20 @@ def inventory_aix_sap_processlist(info):
yield item, None
def check_aix_sap_processlist(item, _no_params, info):
+ now = time.time()
for line in info:
if item == "%s on Instance %s" % (line[1], line[0]):
- infotext = line[3]
+ start = time.strftime("%c", line[4])
+ elapsed = now - time.mktime(line[4])
+ infotext = "%s, Start Time: %s, Elapsed Time: %s" % (line[3],
start, get_age_human_readable(elapsed))
+ perfdata = [ ("runtime", elapsed) ]
if line[2] == "GREEN":
state = 0
elif line[2] == "YELLOW":
state = 1
else:
state = 2
- return state, infotext
+ return state, infotext, perfdata
check_info["aix_sap_processlist"] = {
@@ -78,4 +88,5 @@ check_info["aix_sap_processlist"] = {
'check_function' : check_aix_sap_processlist,
'parse_function' : parse_aix_sap_processlist,
'service_description' : 'SAP Process %s',
+ 'has_perfdata' : True,
}
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index 0b0bc97..6b8f4c9 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -191,6 +191,12 @@ metric_info["uptime"] = {
"color" : "#80f000",
}
+metric_info["runtime"] = {
+ "title" : _("Process Runtime"),
+ "unit" : "s",
+ "color" : "#80f000",
+}
+
metric_info["hit_ratio"] = {
"title" : _("Cache hit ratio"),
"unit" : "ratio",
@@ -710,6 +716,7 @@ check_metrics["check_mk-blade_bx_load"]
= {}
check_metrics["check_mk-cpu.threads"] = {}
check_metrics["check_mk-mem.linux"] = {}
+check_metrics["check_mk-aix_sap_processlist"] = {}
check_metrics["check_mk-aix_memory"] = {
"ramused" : { "name" : "mem_used", "scale": MB },
"swapused" : { "name" : "swap_used", "scale": MB
}}
check_metrics["check_mk-mem.win"] = {
"memory" : { "name" : "mem_used", "scale" : MB },
"pagefile" : { "name" : "pagefile_used", "scale" :
MB }}
@@ -880,6 +887,13 @@ perfometer_info.append({
"exponent" : 2,
})
+perfometer_info.append({
+ "type" : "logarithmic",
+ "metric" : "runtime",
+ "half_value" : 864000.0,
+ "exponent" : 2,
+})
+
perfometer_info.append(("logarithmic", ( "rta", 0.1, 4)))
perfometer_info.append(("linear", ( ["execution_time"], 90.0,
None)))
perfometer_info.append(("logarithmic", ( "load1", 4.0,
2.0)))
@@ -1039,6 +1053,13 @@ graph_info.append({
})
graph_info.append({
+ "title" : _("Process Runtime"),
+ "metrics" : [
+ ( "runtime", "area" ),
+ ]
+})
+
+graph_info.append({
"title" : _("CPU Load - %(load1:max@count) CPU Cores"),
"metrics" : [
( "load1", "area" ),