[icinga-checkins] icinga.org: icinga-core/test/ido: classic-ui: Added state type to JSON in status.cgi #3195

git at icinga.org git at icinga.org
Wed Oct 3 01:18:37 CEST 2012


Module: icinga-core
Branch: test/ido
Commit: 40f5c75cce62181d62cda80900813df7f1123f3c
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=40f5c75cce62181d62cda80900813df7f1123f3c

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Thu Sep 27 18:43:09 2012 +0200

classic-ui: Added state type to JSON in status.cgi #3195

refs: #3195

---

 Changelog      |   13 ++++++++-----
 Changelog_json |    1 +
 cgi/status.c   |    7 +++++++
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/Changelog b/Changelog
index 65390df..c7ce47d 100644
--- a/Changelog
+++ b/Changelog
@@ -51,6 +51,7 @@ ENHANCEMENTS
 * classic ui: add command to delete host downtime and all associated service downtimes (extinfo.cgi, status.cgi command drop down) - RD/MF
 * classic ui: Added config option to convert login username to lower case #3171 - AH
 * classic ui: Added a refresh button to tac.cgi in header mode #3164 - RB
+* classic ui: Added state type to JSON in status.cgi #3195 - RB
 
 * idoutils: do not pass host and port if not set in the config, letting mysql|pgsql drivers autoselect the socket #2698 - MF
 * idoutils: fix mismatched types for uint casts in bulkops (oracle) #2646 - TD
@@ -147,11 +148,13 @@ classic ui: Added/Changed cgi.cfg options
 	** default_expiring_disabled_notifications_duration=86400 #905
 	** lowercase_user_name - #3171
 * classic ui: change strings in json output: !!!IMPORTANT!!!
-	** host -> host_name
-	** service -> service_description
-	** description -> service_description
-	** added host_display_name
-	** added service_display_name
+	** host -> host_name #2693
+	** service -> service_description #2693
+	** description -> service_description #2693
+	** added host_display_name #2693
+	** added service_display_name #2693
+	** added host_has_been_acknowledged and service_has_been_acknowledged to extinfo.cgi #3000
+	** added state_type to host and service status in status.cgi #3195
 * classic ui: added checkbox in cmd.cgi to deselect unintentional selected hosts/services #2697
 
 * idoutils: add disable_notif_expire_time to programstatus table #905
diff --git a/Changelog_json b/Changelog_json
index e6c4de6..9f0d5d0 100644
--- a/Changelog_json
+++ b/Changelog_json
@@ -7,6 +7,7 @@ Classic-UI JSON Change Log
 * changed service or description -> service_description  !!!!
 * added host_display_name and service_display_name to every json output!
 * added host_has_been_acknowledged and service_has_been_acknowledged to extinfo.cgi #3000
+* added state_type to host and service status in status.cgi #3195
 
 1.7.1 - only values added, no existing values changed
 * added host_display_name to host and service status data
diff --git a/cgi/status.c b/cgi/status.c
index e2e4382..7baf9b2 100644
--- a/cgi/status.c
+++ b/cgi/status.c
@@ -157,6 +157,7 @@ typedef struct statusdata_struct {
 	int		checks_enabled;			/**< bool if active checks are enabled */
 	int		accept_passive_checks;		/**< bool if passive checks are enabled */
 	int		is_flapping;			/**< bool if status is flapping */
+	int		state_type;			/**< type of state HARD_STATE / SOFT_STATE */
 	struct statusdata_struct *next;			/**< next statusdata */
 } statusdata;
 
@@ -2667,6 +2668,7 @@ void show_service_detail(void) {
 			printf("\"last_check\": \"%s\", ", temp_status->last_check);
 			printf("\"duration\": \"%s\", ", temp_status->state_duration);
 			printf("\"attempts\": \"%s\", ", temp_status->attempts);
+			printf("\"state_type\": \"%s\", ", (temp_status->state_type == HARD_STATE) ? "HARD" : "SOFT");
 			printf("\"is_flapping\": %s, ", (temp_status->is_flapping == TRUE) ? "true" : "false");
 			printf("\"in_scheduled_downtime\": %s, ", (temp_status->scheduled_downtime_depth > 0) ? "true" : "false");
 			printf("\"active_checks_enabled\": %s, ", (temp_status->checks_enabled == TRUE) ? "true" : "false");
@@ -3120,6 +3122,7 @@ void show_host_detail(void) {
 			printf("\"last_check\": \"%s\", ", temp_statusdata->last_check);
 			printf("\"duration\": \"%s\", ", temp_statusdata->state_duration);
 			printf("\"attempts\": \"%s\", ", temp_statusdata->attempts);
+			printf("\"state_type\": \"%s\", ", (temp_statusdata->state_type == HARD_STATE) ? "HARD" : "SOFT");
 			printf("\"is_flapping\": %s, ", (temp_statusdata->is_flapping == TRUE) ? "true" : "false");
 			printf("\"in_scheduled_downtime\": %s, ", (temp_statusdata->scheduled_downtime_depth > 0) ? "true" : "false");
 			printf("\"active_checks_enabled\": %s, ", (temp_statusdata->checks_enabled == TRUE) ? "true" : "false");
@@ -5871,6 +5874,7 @@ int add_status_data(int status_type, void *data) {
 	int notifications_enabled = FALSE;
 	int checks_enabled = FALSE;
 	int accept_passive_checks = FALSE;
+	int state_type = HARD_STATE;
 
 	if (status_type == HOST_STATUS) {
 
@@ -5904,6 +5908,7 @@ int add_status_data(int status_type, void *data) {
 		checks_enabled = host_status->checks_enabled;
 		accept_passive_checks = host_status->accept_passive_host_checks;
 		is_flapping = host_status->is_flapping;
+		state_type = host_status->state_type;
 
 		plugin_output_short = host_status->plugin_output;
 		plugin_output_long = host_status->long_plugin_output;
@@ -5946,6 +5951,7 @@ int add_status_data(int status_type, void *data) {
 		checks_enabled = service_status->checks_enabled;
 		accept_passive_checks = service_status->accept_passive_service_checks;
 		is_flapping = service_status->is_flapping;
+		state_type = service_status->state_type;
 
 		plugin_output_short = service_status->plugin_output;
 		plugin_output_long = service_status->long_plugin_output;
@@ -6032,6 +6038,7 @@ int add_status_data(int status_type, void *data) {
 	new_statusdata->checks_enabled = checks_enabled;
 	new_statusdata->accept_passive_checks = accept_passive_checks;
 	new_statusdata->is_flapping = is_flapping;
+	new_statusdata->state_type = state_type;
 
 	new_statusdata->plugin_output = (plugin_output == NULL) ? NULL : strdup(plugin_output);
 





More information about the icinga-checkins mailing list