[icinga-checkins] icinga.org: icinga-core/next: classic-ui: add status.cgi modifed_attributes filter parameter #4880

git at icinga.org git at icinga.org
Mon Nov 4 22:52:29 CET 2013


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

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Wed Oct 30 16:05:30 2013 +0100

classic-ui: add status.cgi modifed_attributes filter parameter #4880

It's possible now to select between following options for
modified_attributes
* Yes
* No
* No Filter

refs: #4880
whatthecommit: This is why the cat shouldn't sit on my keyboard.

---

 Changelog                          |    7 +++++++
 cgi/status.c                       |   24 ++++++++++++++++++++++++
 html/js/status_filter_functions.js |   18 +++++++++++++++++-
 include/cgiutils.h                 |   10 +++++-----
 4 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/Changelog b/Changelog
index dd1d90b..c6cb6e5 100644
--- a/Changelog
+++ b/Changelog
@@ -13,6 +13,13 @@ UPGRADE NOTES
 	- idoutils: ${source}/module/idoutils/config/updates
 * package locations may differ!
 
+1.11.0 - 13/03/2014
+
+ENHANCEMENTS
+
+* classic ui: add status.cgi modifed_attributes filter parameter #4880 - RB
+
+
 1.10.0 - 24/10/2013
 
 * idoutils: slahistory table must be removed manually after enable_sla removal #4363
diff --git a/cgi/status.c b/cgi/status.c
index 687598e..f8acd5b 100644
--- a/cgi/status.c
+++ b/cgi/status.c
@@ -6530,6 +6530,12 @@ int passes_host_properties_filter(hoststatus *temp_hoststatus) {
 	if ((host_properties & HOST_PASSIVE_CHECKS_ENABLED) && temp_hoststatus->accept_passive_host_checks == FALSE)
 		return FALSE;
 
+	if ((host_properties & HOST_MODIFIED_ATTRIBUTES) && temp_hoststatus->modified_attributes == MODATTR_NONE)
+		return FALSE;
+
+	if ((host_properties & HOST_NO_MODIFIED_ATTRIBUTES) && temp_hoststatus->modified_attributes != MODATTR_NONE)
+		return FALSE;
+
 	if ((host_properties & HOST_HARD_STATE) && temp_hoststatus->state_type == SOFT_STATE)
 		return FALSE;
 
@@ -6597,6 +6603,12 @@ int passes_service_properties_filter(servicestatus *temp_servicestatus) {
 	if ((service_properties & SERVICE_PASSIVE_CHECKS_ENABLED) && temp_servicestatus->accept_passive_service_checks == FALSE)
 		return FALSE;
 
+	if ((service_properties & SERVICE_MODIFIED_ATTRIBUTES) && temp_servicestatus->modified_attributes == MODATTR_NONE)
+		return FALSE;
+
+	if ((service_properties & SERVICE_NO_MODIFIED_ATTRIBUTES) && temp_servicestatus->modified_attributes != MODATTR_NONE)
+		return FALSE;
+
 	if ((service_properties & SERVICE_HARD_STATE) && temp_servicestatus->state_type == SOFT_STATE)
 		return FALSE;
 
@@ -6736,6 +6748,12 @@ void show_filters(void) {
 	printf("<input id='filter_hp_state_type_3' name='filter_hp_state_type' type='radio' value='0' ><label for='filter_hp_state_type_3'>No Filter</label>\n");
 	printf("</div></td></tr>\n");
 
+	printf("<tr><td align='left' class='filterName' nowrap>Modified Attributes</td><td><div id='radio' nowrap>\n");
+	printf("<input id='filter_hp_modified_attributes_1' name='filter_hp_modified_attributes' type='radio' value='%d'><label for='filter_hp_modified_attributes_1'>Yes</label>\n", HOST_MODIFIED_ATTRIBUTES);
+	printf("<input id='filter_hp_modified_attributes_2' name='filter_hp_modified_attributes' type='radio' value='%d'><label for='filter_hp_modified_attributes_2'>No</label>\n", HOST_NO_MODIFIED_ATTRIBUTES);
+	printf("<input id='filter_hp_modified_attributes_3' name='filter_hp_modified_attributes' type='radio' value='0' ><label for='filter_hp_modified_attributes_3'>No Filter</label>\n");
+	printf("</div></td></tr>\n");
+
 	printf("<tr><td style='height:10px; line-height:10px;'> </td><td> </td></tr>\n");
 
 	printf("<tr><td align='left' class='filterName' nowrap>Host State Handled</td><td><div id='radio' nowrap>\n");
@@ -6840,6 +6858,12 @@ void show_filters(void) {
 	printf("<input id='filter_sp_state_type_3' name='filter_sp_state_type' type='radio' value='0' ><label for='filter_sp_state_type_3'>No Filter</label>\n");
 	printf("</div></td></tr>\n");
 
+	printf("<tr><td align='left' class='filterName' nowrap>Modified Attributes</td><td><div id='radio' nowrap>\n");
+	printf("<input id='filter_sp_modified_attributes_1' name='filter_sp_modified_attributes' type='radio' value='%d'><label for='filter_sp_modified_attributes_1'>Yes</label>\n", SERVICE_MODIFIED_ATTRIBUTES);
+	printf("<input id='filter_sp_modified_attributes_2' name='filter_sp_modified_attributes' type='radio' value='%d'><label for='filter_sp_modified_attributes_2'>No</label>\n", SERVICE_NO_MODIFIED_ATTRIBUTES);
+	printf("<input id='filter_sp_modified_attributes_3' name='filter_sp_modified_attributes' type='radio' value='0' ><label for='filter_sp_modified_attributes_3'>No Filter</label>\n");
+	printf("</div></td></tr>\n");
+
 	printf("<tr><td style='height:10px; line-height:10px;'> </td><td> </td></tr>\n");
 
 	printf("<tr><td align='left' class='filterName' nowrap>Service State Handled</td><td><div id='radio' nowrap>\n");
diff --git a/html/js/status_filter_functions.js b/html/js/status_filter_functions.js
index 0a80cbf..45f8a95 100644
--- a/html/js/status_filter_functions.js
+++ b/html/js/status_filter_functions.js
@@ -23,6 +23,8 @@ var NOTIFICATIONS_DISABLED	= 4096
 var NOTIFICATIONS_ENABLED	= 8192
 var PASSIVE_CHECKS_DISABLED	= 16384
 var PASSIVE_CHECKS_ENABLED	= 32768
+var MODIFIED_ATTRIBUTES		= 65536
+var NO_MODIFIED_ATTRIBUTES	= 131072
 var HARD_STATE			= 262144
 var SOFT_STATE			= 524288
 var STATE_HANDLED		= 1048576
@@ -188,6 +190,12 @@ function icinga_set_properties_text(filter) {
 		if (status_properties & PASSIVE_CHECKS_ENABLED)
 			return_properties_text.push("Passive Checks Enabled");
 
+		if (status_properties & MODIFIED_ATTRIBUTES)
+			return_properties_text.push("Modified Attributes");
+
+		if (status_properties & NO_MODIFIED_ATTRIBUTES)
+			return_properties_text.push("No Modified Attributes");
+
 		if (status_properties & HARD_STATE)
 			return_properties_text.push("In Hard State");
 
@@ -302,6 +310,13 @@ function icinga_set_status_properies(filter) {
 	else
 		document.getElementById("filter_" + t + "p_state_type_3").checked = true;
 
+	if (status_properties & MODIFIED_ATTRIBUTES)
+		document.getElementById("filter_" + t + "p_modified_attributes_1").checked = true;
+	else if (status_properties & NO_MODIFIED_ATTRIBUTES)
+		document.getElementById("filter_" + t + "p_modified_attributes_2").checked = true;
+	else
+		document.getElementById("filter_" + t + "p_modified_attributes_3").checked = true;
+
 	if (status_properties & STATE_HANDLED)
 		document.getElementById("filter_" + t + "p_state_handled_1").checked = true;
 	else
@@ -352,6 +367,7 @@ function icinga_update_properties(filter) {
 	status_properties += parseInt($('input[name="filter_' + t + 'p_is_flapping"]:checked').val());
 	status_properties += parseInt($('input[name="filter_' + t + 'p_notifications"]:checked').val());
 	status_properties += parseInt($('input[name="filter_' + t + 'p_state_type"]:checked').val());
+	status_properties += parseInt($('input[name="filter_' + t + 'p_modified_attributes"]:checked').val());
 	status_properties += parseInt($('input[name="filter_' + t + 'p_state_handled"]:checked').val());
 	status_properties += parseInt($('input[name="filter_' + t + 'p_not_all_checks_disabled"]:checked').val());
 
@@ -473,7 +489,7 @@ function icinga_filter_toggle(section) {
 function icinga_apply_new_filters() {
 
 	/* update status types and properties ahead of submission
-	   in case the use changed a option without using the "Apply" button */
+	   in case the user changed an option without using the "Apply" button */
 	icinga_update_status_types("host_status_types");
 	icinga_update_status_types("service_status_types");
 	icinga_update_properties("host_properties");
diff --git a/include/cgiutils.h b/include/cgiutils.h
index adef1bb..b852d76 100644
--- a/include/cgiutils.h
+++ b/include/cgiutils.h
@@ -385,12 +385,12 @@ extern "C" {
 #define HOST_NOTIFICATIONS_ENABLED	8192
 #define HOST_PASSIVE_CHECKS_DISABLED	16384
 #define HOST_PASSIVE_CHECKS_ENABLED	32768
-//#define HOST_PASSIVE_CHECK		65536		/* unused, no idea why it got implented in first place */
-//#define HOST_ACTIVE_CHECK		131072		/* unused, no idea why it got implented in first place */
+#define HOST_MODIFIED_ATTRIBUTES	65536
+#define HOST_NO_MODIFIED_ATTRIBUTES	131072
 #define HOST_HARD_STATE			262144
 #define HOST_SOFT_STATE			524288
 #define HOST_STATE_HANDLED		1048576
-#define HOST_NOT_ALL_CHECKS_DISABLED	2097152	
+#define HOST_NOT_ALL_CHECKS_DISABLED	2097152
 
 
 #define SERVICE_SCHEDULED_DOWNTIME	1
@@ -409,8 +409,8 @@ extern "C" {
 #define SERVICE_NOTIFICATIONS_ENABLED	8192
 #define SERVICE_PASSIVE_CHECKS_DISABLED	16384
 #define SERVICE_PASSIVE_CHECKS_ENABLED	32768
-//#define SERVICE_PASSIVE_CHECK		65536		/* unused, no idea why it got implented in first place */
-//#define SERVICE_ACTIVE_CHECK		131072		/* unused, no idea why it got implented in first place */
+#define SERVICE_MODIFIED_ATTRIBUTES	65536
+#define SERVICE_NO_MODIFIED_ATTRIBUTES	131072
 #define SERVICE_HARD_STATE		262144
 #define SERVICE_SOFT_STATE		524288
 #define SERVICE_STATE_HANDLED		1048576





More information about the icinga-checkins mailing list