[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: classic-ui: added status_update_interval to JSON status output #3172

git at icinga.org git at icinga.org
Mon Mar 4 19:26:59 CET 2013


Module: icinga-core
Branch: mfriedrich/core
Commit: 3e1e6d58fd7fd0fe44047ae85270466cbc4f979c
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=3e1e6d58fd7fd0fe44047ae85270466cbc4f979c

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Thu Feb  7 00:55:48 2013 +0100

classic-ui: added status_update_interval to JSON status output #3172

refs: #3172

added "status_update_interval" and removed "program_state_ok" in
a earlier commit. was complete pointless

(O.o) (> <) Bunny approves these changes. #whatthecommit

---

 cgi/cgiutils.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cgi/cgiutils.c b/cgi/cgiutils.c
index 549127f..617189a 100644
--- a/cgi/cgiutils.c
+++ b/cgi/cgiutils.c
@@ -1132,8 +1132,13 @@ void document_header(int cgi_id, int use_stylesheet, char *cgi_title) {
 		result = read_all_status_data(get_cgi_config_location(), READ_PROGRAM_STATUS);
 
 		/* total running time */
-		get_time_breakdown(current_time - program_start, &days, &hours, &minutes, &seconds);
-		sprintf(run_time_string, "%dd %dh %dm %ds", days, hours, minutes, seconds);
+		if ( program_start != 0L) {
+			get_time_breakdown(current_time - program_start, &days, &hours, &minutes, &seconds);
+			sprintf(run_time_string, "%dd %dh %dm %ds", days, hours, minutes, seconds);
+		} else {
+			run_time_string[0] = '0';
+			run_time_string[1] = '\0';
+		}
 
 		tm_ptr = localtime(&current_time);
 
@@ -1148,6 +1153,7 @@ void document_header(int cgi_id, int use_stylesheet, char *cgi_title) {
 		printf("\"icinga_status\": {\n");
 
 		printf("\"status_data_age\": %lu,\n", current_time - status_file_creation_time);
+		printf("\"status_update_interval\": %d,\n", status_update_interval);
 		printf("\"reading_status_data_ok\": %s,\n", (result == ERROR && daemon_check == TRUE) ? "false" : "true");
 		printf("\"program_version\": \"%s\",\n", PROGRAM_VERSION);
 		printf("\"icinga_pid\": %d,\n", nagios_pid);





More information about the icinga-checkins mailing list