patch for nagios 3rc1 - update

John Calcote john.calcote at gmail.com
Mon Jan 28 16:54:18 CET 2008


Hi Ethan,

I was just looking over the archives for the nagios-devel list on
sf.net and I noticed that the patch I sent as an attachment was
referenced by the archived message. But when I clicked on the link, I
got a message indicating that the attachment was "not available on the
server". This makes me wonder if I even attached it properly to begin
with.

Since I haven't seen any responses to my messages on this thread, I
wondered if anyone actually got my patch.

To be sure, I'm resending it as in-line text, rather than an attachment.

Thanks in advance,
John



diff -Naur nagios-3.0rc1/base/checks.c nagios-3.0rc1-patched/base/checks.c
--- nagios-3.0rc1/base/checks.c 2007-12-12 11:39:46.000000000 -0700
+++ nagios-3.0rc1-patched/base/checks.c 2008-01-20 20:10:06.000000000 -0700
@@ -380,11 +380,6 @@
                       *preferred_time+=(svc->check_interval*interval_length);
               return ERROR;
               }
-
-       /* neb module wants to override the service check - perhaps it
will check the service itself */
-       /* NOTE: if a module does this, it has to do a lot of the
stuff found below to make sure things don't get whacked out of shape!
*/
-       if(neb_result==NEBERROR_CALLBACKOVERRIDE)
-               return OK;
 #endif


@@ -410,6 +405,7 @@
               log_debug_info(DEBUGL_CHECKS,0,"Raw check command for
service '%s' on host '%s' was NULL -
aborting.\n",svc->description,svc->host_name);
               if(preferred_time)
                       *preferred_time+=(svc->check_interval*interval_length);
+               svc->latency=old_latency;
               return ERROR;
               }

@@ -419,6 +415,8 @@
               log_debug_info(DEBUGL_CHECKS,0,"Processed check command
for service '%s' on host '%s' was NULL -
aborting.\n",svc->description,svc->host_name);
               if(preferred_time)
                       *preferred_time+=(svc->check_interval*interval_length);
+               svc->latency=old_latency;
+               my_free(raw_command);
               return ERROR;
               }

@@ -431,6 +429,32 @@
       /* set the execution flag */
       svc->is_executing=TRUE;

+       /* start save check info */
+       check_result_info.object_check_type=SERVICE_CHECK;
+       check_result_info.check_type=SERVICE_CHECK_ACTIVE;
+       check_result_info.check_options=check_options;
+       check_result_info.scheduled_check=scheduled_check;
+       check_result_info.reschedule_check=reschedule_check;
+       check_result_info.start_time=start_time;
+       check_result_info.finish_time=start_time;
+       check_result_info.early_timeout=FALSE;
+       check_result_info.exited_ok=TRUE;
+       check_result_info.return_code=STATE_OK;
+       check_result_info.output=NULL;
+
+#ifdef USE_EVENT_BROKER
+       /* send data to event broker */
+       neb_result=broker_service_check(NEBTYPE_SERVICECHECK_INITIATE,NEBFLAG_NONE,NEBATTR_NONE,svc,SERVICE_CHECK_ACTIVE,start_time,end_time,svc->service_check_command,svc->latency,0.0,service_check_timeout,FALSE,0,processed_command,NULL);
+
+       /* neb module wants to override the service check - perhaps it
will check the service itself */
+       if(neb_result==NEBERROR_CALLBACKOVERRIDE){
+               svc->latency=old_latency;
+               my_free(processed_command);
+               my_free(raw_command);
+               return OK;
+               }
+#endif
+
       /* open a temp file for storing check output */
       old_umask=umask(new_umask);
       asprintf(&output_file,"%s/checkXXXXXX",temp_path);
@@ -446,21 +470,10 @@
       log_debug_info(DEBUGL_CHECKS|DEBUGL_IPC,1,"Check result output
will be written to '%s'
(fd=%d)\n",output_file,check_result_info.output_file_fd);


-       /* save check info */
-       check_result_info.object_check_type=SERVICE_CHECK;
+       /* finish save check info */
       check_result_info.host_name=(char *)strdup(svc->host_name);
       check_result_info.service_description=(char *)strdup(svc->description);
-       check_result_info.check_type=SERVICE_CHECK_ACTIVE;
-       check_result_info.check_options=check_options;
-       check_result_info.scheduled_check=scheduled_check;
-       check_result_info.reschedule_check=reschedule_check;
       check_result_info.output_file=(check_result_info.output_file_fd<0
|| output_file==NULL)?NULL:strdup(output_file);
-       check_result_info.start_time=start_time;
-       check_result_info.finish_time=start_time;
-       check_result_info.early_timeout=FALSE;
-       check_result_info.exited_ok=TRUE;
-       check_result_info.return_code=STATE_OK;
-       check_result_info.output=NULL;

       /* free memory */
       my_free(output_file);
@@ -492,11 +505,6 @@
       dbuf_init(&checkresult_dbuf,dbuf_chunk);


-#ifdef USE_EVENT_BROKER
-       /* send data to event broker */
-       broker_service_check(NEBTYPE_SERVICECHECK_INITIATE,NEBFLAG_NONE,NEBATTR_NONE,svc,SERVICE_CHECK_ACTIVE,start_time,end_time,svc->service_check_command,svc->latency,0.0,service_check_timeout,FALSE,0,processed_command,NULL);
-#endif
-
       /* reset latency (permanent value will be set later) */
       svc->latency=old_latency;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/




More information about the Developers mailing list