Patches for nagios-3.0b6
Lars Vogdt
Lars at linux-schulserver.de
Tue Nov 6 22:18:59 CET 2007
Hi
First: thanks for this great product!
I like to thank a bit with the following 3 patches for nagios-3.0b6 -
and would feel happy if you can apply them for the next release.
I've got some more compiler (gcc42) warnings about implicit
declarations, unused variables and ignoring function return values.
But I haven't investigated any time in these warnings, yet.
1) missing DESTDIR in Makefile
make DESTDIR=%buildroot install-webconf
is currently not working because $(DESTDIR) is missing.
Index: Makefile.in
===================================================================
--- Makefile.in.orig
+++ Makefile.in
@@ -236,7 +236,7 @@
@echo ""
install-webconf:
- $(INSTALL) -m 644 sample-config/httpd.conf $(HTTPD_CONF)/nagios.conf
+ $(INSTALL) -m 644 sample-config/httpd.conf
$(DESTDIR)$(HTTPD_CONF)/nagios.conf
@echo ""
@echo "*** Nagios/Apache conf file installed ***"
2) Fix compiler warnings part 1 (string compare)
Index: cgi/avail.c
===================================================================
--- cgi/avail.c.orig
+++ cgi/avail.c
@@ -2475,7 +2475,7 @@
char *last_host_name="";
/* we're displaying one or more hosts */
- if(display_type==DISPLAY_HOST_AVAIL && host_name!=""){
+ if(display_type==DISPLAY_HOST_AVAIL && (strcmp(host_name,"")!=0)){
/* we're only displaying a specific host (and summaries for all
services associated with it) */
if(show_all_hosts==FALSE){
@@ -2494,7 +2494,7 @@
}
/* we're displaying a specific service */
- else if(display_type==DISPLAY_SERVICE_AVAIL && svc_description!=""){
+ else if(display_type==DISPLAY_SERVICE_AVAIL &&
(strcmp(svc_description,"")!=0)){
/* we're only displaying a specific service */
if(show_all_services==FALSE)
@@ -2508,7 +2508,7 @@
}
/* we're displaying one or more hostgroups (the host members of the
groups) */
- else if(display_type==DISPLAY_HOSTGROUP_AVAIL && hostgroup_name!="")
{
+ else if(display_type==DISPLAY_HOSTGROUP_AVAIL &&
(strcmp(hostgroup_name,"")!=0)){
/* we're displaying all hostgroups */
if(show_all_hostgroups==TRUE){
@@ -2528,7 +2528,7 @@
}
/* we're displaying one or more servicegroups (the host and service
members of the groups) */
- else if(display_type==DISPLAY_SERVICEGROUP_AVAIL &&
servicegroup_name!=""){
+ else if(display_type==DISPLAY_SERVICEGROUP_AVAIL &&
(strcmp(servicegroup_name,"")!=0)){
/* we're displaying all servicegroups */
if(show_all_servicegroups==TRUE){
3) Fix compiler warnings part 2 (variable used bevor set)
Index: base/sehandlers.c
===================================================================
--- base/sehandlers.c.orig
+++ base/sehandlers.c
@@ -246,7 +246,9 @@
double exectime=0.0;
int result=0;
struct timeval start_time;
+#ifdef USE_EVENT_BROKER
struct timeval end_time;
+#endif
int macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;
@@ -299,10 +301,10 @@
if(early_timeout==TRUE)
logit(NSLOG_EVENT_HANDLER | NSLOG_RUNTIME_WARNING,TRUE,"Warning:
Global service event handler command '%s' timed out after %d
seconds\n",processed_command,event_handler_timeout);
+#ifdef USE_EVENT_BROKER
/* get end time */
gettimeofday(&end_time,NULL);
-#ifdef USE_EVENT_BROKER
/* send event data to broker */
broker_event_handler(NEBTYPE_EVENTHANDLER_END,NEBFLAG_NONE,NEBATTR_NONE,GLOBAL_SERVICE_EVENTHANDLER,
(void
*)svc,svc->current_state,svc->state_type,start_time,end_time,exectime,event_handler_timeout,early_timeout,result,global_service_event_handler,processed_command,command_output,NULL);
#endif
@@ -326,7 +328,9 @@
double exectime=0.0;
int result=0;
struct timeval start_time;
+#ifdef USE_EVENT_BROKER
struct timeval end_time;
+#endif
int macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;
@@ -375,10 +379,10 @@
if(early_timeout==TRUE)
logit(NSLOG_EVENT_HANDLER | NSLOG_RUNTIME_WARNING,TRUE,"Warning:
Service event handler command '%s' timed out after %d
seconds\n",processed_command,event_handler_timeout);
+#ifdef USE_EVENT_BROKER
/* get end time */
gettimeofday(&end_time,NULL);
-#ifdef USE_EVENT_BROKER
/* send event data to broker */
broker_event_handler(NEBTYPE_EVENTHANDLER_END,NEBFLAG_NONE,NEBATTR_NONE,SERVICE_EVENTHANDLER,
(void
*)svc,svc->current_state,svc->state_type,start_time,end_time,exectime,event_handler_timeout,early_timeout,result,svc->event_handler,processed_command,command_output,NULL);
#endif
@@ -445,7 +449,9 @@
double exectime=0.0;
int result=0;
struct timeval start_time;
+#ifdef USE_EVENT_BROKER
struct timeval end_time;
+#endif
int macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;
@@ -498,10 +504,10 @@
if(early_timeout==TRUE)
logit(NSLOG_EVENT_HANDLER | NSLOG_RUNTIME_WARNING,TRUE,"Warning:
Global host event handler command '%s' timed out after %d
seconds\n",processed_command,event_handler_timeout);
+#ifdef USE_EVENT_BROKER
/* get end time */
gettimeofday(&end_time,NULL);
-#ifdef USE_EVENT_BROKER
/* send event data to broker */
broker_event_handler(NEBTYPE_EVENTHANDLER_END,NEBFLAG_NONE,NEBATTR_NONE,GLOBAL_HOST_EVENTHANDLER,
(void
*)hst,hst->current_state,hst->state_type,start_time,end_time,exectime,event_handler_timeout,early_timeout,result,global_host_event_handler,processed_command,command_output,NULL);
#endif
@@ -524,7 +530,9 @@
double exectime=0.0;
int result=0;
struct timeval start_time;
+#ifdef USE_EVENT_BROKER
struct timeval end_time;
+#endif
int macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;
@@ -573,10 +581,10 @@
if(early_timeout==TRUE)
logit(NSLOG_EVENT_HANDLER | NSLOG_RUNTIME_WARNING,TRUE,"Warning: Host
event handler command '%s' timed out after %d
seconds\n",processed_command,event_handler_timeout);
+#ifdef USE_EVENT_BROKER
/* get end time */
gettimeofday(&end_time,NULL);
-#ifdef USE_EVENT_BROKER
/* send event data to broker */
broker_event_handler(NEBTYPE_EVENTHANDLER_END,NEBFLAG_NONE,NEBATTR_NONE,HOST_EVENTHANDLER,
(void
*)hst,hst->current_state,hst->state_type,start_time,end_time,exectime,event_handler_timeout,early_timeout,result,hst->event_handler,processed_command,command_output,NULL);
#endif
Regards,
Lars
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
More information about the Developers
mailing list