[Pkg-nagios-changes] [SCM] Debian packaging for mod gearman. branch, master, updated. debian/1.0.3-1-28-ga8ba0c2

Sven Nierlein sven at nierlein.org
Fri May 20 10:20:53 UTC 2011


The following commit has been merged in the master branch:
commit 10ecded7591927a02dfd9ac4d7032ceaf13f3cd9
Author: Sven Nierlein <sven at nierlein.org>
Date:   Thu Apr 14 17:24:40 2011 +0200

    changed latency calculation (use time of next_check instead of time of job submission)

diff --git a/Changes b/Changes
index f4532ce..1a16926 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 This file documents the revision history for mod_gearman.
 
 1.0.4  Wed...
+          - changed latency calculation (use time of next_check instead of time of job submission)
           - added nsca replacements docs
 
 1.0.3  Wed Mar 23 21:53:09 CET 2011
diff --git a/neb_module/mod_gearman.c b/neb_module/mod_gearman.c
index 39d44cf..8957e59 100644
--- a/neb_module/mod_gearman.c
+++ b/neb_module/mod_gearman.c
@@ -419,7 +419,6 @@ static int handle_host_check( int event_type, void *data ) {
     nebstruct_host_check_data * hostdata;
     char *raw_command=NULL;
     char *processed_command=NULL;
-    struct timeval start_time;
     host * hst;
 
     gm_log( GM_LOG_TRACE, "handle_host_check(%i)\n", event_type );
@@ -446,7 +445,10 @@ static int handle_host_check( int event_type, void *data ) {
     }
 
     /* get objects and set target function */
-    hst = find_host( hostdata->host_name );
+    if((hst=hostdata->object_ptr)==NULL) {
+        gm_log( GM_LOG_ERROR, "Host handler received NULL host object pointer.\n" );
+        return NEBERROR_CALLBACKCANCEL;
+    }
     set_target_queue( hst, NULL );
 
     /* local check? */
@@ -486,9 +488,6 @@ static int handle_host_check( int event_type, void *data ) {
         return NEBERROR_CALLBACKCANCEL;
     }
 
-    /* get the command start time */
-    gettimeofday(&start_time,NULL);
-
     /* increment number of host checks that are currently running */
     currently_running_host_checks++;
 
@@ -498,11 +497,10 @@ static int handle_host_check( int event_type, void *data ) {
     gm_log( GM_LOG_TRACE, "cmd_line: %s\n", processed_command );
 
     temp_buffer[0]='\x0';
-    snprintf( temp_buffer,sizeof( temp_buffer )-1,"type=host\nresult_queue=%s\nhost_name=%s\nstart_time=%i.%i\ntimeout=%d\ncommand_line=%s\n\n\n",
+    snprintf( temp_buffer,sizeof( temp_buffer )-1,"type=host\nresult_queue=%s\nhost_name=%s\nstart_time=%i.0\ntimeout=%d\ncommand_line=%s\n\n\n",
               mod_gm_opt->result_queue,
               hst->name,
-              ( int )start_time.tv_sec,
-              ( int )start_time.tv_usec,
+              ( int )hst->next_check,
               host_check_timeout,
               processed_command
             );
@@ -549,7 +547,6 @@ static int handle_svc_check( int event_type, void *data ) {
     service * svc = NULL;
     char *raw_command=NULL;
     char *processed_command=NULL;
-    struct timeval start_time;
     nebstruct_service_check_data * svcdata;
     int prio = GM_JOB_PRIO_LOW;
 
@@ -570,11 +567,16 @@ static int handle_svc_check( int event_type, void *data ) {
     }
 
     /* get objects and set target function */
-    svc = find_service( svcdata->host_name, svcdata->service_description );
+    if((svc=svcdata->object_ptr)==NULL) {
+        gm_log( GM_LOG_ERROR, "Service handler received NULL service object pointer.\n" );
+        return NEBERROR_CALLBACKCANCEL;
+    }
 
     /* find the host associated with this service */
-    if((hst=svc->host_ptr)==NULL)
+    if((hst=svc->host_ptr)==NULL) {
+        gm_log( GM_LOG_ERROR, "Service handler received NULL host object pointer.\n" );
         return NEBERROR_CALLBACKCANCEL;
+    }
     set_target_queue( hst, svc );
 
     /* local check? */
@@ -611,9 +613,6 @@ static int handle_svc_check( int event_type, void *data ) {
         return NEBERROR_CALLBACKCANCEL;
     }
 
-    /* get the command start time */
-    gettimeofday(&start_time,NULL);
-
     /* increment number of service checks that are currently running... */
     currently_running_service_checks++;
 
@@ -624,12 +623,11 @@ static int handle_svc_check( int event_type, void *data ) {
     gm_log( GM_LOG_TRACE, "cmd_line: %s\n", processed_command );
 
     temp_buffer[0]='\x0';
-    snprintf( temp_buffer,sizeof( temp_buffer )-1,"type=service\nresult_queue=%s\nhost_name=%s\nservice_description=%s\nstart_time=%i.%i\ntimeout=%d\ncommand_line=%s\n\n\n",
+    snprintf( temp_buffer,sizeof( temp_buffer )-1,"type=service\nresult_queue=%s\nhost_name=%s\nservice_description=%s\nstart_time=%i.0\ntimeout=%d\ncommand_line=%s\n\n\n",
               mod_gm_opt->result_queue,
               svcdata->host_name,
               svcdata->service_description,
-              ( int )start_time.tv_sec,
-              ( int )start_time.tv_usec,
+              ( int )svc->next_check,
               service_check_timeout,
               processed_command
             );

-- 
Debian packaging for mod gearman.



More information about the Pkg-nagios-changes mailing list