Module: check_mk
Branch: master
Commit: e45fca05c09f9befc5ce51f8f1e523a368efdb90
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e45fca05c09f9b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Feb 4 17:37:55 2015 +0100
Further fix in LANTIME checks
---
checks/mbg_lantime.include | 6 +++---
web/htdocs/lib.py | 10 +++++++---
web/htdocs/metrics.py | 1 +
web/plugins/metrics/check_mk.py | 18 +++++++++++++++++-
4 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/checks/mbg_lantime.include b/checks/mbg_lantime.include
index 1a94b86..639350e 100644
--- a/checks/mbg_lantime.include
+++ b/checks/mbg_lantime.include
@@ -27,7 +27,7 @@
factory_settings['mbg_lantime_state_default_levels'] = {
"stratum" : (1, 1),
- "offset" : (500, 1000), # ms
+ "offset" : (500, 1000), # us
}
@@ -72,7 +72,7 @@ def check_mbg_lantime_state_common(states, _no_item, params, info):
elif pos_refclock_offset >= warn:
state = 1
if state != 0:
- levels_text = " (warn/crit at %d/%d ms)" % (warn, crit)
- perfdata = [('offset', refclock_offset, warn, crit )]
+ levels_text = " (warn/crit at %d/%d us)" % (warn, crit)
+ perfdata = [('offset', refclock_offset, warn * 1000, crit * 1000)] # all in
us
yield state, 'Reference clock offset: %g us%s' % (refclock_offset,
levels_text), perfdata
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index f4b3bda..61a6d56 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -452,12 +452,16 @@ def number_human_readable(n, precision=1, unit="B"):
return (f + "%s") % (n, unit)
def age_human_readable(secs, min_only=False):
- if min_only:
+ if secs > 0 and secs < 0.0001: # us
+ return "%.1f us" % (secs * 1000000)
+ elif secs > 0 and secs < 1: # ms
+ return "%.2f ms" % (secs * 1000)
+ elif min_only:
mins = secs / 60.0
return "%.1f %s" % (mins, _("min"))
- if secs < 10:
+ elif secs < 10:
return "%.2f %s" % (secs, _("sec"))
- if secs < 60:
+ elif secs < 60:
return "%.1f %s" % (secs, _("sec"))
elif secs < 240:
return "%d %s" % (secs, _("sec"))
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 3941cce..0f849e0 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -348,6 +348,7 @@ def output_pnp_graph(graph, host_name, service_desc,
translated_metrics):
unit = unit_info[mi["unit"]]
rrd = rrd_path(host_name, service_desc,
translated_metrics[metric_name]["orig_name"])
rrdgraph_commands += "DEF:%s=%s:1:MAX " % (metric_name, rrd)
+ # TODO: Hier muss noch die Skalierung rein!!!
rrdgraph_commands += "%s:%s%s:\"%s\"%s " % (draw_type,
metric_name, mi["color"], ("%-20s" % mi["title"]),
draw_stack)
rrdgraph_commands += "GPRINT:%s:AVERAGE:\"avg\\: %%8.2lf %s\"
" % (metric_name, unit["symbol"].replace("%", "%%"))
rrdgraph_commands += "GPRINT:%s:MAX:\"max\\: %%8.2lf %s\" "
% (metric_name, unit["symbol"].replace("%", "%%"))
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index cd86fbd..7f84a73 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -136,7 +136,6 @@ metric_info["swap_free"] = {
"color" : "#eeeeee",
}
-
metric_info["execution_time"] = {
"title" : _("Execution time"),
"unit" : "s",
@@ -206,6 +205,13 @@ metric_info["io_wait"] = {
"color" : "#00b0c0",
}
+metric_info["time_offset"] = {
+ "title" : _("Time offset"),
+ "unit" : "s",
+ "color" : "#9a52bf",
+}
+
+
#.
# .--Checks--------------------------------------------------------------.
# | ____ _ _ |
@@ -299,6 +305,9 @@ check_metrics["check_mk-vms_cpu"]
= { "wait" : { "
check_metrics["check_mk-ucd_cpu_util"] = {
"wait" : { "name" : "io_wait" } }
check_metrics["check_mk-lparstat_aix.cpu_util"] = {
"wait" : { "name" : "io_wait" } }
+check_metrics["check_mk-mbg_lantime_state"] = {
"offset" : { "name" : "time_offset", "scale" :
0.000001 }} # convert us -> sec
+check_metrics["check_mk-mbg_lantime_nb_state"] = {
"offset" : { "name" : "time_offset", "scale" :
0.000001 }} # convert us -> sec
+
#.
# .--Perf-O-Meters-------------------------------------------------------.
# | ____ __ ___ __ __ _ |
@@ -322,6 +331,7 @@ perfometer_info.append(("stacked", ( [
"user", "system", "io_wait" ],
perfometer_info.append(("stacked", ( [ "fs_used(%)" ],
100.0, None)))
perfometer_info.append(("stacked", ( [ "mem_used",
"swap_used", "caches", "mem_free", "swap_free" ],
None, ("mem_total,mem_used,swap_used,+,/", "100%"))))
perfometer_info.append(("stacked", ( [ "mem_used" ],
"mem_total", None)))
+perfometer_info.append(("logarithmic", ( "time_offset", 1.0,
10.0)))
#.
@@ -351,3 +361,9 @@ graph_info.append({
( "io_wait", "stack" ),
]
})
+
+graph_info.append({
+ "metrics" : [
+ ( "time_offset", "area" ),
+ ]
+})