[icinga-checkins] icinga.org: icinga-core/r1.6: classic ui: add is_in_effect and trigger_time to downtime view for html, csv, json #2538 - MF
git at icinga.org
git at icinga.org
Sat Apr 28 11:11:39 CEST 2012
Module: icinga-core
Branch: r1.6
Commit: 0f00b9a1d142a0342c6589ddb03aa9da303ed7dd
URL: https://git.icinga.org/?p=icinga-core.git;a=commit;h=0f00b9a1d142a0342c6589ddb03aa9da303ed7dd
Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date: Sun Apr 22 23:29:22 2012 +0200
classic ui: add is_in_effect and trigger_time to downtime view for html, csv, json #2538 - MF
thanks to ricardo's generic cgi rewrite,
this is pretty much straightforward.
refs #2538
Conflicts:
Changelog
Changelog_json
---
Changelog | 2 ++
Changelog_json | 5 ++++-
cgi/extinfo.c | 16 +++++++++++++++-
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/Changelog b/Changelog
index 2ba5091..d0760e2 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,8 @@ Thanks to all contributers, testers and developers. Please read AUTHORS and THAN
ENHANCEMENTS
* core: add trigger_time to downtimes to allow calculating of flexible downtimes endtime #2537 - MF
+* classic ui: add is_in_effect and trigger_time to downtime view for html, csv, json #2538 - MF
+
FIXES
* core: add trigger_time to downtimes to allow calculating of flexible downtimes endtime #2537 - MF
diff --git a/Changelog_json b/Changelog_json
index abee68e..6ac2be9 100644
--- a/Changelog_json
+++ b/Changelog_json
@@ -2,6 +2,9 @@
Classic-UI JSON Change Log
#######################
+1.6.2
+* add is_in_effect and trigger_time to downtime output #2538
+
1.6.0 - only values added, no existing values changed
* add more info of (ack, downtime, ... ) status to json export in status.cgi (ivo) #1988
@@ -11,4 +14,4 @@ Classic-UI JSON Change Log
* added all vars which are necessary to calculate number of hosts and services in different states
1.4.0
-* initial version
\ No newline at end of file
+* initial version
diff --git a/cgi/extinfo.c b/cgi/extinfo.c
index 62273c8..7d28100 100644
--- a/cgi/extinfo.c
+++ b/cgi/extinfo.c
@@ -3102,7 +3102,9 @@ void show_downtime(int type) {
printf("%sSTART_TIME%s%s", csv_data_enclosure, csv_data_enclosure, csv_delimiter);
printf("%sEND_TIME%s%s", csv_data_enclosure, csv_data_enclosure, csv_delimiter);
printf("%sTYPE%s%s", csv_data_enclosure, csv_data_enclosure, csv_delimiter);
+ printf("%sTRIGGER_TIME%s%s", csv_data_enclosure, csv_data_enclosure, csv_delimiter);
printf("%sDURATION%s%s", csv_data_enclosure, csv_data_enclosure, csv_delimiter);
+ printf("%sIS_IN_EFFECT%s%s", csv_data_enclosure, csv_data_enclosure, csv_delimiter);
printf("%sDOWNTIME_ID%s%s", csv_data_enclosure, csv_data_enclosure, csv_delimiter);
printf("%sTRIGGER_ID%s\n", csv_data_enclosure, csv_data_enclosure);
}
@@ -3137,7 +3139,7 @@ void show_downtime(int type) {
if (type == SERVICE_DOWNTIME)
printf("<TH CLASS='downtime'>Service</TH>");
}
- printf("<TH CLASS='downtime'>Entry Time</TH><TH CLASS='downtime'>Author</TH><TH CLASS='downtime'>Comment</TH><TH CLASS='downtime'>Start Time</TH><TH CLASS='downtime'>End Time</TH><TH CLASS='downtime'>Type</TH><TH CLASS='downtime'>Duration</TH><TH CLASS='downtime'>Downtime ID</TH><TH CLASS='downtime'>Trigger ID</TH><TH CLASS='comment' nowrap>Actions <input type='checkbox' value='all' onclick=\"checkAll(\'tableform%sdowntime\');isValidForSubmit(\'tableform%sdowntime\');\"></TH></TR>\n", (type == HOST_DOWNTIME) ? "host" : "service", (type == HOST_DOWNTIME) ? "host" : "service");
+ printf("<TH CLASS='downtime'>Entry Time</TH><TH CLASS='downtime'>Author</TH><TH CLASS='downtime'>Comment</TH><TH CLASS='downtime'>Start Time</TH><TH CLASS='downtime'>End Time</TH><TH CLASS='downtime'>Type</TH><TH CLASS='downtime'>Trigger Time</TH><TH CLASS='downtime'>Duration</TH><TH CLASS='downtime'>Is in effect</TH><TH CLASS='downtime'>Downtime ID</TH><TH CLASS='downtime'>Trigger ID</TH><TH CLASS='comment' nowrap>Actions <input type='checkbox' value='all' onclick=\"checkAll(\'tableform%sdowntime\');isValidForSubmit(\'tableform%sdowntime\');\"></TH></TR>\n", (type == HOST_DOWNTIME) ? "host" : "service", (type == HOST_DOWNTIME) ? "host" : "service");
}
/* display all the downtime */
@@ -3256,17 +3258,29 @@ void show_downtime(int type) {
printf("<td CLASS='%s'>%s</td>", bg_class, (temp_downtime->fixed == TRUE) ? "Fixed" : "Flexible");
}
+ get_time_string(&temp_downtime->trigger_time, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
+ if (content_type == JSON_CONTENT) {
+ printf("\"trigger_time\": \"%s\", ", date_time);
+ } else if (content_type == CSV_CONTENT) {
+ printf("%s%s%s%s", csv_data_enclosure, date_time, csv_data_enclosure, csv_delimiter);
+ } else {
+ printf("<td CLASS='%s'>%s</td>", bg_class, date_time);
+ }
+
get_time_breakdown(temp_downtime->duration, &days, &hours, &minutes, &seconds);
if (content_type == JSON_CONTENT) {
printf("\"duration\": \"%dd %dh %dm %ds\", ", days, hours, minutes, seconds);
+ printf("\"is_in_effect\": %lu, ", temp_downtime->is_in_effect);
printf("\"downtime_id\": %lu, ", temp_downtime->downtime_id);
printf("\"trigger_id\": \"");
} else if (content_type == CSV_CONTENT) {
printf("%s%dd %dh %dm %ds%s%s", csv_data_enclosure, days, hours, minutes, seconds, csv_data_enclosure, csv_delimiter);
+ printf("%s%lu%s%s", csv_data_enclosure, temp_downtime->is_in_effect, csv_data_enclosure, csv_delimiter);
printf("%s%lu%s%s", csv_data_enclosure, temp_downtime->downtime_id, csv_data_enclosure, csv_delimiter);
printf("%s", csv_data_enclosure);
} else {
printf("<td CLASS='%s'>%dd %dh %dm %ds</td>", bg_class, days, hours, minutes, seconds);
+ printf("<td CLASS='%s'>%lu</td>", bg_class, temp_downtime->is_in_effect);
printf("<td CLASS='%s'>%lu</td>", bg_class, temp_downtime->downtime_id);
printf("<td CLASS='%s'>", bg_class);
}
More information about the icinga-checkins
mailing list