Page 1 of 1

[Nagios-devel] PATCH: Service Hard/Soft State Filter for status.cgi

Posted: Mon May 15, 2006 3:46 pm
by Guest
------=_20060515164658_99294
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Gents,

We needed to filter our Service Checks by state-type (Hard/Soft) in our
status.cgi display.

I've been asked to post this as a patch submission for those who might be
interested in this functionality.

Please find attached two unified-diff patch files:

1. cgi/status.c - enables state-type filtering
2. include/cgiutils.h.in - adds constants for state-type filters

Bob


------=_20060515164658_99294
Content-Type: text/plain; name="status.c-diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="status.c-diff"

--- status.c-orig 2006-04-26 09:33:59.000000000 -0600
+++ status.c 2006-05-15 16:27:16.709615892 -0600
@@ -4301,6 +4301,12 @@
if((service_properties & SERVICE_ACTIVE_CHECK) && temp_servicestatus->check_type==SERVICE_CHECK_PASSIVE)
return FALSE;

+ if((service_properties & SERVICE_STATE_TYPE_HARD) && temp_servicestatus->state_type!=HARD_STATE)
+ return FALSE;
+
+ if((service_properties & SERVICE_STATE_TYPE_SOFT) && temp_servicestatus->state_type!=SOFT_STATE)
+ return FALSE;
+
return TRUE;
}

@@ -4532,6 +4538,14 @@
printf("%s Active Checks",(found==1)?" &":"");
found=1;
}
+ if(service_properties & SERVICE_STATE_TYPE_SOFT){
+ printf("%s Soft States",(found==1)?" &":"");
+ found=1;
+ }
+ if(service_properties & SERVICE_STATE_TYPE_HARD){
+ printf("%s Hard States",(found==1)?" &":"");
+ found=1;
+ }
}
printf("");
printf("\n");
------=_20060515164658_99294
Content-Type: text/plain; name="cgiutils.h.in-diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="cgiutils.h.in-diff"

--- cgiutils.h.in-orig 2006-01-20 10:34:53.000000000 -0700
+++ cgiutils.h.in 2006-05-15 16:31:30.440021638 -0600
@@ -308,6 +308,8 @@
#define SERVICE_PASSIVE_CHECKS_ENABLED 32768
#define SERVICE_PASSIVE_CHECK 65536
#define SERVICE_ACTIVE_CHECK 131072
+#define SERVICE_STATE_TYPE_SOFT 262144
+#define SERVICE_STATE_TYPE_HARD 524288


/****************************** SSI TYPES ********************************/
------=_20060515164658_99294--







This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]