[Pkg-nagios-changes] [SCM] Debian packaging for mod gearman. branch, upstream, updated. upstream/1.0.6-34-gd3fb2ec

Sven Nierlein sven at nierlein.de
Wed Aug 24 09:21:45 UTC 2011


The following commit has been merged in the upstream branch:
commit 1acedcb38224360ae4e19a75b4a82992ea0ecc34
Author: Sven Nierlein <sven at nierlein.de>
Date:   Wed Jul 13 23:56:27 2011 +0200

    use identifier for error messages if set

diff --git a/Changes b/Changes
index 57e8882..25b19a8 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 This file documents the revision history for mod_gearman.
 
 1.0.8  Sat Jul  9 11:43:53 CEST 2011
+          - use identifier for error messages if set
           - fixed ld options (fixes debian bug #632431) thanks Ilya Barygin
 
 1.0.7  Sun Jul  3 15:18:16 CEST 2011
diff --git a/common/utils.c b/common/utils.c
index 4c68eec..15a2452 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -1130,7 +1130,7 @@ int run_check(char *processed_command, char **ret) {
 
 
 /* execute this command with given timeout */
-int execute_safe_command(gm_job_t * exec_job, int fork_exec, char * hostname) {
+int execute_safe_command(gm_job_t * exec_job, int fork_exec, char * identifier) {
     int pdes[2];
     int return_code;
     int pclose_result;
@@ -1188,7 +1188,7 @@ int execute_safe_command(gm_job_t * exec_job, int fork_exec, char * hostname) {
 
             if(pclose_result == -1) {
                 char error[GM_BUFFERSIZE];
-                snprintf(error, sizeof(error), "error on %s: %s", hostname, strerror(errno));
+                snprintf(error, sizeof(error), "error on %s: %s", identifier, strerror(errno));
                 if(write(pdes[1], error, strlen(error)+1) <= 0)
                     perror("write");
             }
@@ -1220,17 +1220,17 @@ int execute_safe_command(gm_job_t * exec_job, int fork_exec, char * hostname) {
         /* file not executable? */
         if(return_code == 126) {
             return_code = STATE_CRITICAL;
-            snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of 126 is out of bounds. Make sure the plugin you're trying to run is executable. (worker: %s)", hostname);
+            snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of 126 is out of bounds. Make sure the plugin you're trying to run is executable. (worker: %s)", identifier);
         }
         /* file not found errors? */
         else if(return_code == 127) {
             return_code = STATE_CRITICAL;
-            snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of 127 is out of bounds. Make sure the plugin you're trying to run actually exists. (worker: %s)", hostname);
+            snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of 127 is out of bounds. Make sure the plugin you're trying to run actually exists. (worker: %s)", identifier);
         }
         /* signaled */
         else if(return_code >= 128 && return_code < 144) {
             char * signame = nr2signal((int)(return_code-128));
-            snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of %d is out of bounds. Plugin exited by signal %s. (worker: %s)\n%s", (int)(return_code), signame, hostname, buffer);
+            snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of %d is out of bounds. Plugin exited by signal %s. (worker: %s)\n%s", (int)(return_code), signame, identifier, buffer);
             return_code = STATE_CRITICAL;
             free(signame);
         }
@@ -1238,7 +1238,7 @@ int execute_safe_command(gm_job_t * exec_job, int fork_exec, char * hostname) {
         else if(return_code > 3) {
             gm_log( GM_LOG_INFO, "check exited with exit code > 3. Exit: %d\n", (int)(return_code));
             gm_log( GM_LOG_INFO, "stdout: %s\n", buffer);
-            snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of %d is out of bounds. (worker: %s)\n%s\n", (int)(return_code), hostname, buffer);
+            snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of %d is out of bounds. (worker: %s)\n%s\n", (int)(return_code), identifier, buffer);
             return_code = STATE_CRITICAL;
         }
 
@@ -1261,9 +1261,9 @@ int execute_safe_command(gm_job_t * exec_job, int fork_exec, char * hostname) {
         exec_job->return_code   = 2;
         exec_job->early_timeout = 1;
         if ( !strcmp( exec_job->type, "service" ) )
-            snprintf( buffer, sizeof( buffer ) -1, "(Service Check Timed Out On Worker: %s)", hostname);
+            snprintf( buffer, sizeof( buffer ) -1, "(Service Check Timed Out On Worker: %s)", identifier);
         if ( !strcmp( exec_job->type, "host" ) )
-            snprintf( buffer, sizeof( buffer ) -1, "(Host Check Timed Out On Worker: %s)", hostname);
+            snprintf( buffer, sizeof( buffer ) -1, "(Host Check Timed Out On Worker: %s)", identifier);
         exec_job->output = strdup( buffer );
     }
 
diff --git a/include/utils.h b/include/utils.h
index d671a9f..008d6ce 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -334,11 +334,11 @@ int run_check(char *processed_command, char **plugin_output);
  *
  * @param[in] exec_job - job structure
  * @param[in] fork_exec - fork or not before exec
- * @param[in] hostname - current worker hostname
+ * @param[in] identifier - current worker identifier
  *
  * @return true on success
  */
-int execute_safe_command(gm_job_t * exec_job, int fork_exec, char * hostname);
+int execute_safe_command(gm_job_t * exec_job, int fork_exec, char * identifier);
 
 /**
  *
diff --git a/worker/worker_client.c b/worker/worker_client.c
index dc9b913..1ff86e6 100644
--- a/worker/worker_client.c
+++ b/worker/worker_client.c
@@ -326,7 +326,7 @@ void do_exec_job( ) {
 
     /* run the command */
     gm_log( GM_LOG_TRACE, "command: %s\n", exec_job->command_line);
-    execute_safe_command(exec_job, mod_gm_opt->fork_on_exec, hostname);
+    execute_safe_command(exec_job, mod_gm_opt->fork_on_exec, mod_gm_opt->identifier );
 
     if ( !strcmp( exec_job->type, "service" ) || !strcmp( exec_job->type, "host" ) ) {
         send_result_back();

-- 
Debian packaging for mod gearman.



More information about the Pkg-nagios-changes mailing list