[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: classic ui: add service states to annotate with current notification number opt-in ( Jochen Bern) #976

git at icinga.org git at icinga.org
Fri Nov 12 10:22:50 CET 2010


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

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Fri Nov 12 10:22:12 2010 +0100

classic ui: add service states to annotate with current notification number opt-in (Jochen Bern) #976

--SNIP--
        # SERVICE STATES TO ANNOTATE WITH CURRENT NOTIFICATION NO.
        # Set this to an OR of the service state identifiers for
        # which status.cgi should not only report "Attempts" (e.g.,
        # "3/3" for a HARD non-OK state with max_check_attempts=3)
        # but also the current notification number ("(#0)" if no
        # problem notification has been sent yet, etc.). This is
        # helpful to identify services which switched between
        # different non-OK states a lot, or services which have a
        # first_notification_delay set and are "not yet officially"
        # considered in trouble.
[...]
        # You'll likely want to use add_notif_num_hard=0 (default)
        # or add_notif_num_hard=28 (warn+crit+unknown). There's an
        # add_notif_num_soft affecting services in a SOFT state
        # for sake of completeness, too.
--SNIP--

fixes #976

---

 Changelog                |    1 +
 cgi/cgiutils.c           |    8 ++++++++
 cgi/status.c             |    5 ++++-
 sample-config/cgi.cfg.in |   26 ++++++++++++++++++++++++++
 4 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/Changelog b/Changelog
index 9c92d99..2e13bde 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,7 @@ ENHANCEMENTS
 * classic ui: add config expander urls to extinfo.cgi for active checks and eventhandlers (Jochen Bern) #965
 * classic ui: add collapse the display filter part on status.cgi #923
 * classic ui: add tabfriendly titles, enabled by default (Jochen Bern) #975
+* classic ui: add service states to annotate with current notification number opt-in (Jochen Bern) #976
 
 * idoutils: add index to table icinga_statehistory for usage in reporting module #957
 
diff --git a/cgi/cgiutils.c b/cgi/cgiutils.c
index 5e72b1c..7f6d037 100644
--- a/cgi/cgiutils.c
+++ b/cgi/cgiutils.c
@@ -131,6 +131,8 @@ int		tac_show_only_hard_state=FALSE;
 int		showlog_initial_state=TRUE;
 int		showlog_current_state=TRUE;
 int		tab_friendly_titles=FALSE;
+int		add_notif_num_hard=0;
+int		add_notif_num_soft=0;
 
 extern hostgroup       *hostgroup_list;
 extern contactgroup    *contactgroup_list;
@@ -502,6 +504,12 @@ int read_cgi_config_file(char *filename){
 		else if(!strcmp(var,"tab_friendly_titles"))
 			tab_friendly_titles=(atoi(val)>0)?TRUE:FALSE;
 
+ 		else if(!strcmp(var,"add_notif_num_hard"))
+			add_notif_num_hard=atoi(val);
+
+		else if(!strcmp(var,"add_notif_num_soft"))
+			add_notif_num_soft=atoi(val);
+
 		else if(!strcmp(var,"csv_delimiter"))
 			csv_delimiter=strdup(val);
 
diff --git a/cgi/status.c b/cgi/status.c
index cf5c6bd..70810e1 100644
--- a/cgi/status.c
+++ b/cgi/status.c
@@ -188,6 +188,9 @@ extern int daemon_check;
 extern int content_type;
 extern int escape_html_tags;
 
+extern int add_notif_num_hard;
+extern int add_notif_num_soft;
+
 extern char *csv_delimiter;
 extern char *csv_data_enclosure;
 
@@ -1863,7 +1866,7 @@ void show_service_detail(void){
 				printf("<TD CLASS='status%s'>%s</TD>\n",status_class,status);
 				printf("<TD CLASS='status%s' nowrap>%s</TD>\n",status_bg_class,date_time);
 				printf("<TD CLASS='status%s' nowrap>%s</TD>\n",status_bg_class,state_duration);
-				printf("<TD CLASS='status%s'>%d/%d</TD>\n",status_bg_class,temp_status->current_attempt,temp_status->max_attempts);
+				printf("<TD CLASS='status%s'>%d/%d %s#%d%s</TD>\n",status_bg_class,temp_status->current_attempt,temp_status->max_attempts,(temp_status->status&(temp_status->state_type==HARD_STATE?add_notif_num_hard:add_notif_num_soft)?"(":"<!-- "),temp_status->current_notification_number,(temp_status->status&(temp_status->state_type==HARD_STATE?add_notif_num_hard:add_notif_num_soft)?")":" -->"));
 				printf("<TD CLASS='status%s' valign='center'>",status_bg_class);
 				if (status_show_long_plugin_output!=FALSE && temp_status->long_plugin_output!=NULL) {
 					printf("%s<BR>%s",html_encode(temp_status->plugin_output,TRUE), html_encode(temp_status->long_plugin_output,TRUE));
diff --git a/sample-config/cgi.cfg.in b/sample-config/cgi.cfg.in
index 7319990..3db73cb 100644
--- a/sample-config/cgi.cfg.in
+++ b/sample-config/cgi.cfg.in
@@ -425,6 +425,32 @@ tac_show_only_hard_state=0
 tab_friendly_titles=1
 
 
+# SERVICE STATES TO ANNOTATE WITH CURRENT NOTIFICATION NO.
+# Set this to an OR of the service state identifiers for
+# which status.cgi should not only report "Attempts" (e.g.,
+# "3/3" for a HARD non-OK state with max_check_attempts=3)
+# but also the current notification number ("(#0)" if no
+# problem notification has been sent yet, etc.). This is
+# helpful to identify services which switched between
+# different non-OK states a lot, or services which have a
+# first_notification_delay set and are "not yet officially"
+# considered in trouble.
+# Relevant values from include/statusdata.h (look them up
+# *there* if you want to be *really* sure):
+#	#define	SERVICE_PENDING		1
+#	#define	SERVICE_OK		2
+#	#define	SERVICE_WARNING		4
+#	#define	SERVICE_UNKNOWN		8
+#	#define	SERVICE_CRITICAL	16
+# You'll likely want to use add_notif_num_hard=0 (default)
+# or add_notif_num_hard=28 (warn+crit+unknown). There's an
+# add_notif_num_soft affecting services in a SOFT state
+# for sake of completeness, too.
+
+#add_notif_num_hard=28
+#add_notif_num_soft=0
+
+
 
 # SPLUNK INTEGRATION OPTIONS
 # These options allow you to enable integration with Splunk





More information about the icinga-checkins mailing list