Module: check_mk
Branch: master
Commit: 7491733b3ade3f843675d8ae20ba0a5c0d33ef31
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7491733b3ade3f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 25 14:28:01 2014 +0200
FIX Availability: optionally show time stamps as UNIX epoch time
This makes it easier to compare availability timeline with actual log files.
---
.werks/991 | 8 ++++++++
ChangeLog | 3 +++
web/plugins/views/availability.py | 16 +++++++++++++++-
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/.werks/991 b/.werks/991
new file mode 100644
index 0000000..9b66400
--- /dev/null
+++ b/.werks/991
@@ -0,0 +1,8 @@
+Title: Availability: optionally show time stamps as UNIX epoch time
+Level: 1
+Component: reporting
+Version: 1.2.5i5
+Date: 1403699249
+Class: fix
+
+This makes it easier to compare availability timeline with actual log files.
diff --git a/ChangeLog b/ChangeLog
index b99d457..2db9072 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
WATO:
* 0990 FIX: Fix HTTP error handling in bulk inventory...
+ Reporting & Availability:
+ * 0991 FIX: Availability: optionally show time stamps as UNIX epoch time...
+
Livestatus:
* 0988 FIX: livedump: Fix exception in case no contact groups are defined for a
service
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 9d211c3..93dd5a9 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -397,6 +397,16 @@ avoption_entries = [
),
# Format of numbers
+ ( "dateformat",
+ "single",
+ DropdownChoice(
+ title = _("Format time stamps as"),
+ choices = [
+ ("yyyy-mm-dd hh:mm:ss", _("YYYY-MM-DD HH:MM:SS") ),
+ ("epoch", _("Unix Timestamp (Epoch)") ),
+ ],
+ )
+ ),
( "timeformat",
"single",
DropdownChoice(
@@ -491,6 +501,7 @@ def render_availability_options():
"host_down" : True,
"unmonitored" : True,
},
+ "dateformat" : "yyyy-mm-dd hh:mm:ss",
"timeformat" : "percentage_2",
"labelling" : [],
"rangespec" : "d0",
@@ -826,7 +837,10 @@ def render_timeline(timeline_rows, from_time, until_time,
considered_duration,
if time.localtime(from_time)[:3] != time.localtime(until_time-1)[:3]:
format = "%Y-%m-%d " + format
def render_date(ts):
- return time.strftime(format, time.localtime(ts))
+ if avoptions["dateformat"] == "epoch":
+ return str(int(ts))
+ else:
+ return time.strftime(format, time.localtime(ts))
if type(timeline) == tuple:
tl_site, tl_host, tl_service = timeline