Module: check_mk
Branch: master
Commit: 806bcfd57f093d7d5c273ae68dc78128030cc10b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=806bcfd57f093d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Sep 17 12:05:29 2012 +0200
Downtimes: new conveniance function for downtime from now for ___ minutes.
---
ChangeLog | 2 ++
web/plugins/views/commands.py | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9155cae..fb2b69f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -105,6 +105,8 @@
* FIX: fixed logwatch loosing the master_url parameter in distributed setups
* FIX: Fixed doubled var "site" in view editor (site and siteopt filter)
* FIX: Don't crash on requests without User-Agent HTTP header
+ * Downtimes: new conveniance function for downtime from now for ___ minutes.
+ This is especially conveniant for scripting.
Livecheck:
* FIX: Compile livecheck also if diet libc is missing
diff --git a/web/plugins/views/commands.py b/web/plugins/views/commands.py
index 4ad52c4..5fa9df4 100644
--- a/web/plugins/views/commands.py
+++ b/web/plugins/views/commands.py
@@ -335,6 +335,18 @@ def command_downtime(cmdtag, spec, row):
down_to = time.mktime((br.tm_year, 12, 31, 23, 59, 59, 0, 0, br.tm_isdst)) + 1
title = _("<b>schedule an immediate downtime until end of %d</b>
on") % br.tm_year
+ elif html.var("_down_from_now"):
+ try:
+ minutes = int(html.var("_down_minutes"))
+ except:
+ minutes = 0
+
+ if minutes <= 0:
+ raise MKUserError("_down_minutes", _("Please enter a positive
number of minutes."))
+
+ down_to = time.time() + minutes * 60
+ title = _("<b>schedule an immediate downtime for the next %d
minutes</b> on" % minutes)
+
elif html.var("_down_custom"):
down_from = html.get_datetime_input("_down_from")
down_to = html.get_datetime_input("_down_to")
@@ -395,6 +407,11 @@ multisite_commands.append({
html.write(" "+_('to')+" ") == \
html.datetime_input("_down_to", time.time() + 7200) == \
html.write("<hr>") == \
+ html.button("_down_from_now", _("From now for")) == \
+ html.write(" ") == \
+ html.number_input("_down_minutes", 60, size=4, style="text-align:
right") == \
+ html.write(" " + _("minutes")) == \
+ html.write("<hr>") == \
html.checkbox("_down_flexible", False, label=_('flexible with max.
duration')+" ") == \
html.time_input("_down_duration", 2, 0) == \
html.write(" "+_('(HH:MM)')) == \