[icinga-checkins] icinga.org: icinga-core/dev/ido: 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
Tue Apr 24 17:31:20 CEST 2012


Module: icinga-core
Branch: dev/ido
Commit: 5b7211d1cdd9242eb9e04a4ba6a2e5d38032651d
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=5b7211d1cdd9242eb9e04a4ba6a2e5d38032651d

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

---

 Changelog      |    1 +
 Changelog_json |    3 ++-
 cgi/extinfo.c  |   16 +++++++++++++++-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index c82e229..75b0ea2 100644
--- a/Changelog
+++ b/Changelog
@@ -33,6 +33,7 @@ ENHANCEMENTS
 * classic ui: add display_status_totals as cgi.cfg option in order to allow the status totals to be shown again #2443 - RB
 * classic ui: Changed reading of auth information from cgiauth.c to cgiutils.c #2524 - RB
 * classic ui: Added readonly cgi.cfg view into the config section #1776 - RB
+* classic ui: add is_in_effect and trigger_time to downtime view for html, csv, json #2538 - MF
 
 * idoutils: add new index for state in table statehistory #2274 - TD
 
diff --git a/Changelog_json b/Changelog_json
index e06cc32..2d7da05 100644
--- a/Changelog_json
+++ b/Changelog_json
@@ -5,6 +5,7 @@ Classic-UI JSON Change Log
 1.7.0 - array names changed!!!! #2343
 	comments  -> host_comments  / service_comments
 	downtimes -> host_downtimes / service_downtimes
+* 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
@@ -15,4 +16,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 fe8450a..fd40616 100644
--- a/cgi/extinfo.c
+++ b/cgi/extinfo.c
@@ -3126,7 +3126,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);
 		}
@@ -3161,7 +3163,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 */
@@ -3279,17 +3281,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