[-]
[+]
|
Changed |
nagios-mod_gearman.changes
|
|
[-]
[+]
|
Changed |
nagios-mod_gearman.spec
^
|
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/Changes
^
|
@@ -1,5 +1,10 @@
This file documents the revision history for mod_gearman.
+1.2.4 Mon Feb 27 23:54:39 CET 2012
+ - fixed eventhandlers not being passed to worker
+ - fixed shared memory not beeing cleaned on exit
+ - internal changes to support freebsd
+
1.2.2 Tue Feb 7 18:06:02 CET 2012
- orphaned hosts/services generate a fake result with useful error message
- bypass eventhandler from hosts/services in local host/servicegroups
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/Makefile.am
^
|
@@ -13,7 +13,7 @@
.PHONY: docs
AM_CPPFLAGS=-Iinclude
-OS=`uname`
+OS=$(shell uname)
if USEPERL
P1FILE = worker/mod_gearman_p1.pl
@@ -81,7 +81,11 @@
03_exec_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/03-exec_checks.c $(common_check_SOURCES)
04_log_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/04-log.c
05_neb_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/05-neb.c
-05_neb_LDADD = -ldl
+if USEBSD
+05_neb_LDADD=
+else
+05_neb_LDADD=-ldl
+endif
05_neb_LDFLAGS = --export-dynamic -rdynamic
07_epn_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/07-epn.c $(common_check_SOURCES)
# only used for performance tests
@@ -110,7 +114,7 @@
# other targets
mod_gearman.o: $(mod_gearman_so_OBJECTS) $(mod_gearman_so_DEPENDENCIES)
@echo ' $$(CC) $<'
- @if [ "$(OS)" == "Darwin" ]; then \
+ @if [ "$(OS)" = "Darwin" ]; then \
$(CXX) $(LDFLAGS) -dynamiclib -single_module -undefined dynamic_lookup $(mod_gearman_so_OBJECTS) -o $@ -lpthread -lgearman; \
else \
$(CXX) $(LDFLAGS) -fPIC -shared $(mod_gearman_so_OBJECTS) -o $@ -lpthread -lgearman; \
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/Makefile.in
^
|
@@ -293,7 +293,7 @@
RPM_TOPDIR = $$(pwd)/rpm.topdir
DOS2UNIX = $(shell which dos2unix || which fromdos)
AM_CPPFLAGS = -Iinclude
-OS = `uname`
+OS = $(shell uname)
@USEPERL_FALSE@P1FILE =
@USEPERL_TRUE@P1FILE = worker/mod_gearman_p1.pl
@USEPERL_FALSE@PERLLIB =
@@ -349,7 +349,8 @@
03_exec_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/03-exec_checks.c $(common_check_SOURCES)
04_log_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/04-log.c
05_neb_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/05-neb.c
-05_neb_LDADD = -ldl
+@USEBSD_FALSE@05_neb_LDADD = -ldl
+@USEBSD_TRUE@05_neb_LDADD =
05_neb_LDFLAGS = --export-dynamic -rdynamic
07_epn_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/07-epn.c $(common_check_SOURCES)
# only used for performance tests
@@ -1129,7 +1130,7 @@
# other targets
mod_gearman.o: $(mod_gearman_so_OBJECTS) $(mod_gearman_so_DEPENDENCIES)
@echo ' $$(CC) $<'
- @if [ "$(OS)" == "Darwin" ]; then \
+ @if [ "$(OS)" = "Darwin" ]; then \
$(CXX) $(LDFLAGS) -dynamiclib -single_module -undefined dynamic_lookup $(mod_gearman_so_OBJECTS) -o $@ -lpthread -lgearman; \
else \
$(CXX) $(LDFLAGS) -fPIC -shared $(mod_gearman_so_OBJECTS) -o $@ -lpthread -lgearman; \
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/README
^
|
@@ -38,7 +38,7 @@
Download
--------
- * Latest stable http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.2.tar.gz[version 1.2.2], released February 07 2012
+ * Latest stable http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.4.tar.gz[version 1.2.4], released February 27 2012
* Mod Gearman is available for download at: http://labs.consol.de/nagios/mod-gearman
* Source is available on GitHub: http://github.com/sni/mod_gearman
* Older versions are available in the <<_archive,download archive>>.
@@ -635,11 +635,22 @@
====
+job_timeout::
+Default job timeout in seconds. Currently this value is only used for
+eventhandler. The worker will use the values from the core for host
+and service checks.
+Default: 60
++
+====
+ job_timeout=60
+====
+
+
min-worker::
Minimum number of worker processes which should run at any time. Default: 1
+
====
- min-worker=1
+ min-worker=1
====
@@ -669,7 +680,7 @@
waiting. Set to 0 to disable the idle timeout. Default: 10
+
====
- idle-timeout=30
+ idle-timeout=30
====
@@ -1045,6 +1056,7 @@
Archive
-------
+* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.4.tar.gz[version 1.2.4 - February 27 2012]
* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.2.tar.gz[version 1.2.2 - February 07 2012]
* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.0.tar.gz[version 1.2.0 - January 08 2012]
* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.1.1.tar.gz[version 1.1.1 - November 10 2011]
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/common/check_utils.c
^
|
@@ -388,6 +388,16 @@
gm_log( GM_LOG_TRACE, "check_alarm_handler(%i)\n", sig );
if(current_job != NULL && mod_gm_opt->fork_on_exec == GM_DISABLED) {
+ /* create a useful log message*/
+ if ( !strcmp( current_job->type, "service" ) ) {
+ gm_log( GM_LOG_INFO, "timeout (%is) hit for servicecheck: %s - %s\n", current_job->timeout, current_job->host_name, current_job->service_description);
+ }
+ else if ( !strcmp( current_job->type, "host" ) ) {
+ gm_log( GM_LOG_INFO, "timeout (%is) hit for hostcheck: %s\n", current_job->timeout, current_job->host_name);
+ }
+ else if ( !strcmp( current_job->type, "eventhandler" ) ) {
+ gm_log( GM_LOG_INFO, "timeout (%is) hit for eventhandler: %s\n", current_job->timeout, current_job->command_line);
+ }
send_timeout_result(current_job);
gearman_job_send_complete(current_gearman_job, NULL, 0);
}
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/common/gearman.c
^
|
@@ -29,7 +29,7 @@
struct timeval mod_gm_error_time;
/* create the gearman worker */
-int create_worker( char ** server_list, gearman_worker_st *worker ) {
+int create_worker( gm_server_t * server_list[GM_LISTSIZE], gearman_worker_st *worker ) {
int x = 0;
gearman_return_t ret;
@@ -42,21 +42,11 @@
}
while ( server_list[x] != NULL ) {
- char * server = strdup( server_list[x] );
- char * server_c = server;
- char * host = strsep( &server, ":" );
- char * port_val = strsep( &server, "\x0" );
- in_port_t port = GM_SERVER_DEFAULT_PORT;
- if(port_val != NULL) {
- port = ( in_port_t ) atoi( port_val );
- }
- ret = gearman_worker_add_server( worker, host, port );
+ ret = gearman_worker_add_server( worker, server_list[x]->host, server_list[x]->port );
if ( ret != GEARMAN_SUCCESS ) {
gm_log( GM_LOG_ERROR, "worker error: %s\n", gearman_worker_error( worker ) );
- free(server_c);
return GM_ERROR;
}
- free(server_c);
x++;
}
assert(x != 0);
@@ -79,7 +69,7 @@
/* create the gearman duplicate client */
-int create_client_dup( char ** server_list, gearman_client_st *client ) {
+int create_client_dup( gm_server_t * server_list[GM_LISTSIZE], gearman_client_st *client ) {
gearman_return_t ret;
int x = 0;
@@ -94,21 +84,11 @@
}
while ( server_list[x] != NULL ) {
- char * server = strdup( server_list[x] );
- char * server_c = server;
- char * host = strsep( &server, ":" );
- char * port_val = strsep( &server, "\x0" );
- in_port_t port = GM_SERVER_DEFAULT_PORT;
- if(port_val != NULL) {
- port = ( in_port_t ) atoi( port_val );
- }
- ret = gearman_client_add_server( client, host, port );
+ ret = gearman_client_add_server( client, server_list[x]->host, server_list[x]->port );
if ( ret != GEARMAN_SUCCESS ) {
gm_log( GM_LOG_ERROR, "client error: %s\n", gearman_client_error( client ) );
- free(server_c);
return GM_ERROR;
}
- free(server_c);
x++;
}
@@ -118,7 +98,7 @@
}
/* create the gearman client */
-int create_client( char ** server_list, gearman_client_st *client ) {
+int create_client( gm_server_t * server_list[GM_LISTSIZE], gearman_client_st *client ) {
gearman_return_t ret;
int x = 0;
@@ -133,21 +113,11 @@
}
while ( server_list[x] != NULL ) {
- char * server = strdup( server_list[x] );
- char * server_c = server;
- char * host = strsep( &server, ":" );
- char * port_val = strsep( &server, "\x0" );
- in_port_t port = GM_SERVER_DEFAULT_PORT;
- if(port_val != NULL) {
- port = ( in_port_t ) atoi( port_val );
- }
- ret = gearman_client_add_server( client, host, port );
+ ret = gearman_client_add_server( client, server_list[x]->host, server_list[x]->port );
if ( ret != GEARMAN_SUCCESS ) {
gm_log( GM_LOG_ERROR, "client error: %s\n", gearman_client_error( client ) );
- free(server_c);
return GM_ERROR;
}
- free(server_c);
x++;
}
assert(x != 0);
@@ -160,7 +130,7 @@
/* create a task and send it */
-int add_job_to_queue( gearman_client_st *client, char ** server_list, char * queue, char * uniq, char * data, int priority, int retries, int transport_mode, int send_now ) {
+int add_job_to_queue( gearman_client_st *client, gm_server_t * server_list[GM_LISTSIZE], char * queue, char * uniq, char * data, int priority, int retries, int transport_mode, int send_now ) {
gearman_task_st *task = NULL;
gearman_return_t ret1, ret2;
char * crypted_data;
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/common/gearman_utils.c
^
|
@@ -27,7 +27,7 @@
/* get worker/jobs data from gearman server */
-int get_gearman_server_data(mod_gm_server_status_t *stats, char ** message, char ** version, char * hostname, int port) {
+int get_gearman_server_data(mod_gm_server_status_t *stats, char ** message, char ** version, char * hostnam, int port) {
int sockfd, n;
struct sockaddr_in serv_addr;
struct hostent *server;
@@ -53,9 +53,9 @@
return( STATE_CRITICAL );
}
- server = gethostbyname(hostname);
+ server = gethostbyname(hostnam);
if( server == NULL ) {
- snprintf(*message, GM_BUFFERSIZE, "failed to resolve %s\n", hostname);
+ snprintf(*message, GM_BUFFERSIZE, "failed to resolve %s\n", hostnam);
return( STATE_CRITICAL );
}
serv_addr.sin_family = AF_INET;
@@ -64,7 +64,7 @@
server->h_length);
serv_addr.sin_port = htons(port);
if (connect(sockfd,(const struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) {
- snprintf(*message, GM_BUFFERSIZE, "failed to connect to %s:%i - %s\n", hostname, (int)port, strerror(errno));
+ snprintf(*message, GM_BUFFERSIZE, "failed to connect to %s:%i - %s\n", hostnam, (int)port, strerror(errno));
close(sockfd);
return( STATE_CRITICAL );
}
@@ -72,7 +72,7 @@
cmd = "status\nversion\n";
n = write(sockfd,cmd,strlen(cmd));
if (n < 0) {
- snprintf(*message, GM_BUFFERSIZE, "failed to send to %s:%i - %s\n", hostname, (int)port, strerror(errno));
+ snprintf(*message, GM_BUFFERSIZE, "failed to send to %s:%i - %s\n", hostnam, (int)port, strerror(errno));
close(sockfd);
return( STATE_CRITICAL );
}
@@ -80,7 +80,7 @@
n = read( sockfd, buf, GM_BUFFERSIZE-1 );
buf[n] = '\x0';
if (n < 0) {
- snprintf(*message, GM_BUFFERSIZE, "error reading from %s:%i - %s\n", hostname, (int)port, strerror(errno));
+ snprintf(*message, GM_BUFFERSIZE, "error reading from %s:%i - %s\n", hostnam, (int)port, strerror(errno));
close(sockfd);
return( STATE_CRITICAL );
}
@@ -137,7 +137,7 @@
gm_log( GM_LOG_DEBUG, "%i: name:%-20s worker:%-5i waiting:%-5i running:%-5i\n", stats->function_num, func->queue, func->worker, func->waiting, func->running );
}
- snprintf(*message, GM_BUFFERSIZE, "got no valid data from %s:%i\n", hostname, (int)port);
+ snprintf(*message, GM_BUFFERSIZE, "got no valid data from %s:%i\n", hostnam, (int)port);
free(output_c);
close(sockfd);
return( STATE_UNKNOWN );
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/common/utils.c
^
|
@@ -621,7 +621,7 @@
/* idle-timeout */
else if ( !strcmp( key, "idle-timeout" ) ) {
opt->idle_timeout = atoi( value );
- if(opt->idle_timeout < 0) { opt->job_timeout = GM_DEFAULT_IDLE_TIMEOUT; }
+ if(opt->idle_timeout < 0) { opt->idle_timeout = GM_DEFAULT_IDLE_TIMEOUT; }
}
/* max-jobs */
@@ -649,11 +649,7 @@
else if ( !strcmp( key, "server" ) ) {
char *servername;
while ( (servername = strsep( &value, "," )) != NULL ) {
- char * new_server = get_param_server(servername, opt->server_list, opt->server_num);
- if(new_server != NULL) {
- opt->server_list[opt->server_num] = new_server;
- opt->server_num++;
- }
+ add_server(&opt->server_num, opt->server_list, servername);
}
}
@@ -661,11 +657,7 @@
else if ( !strcmp( key, "dupserver" ) ) {
char *servername;
while ( (servername = strsep( &value, "," )) != NULL ) {
- char * new_server = get_param_server(servername, opt->dupserver_list, opt->dupserver_num);
- if(new_server != NULL) {
- opt->dupserver_list[opt->dupserver_num] = new_server;
- opt->dupserver_num++;
- }
+ add_server(&opt->dupserver_num, opt->dupserver_list, servername);
}
}
@@ -891,10 +883,10 @@
/* server && queues */
for(i=0;i<opt->server_num;i++)
- gm_log( GM_LOG_DEBUG, "server: %s\n", opt->server_list[i]);
+ gm_log( GM_LOG_DEBUG, "server: %s:%i\n", opt->server_list[i]->host, opt->server_list[i]->port);
gm_log( GM_LOG_DEBUG, "\n" );
for(i=0;i<opt->dupserver_num;i++)
- gm_log( GM_LOG_DEBUG, "dupserver: %s\n", opt->dupserver_list[i]);
+ gm_log( GM_LOG_DEBUG, "dupserver: %s:%i\n", opt->dupserver_list[i]->host, opt->dupserver_list[i]->port);
gm_log( GM_LOG_DEBUG, "\n" );
if(mode == GM_NEB_MODE) {
gm_log( GM_LOG_DEBUG, "perfdata: %s\n", opt->perfdata == GM_ENABLED ? "yes" : "no");
@@ -947,10 +939,14 @@
if(opt == NULL)
return;
int i,j;
- for(i=0;i<opt->server_num;i++)
+ for(i=0;i<opt->server_num;i++) {
+ free(opt->server_list[i]->host);
free(opt->server_list[i]);
- for(i=0;i<opt->dupserver_num;i++)
+ }
+ for(i=0;i<opt->dupserver_num;i++) {
+ free(opt->dupserver_list[i]->host);
free(opt->dupserver_list[i]);
+ }
for(i=0;i<opt->hostgroups_num;i++)
free(opt->hostgroups_list[i]);
for(i=0;i<opt->servicegroups_num;i++)
@@ -1565,36 +1561,16 @@
return;
}
-/* extract server from string and check for duplicates */
-char * get_param_server(char * servername, char * server_list[GM_LISTSIZE], int server_num) {
- char temp_buffer[GM_BUFFERSIZE];
- char * new_server;
+/* check server for duplicates */
+int check_param_server(gm_server_t * new_server, gm_server_t * server_list[GM_LISTSIZE], int server_num) {
int i;
- servername = trim(servername);
-
- if ( ! strcmp( servername, "" ) ) {
- return NULL;
- }
-
- if(strcspn(servername, ":") == 0) {
- temp_buffer[0]='\x0';
- snprintf( temp_buffer,sizeof( temp_buffer )-1, "localhost%s", servername);
- temp_buffer[sizeof( temp_buffer )-1]='\x0';
- new_server = strdup(temp_buffer);
- } else {
- new_server = strdup(servername);
- }
-
- // check for duplicates
for(i=0;i<server_num;i++) {
- if ( ! strcmp( new_server, server_list[i] ) ) {
- gm_log( GM_LOG_ERROR, "duplicate definition of server: %s\n", new_server);
- free(new_server);
- return NULL;
+ if ( ! strcmp( new_server->host, server_list[i]->host ) && new_server->port == server_list[i]->port ) {
+ gm_log( GM_LOG_ERROR, "duplicate definition of server: %s:%i\n", new_server->host, new_server->port);
+ return GM_ERROR;
}
}
-
- return new_server;
+ return GM_OK;
}
@@ -1728,3 +1704,32 @@
return result;
}
+
+/* add parsed server to list */
+void add_server(int * server_num, gm_server_t * server_list[GM_LISTSIZE], char * servername) {
+ char * server = strdup( servername );
+ char * server_c = server;
+ char * host = strsep( &server, ":" );
+ char * port_val = strsep( &server, "\x0" );
+ in_port_t port = GM_SERVER_DEFAULT_PORT;
+ if(port_val != NULL) {
+ port = ( in_port_t ) atoi( port_val );
+ }
+ gm_server_t *new_server;
+ new_server = malloc(sizeof(gm_server_t));
+ if(!strcmp(host, "")) {
+ new_server->host = strdup("localhost");
+ } else {
+ new_server->host = strdup(host);
+ }
+ new_server->port = port;
+ if(check_param_server(new_server, server_list, *server_num) == GM_OK) {
+ server_list[*server_num] = new_server;
+ *server_num = *server_num + 1;
+ } else {
+ free(new_server->host);
+ free(new_server);
+ }
+ free(server_c);
+ return;
+}
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/configure
^
|
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for mod_gearman 1.2.2.
+# Generated by GNU Autoconf 2.65 for mod_gearman 1.2.4.
#
# Report bugs to <sven.nierlein@consol.de>.
#
@@ -552,8 +552,8 @@
# Identity of this package.
PACKAGE_NAME='mod_gearman'
PACKAGE_TARNAME='mod_gearman'
-PACKAGE_VERSION='1.2.2'
-PACKAGE_STRING='mod_gearman 1.2.2'
+PACKAGE_VERSION='1.2.4'
+PACKAGE_STRING='mod_gearman 1.2.4'
PACKAGE_BUGREPORT='sven.nierlein@consol.de'
PACKAGE_URL=''
@@ -598,6 +598,8 @@
am__EXEEXT_TRUE
LTLIBOBJS
LN_S
+USEBSD_FALSE
+USEBSD_TRUE
PERLLIBS
USEPERL_FALSE
USEPERL_TRUE
@@ -1254,7 +1256,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures mod_gearman 1.2.2 to adapt to many kinds of systems.
+\`configure' configures mod_gearman 1.2.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1320,7 +1322,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of mod_gearman 1.2.2:";;
+ short | recursive ) echo "Configuration of mod_gearman 1.2.4:";;
esac
cat <<\_ACEOF
@@ -1419,7 +1421,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-mod_gearman configure 1.2.2
+mod_gearman configure 1.2.4
generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -1882,7 +1884,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by mod_gearman $as_me 1.2.2, which was
+It was created by mod_gearman $as_me 1.2.4, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -2690,7 +2692,7 @@
# Define the identity of the package.
PACKAGE='mod_gearman'
- VERSION='1.2.2'
+ VERSION='1.2.4'
cat >>confdefs.h <<_ACEOF
@@ -5380,7 +5382,7 @@
USEPERL_FALSE=
fi
-if test "$USEPERL" == "yes"; then
+if test "$USEPERL" = "yes"; then
tmp=$LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl_alloc in -lperl" >&5
$as_echo_n "checking for perl_alloc in -lperl... " >&6; }
@@ -5444,6 +5446,16 @@
fi
##############################################
+ if test "$(uname)" = "FreeBSD"; then
+ USEBSD_TRUE=
+ USEBSD_FALSE='#'
+else
+ USEBSD_TRUE='#'
+ USEBSD_FALSE=
+fi
+
+
+##############################################
# Check some functions
for ac_func in gettimeofday strsep strtok strdup strchr strstr strtoul alarm gethostname memset strcspn strerror atexit gethostbyname socket dup2 localtime_r memmove strpbrk
do :
@@ -5624,6 +5636,10 @@
as_fn_error "conditional \"USEPERL\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${USEBSD_TRUE}" && test -z "${USEBSD_FALSE}"; then
+ as_fn_error "conditional \"USEBSD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
@@ -6032,7 +6048,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by mod_gearman $as_me 1.2.2, which was
+This file was extended by mod_gearman $as_me 1.2.4, which was
generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6098,7 +6114,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-mod_gearman config.status 1.2.2
+mod_gearman config.status 1.2.4
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/configure.ac
^
|
@@ -4,7 +4,7 @@
##############################################
# autoconf really does not work with 2.59 or older
AC_PREREQ([2.60])
-AC_INIT([mod_gearman], [1.2.2], [sven.nierlein@consol.de])
+AC_INIT([mod_gearman], [1.2.4], [sven.nierlein@consol.de])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
AC_CONFIG_SRCDIR([neb_module/mod_gearman.c],[worker/worker.c],[tools/send_gearman.c],[tools/check_gearman.c],[tools/gearman_top.c])
AC_CONFIG_HEADER([config.h])
@@ -79,7 +79,7 @@
dnl Is embedded Perl being compiled in?
AM_CONDITIONAL(USEPERL, test "$USEPERL" = "yes")
-if test "$USEPERL" == "yes"; then
+if test "$USEPERL" = "yes"; then
tmp=$LIBS
AC_CHECK_LIB([perl],[perl_alloc],,AC_MSG_ERROR([Compiling Mod-Gearman with embedded Perl requires libperl.]),[`perl -MExtUtils::Embed -e ccopts -e ldopts`])
# save libs, as we do not want to add -lperl to all LIBS
@@ -93,6 +93,9 @@
fi
##############################################
+AM_CONDITIONAL(USEBSD, test "$(uname)" = "FreeBSD")
+
+##############################################
# Check some functions
AC_CHECK_FUNCS([gettimeofday strsep strtok strdup strchr strstr strtoul alarm gethostname memset strcspn strerror atexit gethostbyname socket dup2 localtime_r memmove strpbrk])
AC_PROG_LN_S
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/docs/QUICKSTART
^
|
@@ -54,9 +54,9 @@
--------------------------------------
#> cd /tmp
-#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.2.tar.gz"
-#> tar zxf mod_gearman-1.2.2.tar.gz
-#> cd mod_gearman-1.2.2
+#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.4.tar.gz"
+#> tar zxf mod_gearman-1.2.4.tar.gz
+#> cd mod_gearman-1.2.4
#> ./configure --prefix=/opt --with-gearman=/opt --with-user=nagios --with-init-dir=/etc/init.d
#> make
#> make install
@@ -120,7 +120,7 @@
--------------------------------------
#> grep mod_gearman /var/log/nagios3/nagios.log
-[1295003042] mod_gearman: Version 1.2.2
+[1295003042] mod_gearman: Version 1.2.4
[1295003042] Event broker module '/opt/lib/mod_gearman/mod_gearman.o' initialized successfully.
--------------------------------------
@@ -154,7 +154,7 @@
--------------------------------------
#> /opt/bin/check_gearman -H localhost -q worker_`hostname` -t 10 -s check
-check_gearman OK - debian64 has 1 worker and is working on 0 jobs. Version: 1.2.2|worker=1 jobs=2c
+check_gearman OK - debian64 has 1 worker and is working on 0 jobs. Version: 1.2.4|worker=1 jobs=2c
--------------------------------------
The interesting number is the last one, '2c' in our case, which means there
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/docs/QUICKSTART.html
^
|
@@ -614,9 +614,9 @@
<div class="listingblock">
<div class="content">
<pre><tt>#> cd /tmp
-#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.2.tar.gz"
-#> tar zxf mod_gearman-1.2.2.tar.gz
-#> cd mod_gearman-1.2.2
+#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.4.tar.gz"
+#> tar zxf mod_gearman-1.2.4.tar.gz
+#> cd mod_gearman-1.2.4
#> ./configure --prefix=/opt --with-gearman=/opt --with-user=nagios --with-init-dir=/etc/init.d
#> make
#> make install
@@ -674,7 +674,7 @@
<div class="listingblock">
<div class="content">
<pre><tt>#> grep mod_gearman /var/log/nagios3/nagios.log
-[1295003042] mod_gearman: Version 1.2.2
+[1295003042] mod_gearman: Version 1.2.4
[1295003042] Event broker module '/opt/lib/mod_gearman/mod_gearman.o' initialized successfully.</tt></pre>
</div></div>
</div>
@@ -701,7 +701,7 @@
<div class="listingblock">
<div class="content">
<pre><tt>#> /opt/bin/check_gearman -H localhost -q worker_`hostname` -t 10 -s check
-check_gearman OK - debian64 has 1 worker and is working on 0 jobs. Version: 1.2.2|worker=1 jobs=2c</tt></pre>
+check_gearman OK - debian64 has 1 worker and is working on 0 jobs. Version: 1.2.4|worker=1 jobs=2c</tt></pre>
</div></div>
<div class="paragraph"><p>The interesting number is the last one, <em>2c</em> in our case, which means there
have been already 2 jobs executed by this worker.</p></div>
@@ -741,7 +741,7 @@
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2012-02-07 18:12:42 CEST
+Last updated 2012-02-27 23:54:23 CEST
</div>
</div>
</body>
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/docs/README.html
^
|
@@ -640,7 +640,7 @@
<div class="ulist"><ul>
<li>
<p>
-Latest stable <a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.2.tar.gz">version 1.2.2</a>, released February 07 2012
+Latest stable <a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.4.tar.gz">version 1.2.4</a>, released February 27 2012
</p>
</li>
<li>
@@ -1485,6 +1485,24 @@
</div></div>
</dd>
<dt class="hdlist1">
+job_timeout
+</dt>
+<dd>
+<p>
+Default job timeout in seconds. Currently this value is only used for
+eventhandler. The worker will use the values from the core for host
+and service checks.
+Default: 60
+</p>
+<div class="exampleblock">
+<div class="exampleblock-content">
+<div class="literalblock">
+<div class="content">
+<pre><tt>job_timeout=60</tt></pre>
+</div></div>
+</div></div>
+</dd>
+<dt class="hdlist1">
min-worker
</dt>
<dd>
@@ -2069,6 +2087,11 @@
<div class="ulist"><ul>
<li>
<p>
+<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.4.tar.gz">version 1.2.4 - February 27 2012</a>
+</p>
+</li>
+<li>
+<p>
<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.2.2.tar.gz">version 1.2.2 - February 07 2012</a>
</p>
</li>
@@ -2178,7 +2201,7 @@
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2012-02-07 18:10:36 CEST
+Last updated 2012-02-27 23:55:50 CEST
</div>
</div>
</body>
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/etc/mod_gearman_worker.conf.in
^
|
@@ -104,6 +104,11 @@
# Path to the pidfile. Usually set by the init script
#pidfile=%PIDFILE%
+# Default job timeout in seconds. Currently this value is only used for
+# eventhandler. The worker will use the values from the core for host and
+# service checks.
+job_timeout=60
+
# Minimum number of worker processes which should
# run at any time.
min-worker=5
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/extras/standalone_worker.conf
^
|
@@ -95,6 +95,11 @@
# Path to the logfile.
logfile=./worker.log
+# Default job timeout in seconds. Currently this value is only used for
+# eventhandler. The worker will use the values from the core for host and
+# service checks.
+job_timeout=60
+
# Minimum number of worker processes which should
# run at any time.
min-worker=1
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/include/check_gearman.h
^
|
@@ -85,7 +85,7 @@
*
* @return returns a nagios compatible exit code
*/
-int check_server(char * server);
+int check_server(char * server, in_port_t port);
/**
*
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/include/common.h
^
|
@@ -48,12 +48,13 @@
#include <config.h>
#include <stdio.h>
#include <sys/time.h>
+#include <arpa/inet.h>
#ifndef MOD_GM_COMMON_H
#define MOD_GM_COMMON_H
/* constants */
-#define GM_VERSION "1.2.2"
+#define GM_VERSION "1.2.4"
#define GM_ENABLED 1
#define GM_DISABLED 0
#define GM_BUFFERSIZE 98304
@@ -152,6 +153,16 @@
int elem_number; /**< number of elements */
} mod_gm_exp_t;
+/** server structure
+ *
+ * structure for server definition
+ *
+ */
+typedef struct gm_server {
+ char * host; /**< hostname of server */
+ in_port_t port; /**< port number */
+} gm_server_t;
+
/** options structure
*
* structure union for all components
@@ -163,9 +174,9 @@
char * crypt_key; /**< encryption key used for securing the messages sent over gearman */
char * keyfile; /**< path to a file where the crypt_key is read from */
- char * server_list[GM_LISTSIZE]; /**< list of gearmand servers */
+ gm_server_t * server_list[GM_LISTSIZE]; /**< list of gearmand servers */
int server_num; /**< number of gearmand servers */
- char * dupserver_list[GM_LISTSIZE]; /**< list of gearmand servers to duplicate results */
+ gm_server_t * dupserver_list[GM_LISTSIZE]; /**< list of gearmand servers to duplicate results */
int dupserver_num; /**< number of duplicate gearmand servers */
char * hostgroups_list[GM_LISTSIZE]; /**< list of hostgroups which get own queues */
int hostgroups_num; /**< number of elements in hostgroups_list */
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/include/gearman.h
^
|
@@ -41,10 +41,10 @@
gearman_client_st *current_client_dup;
gearman_job_st *current_gearman_job;
-int create_client( char ** server_list, gearman_client_st * client);
-int create_client_dup( char ** server_list, gearman_client_st * client);
-int create_worker( char ** server_list, gearman_worker_st * worker);
-int add_job_to_queue( gearman_client_st *client, char ** server_list, char * queue, char * uniq, char * data, int priority, int retries, int transport_mode, int send_now );
+int create_client( gm_server_t * server_list[GM_LISTSIZE], gearman_client_st * client);
+int create_client_dup( gm_server_t * server_list[GM_LISTSIZE], gearman_client_st * client);
+int create_worker( gm_server_t * server_list[GM_LISTSIZE], gearman_worker_st * worker);
+int add_job_to_queue( gearman_client_st *client, gm_server_t * server_list[GM_LISTSIZE], char * queue, char * uniq, char * data, int priority, int retries, int transport_mode, int send_now );
int worker_add_function( gearman_worker_st * worker, char * queue, gearman_worker_fn *function);
void *dummy( gearman_job_st *, void *, size_t *, gearman_return_t * );
void free_client(gearman_client_st *client);
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/include/utils.h
^
|
@@ -410,17 +410,17 @@
void write_core_log(char *data);
/**
- * get_param_server
+ * check_param_server
*
- * return string of new server or NULL on duplicate
+ * check if server is already in the list
*
- * @param[in] servername - server name to parse
+ * @param[in] new_server - server to check
* @param[in] server_list - list of servers to check for duplicates
* @param[in] server_num - number of server in this list
*
* @returns the new server name or NULL
*/
-char * get_param_server(char * servername, char * server_list[GM_LISTSIZE], int server_num);
+int check_param_server(gm_server_t * new_server, gm_server_t * server_list[GM_LISTSIZE], int server_num);
/**
* send_result_back
@@ -445,5 +445,18 @@
char *md5sum(char *text);
/**
+ * add_server(
+ *
+ * adds parsed server to list
+ *
+ * @param[in] server_num - insert server at that point
+ * @param[in] server_list - add server to this list
+ * @param[in] servername - parse and add this server
+ *
+ * @return nothing
+ */
+void add_server(int * server_num, gm_server_t * server_list[GM_LISTSIZE], char * servername);
+
+/**
* @}
*/
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/neb_module/mod_gearman.c
^
|
@@ -391,15 +391,21 @@
nebstruct_event_handler_data * ds;
host * hst = NULL;
service * svc = NULL;
+ struct timeval start_time;
- gm_log( GM_LOG_DEBUG, "got eventhandler event\n" );
gm_log( GM_LOG_TRACE, "handle_eventhandler(%i, data)\n", event_type );
- if ( event_type != NEBTYPE_EVENTHANDLER_START )
+ if ( event_type != NEBCALLBACK_EVENT_HANDLER_DATA )
return NEB_OK;
ds = ( nebstruct_event_handler_data * )data;
+ if ( ds->type != NEBTYPE_EVENTHANDLER_START ) {
+ gm_log( GM_LOG_TRACE, "skiped type %i, expecting: %i\n", ds->type, NEBTYPE_EVENTHANDLER_START );
+ return NEB_OK;
+ }
+
+ gm_log( GM_LOG_DEBUG, "got eventhandler event\n" );
gm_log( GM_LOG_TRACE, "got eventhandler event: %s\n", ds->command_line );
/* service event handler? */
@@ -432,7 +438,12 @@
}
temp_buffer[0]='\x0';
- snprintf( temp_buffer,GM_BUFFERSIZE-1,"type=eventhandler\ncommand_line=%s\n\n\n",ds->command_line );
+ gettimeofday(&start_time,NULL);
+ snprintf( temp_buffer,GM_BUFFERSIZE-1,
+ "type=eventhandler\nstart_time=%i.0\ncommand_line=%s\n\n\n",
+ (int)start_time.tv_sec,
+ ds->command_line
+ );
if(add_job_to_queue( &client,
mod_gm_opt->server_list,
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/support/mod_gearman.spec
^
|
@@ -1,5 +1,5 @@
Name: mod_gearman
-Version: 1.2.2
+Version: 1.2.4
Release: 1%{?dist}
License: GNU Public License version 2
Packager: Sven Nierlein <sven.nierlein@consol.de>
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/01-utils.c
^
|
@@ -29,7 +29,7 @@
}
int main(void) {
- plan(60);
+ plan(65);
/* lowercase */
char test[100];
@@ -170,14 +170,16 @@
mod_gm_opt = renew_opts();
strcpy(test, "server=host:4730");
parse_args_line(mod_gm_opt, test, 0);
- like(mod_gm_opt->server_list[0], "host:4730", "server=host:4730");
+ like(mod_gm_opt->server_list[0]->host, "host", "server=host:4730");
+ ok(mod_gm_opt->server_list[0]->port == 4730, "server=host:4730");
ok(mod_gm_opt->server_num == 1, "server_number = %d", mod_gm_opt->server_num);
mod_gm_free_opt(mod_gm_opt);
mod_gm_opt = renew_opts();
strcpy(test, "server=:4730");
parse_args_line(mod_gm_opt, test, 0);
- like(mod_gm_opt->server_list[0], "localhost:4730", "server=:4730");
+ like(mod_gm_opt->server_list[0]->host, "localhost", "server=:4730");
+ ok(mod_gm_opt->server_list[0]->port == 4730, "server=:4730");
ok(mod_gm_opt->server_num == 1, "server_number = %d", mod_gm_opt->server_num);
mod_gm_free_opt(mod_gm_opt);
@@ -186,15 +188,18 @@
parse_args_line(mod_gm_opt, test, 0);
strcpy(test, "server=localhost:4730");
parse_args_line(mod_gm_opt, test, 0);
- like(mod_gm_opt->server_list[0], "localhost:4730", "duplicate server");
+ like(mod_gm_opt->server_list[0]->host, "localhost", "duplicate server");
+ ok(mod_gm_opt->server_list[0]->port == 4730, "duplicate server");
ok(mod_gm_opt->server_num == 1, "server_number = %d", mod_gm_opt->server_num);
mod_gm_free_opt(mod_gm_opt);
mod_gm_opt = renew_opts();
strcpy(test, "server=localhost:4730,localhost:4730,:4730,host:4730,");
parse_args_line(mod_gm_opt, test, 0);
- like(mod_gm_opt->server_list[0], "localhost:4730", "duplicate server");
- like(mod_gm_opt->server_list[1], "host:4730", "duplicate server");
+ like(mod_gm_opt->server_list[0]->host, "localhost", "duplicate server");
+ ok(mod_gm_opt->server_list[0]->port == 4730, "duplicate server");
+ like(mod_gm_opt->server_list[1]->host, "host", "duplicate server");
+ ok(mod_gm_opt->server_list[1]->port == 4730, "duplicate server");
ok(mod_gm_opt->server_num == 2, "server_number = %d", mod_gm_opt->server_num);
/* escape newlines */
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/02-full.c
^
|
@@ -39,12 +39,12 @@
char port[30];
snprintf(port, 30, "--port=%d", GEARMAND_TEST_PORT);
/* for newer gearman versions */
- if(atof(gearman_version()) > 0.14) {
- //diag("having gearmand > 0.14");
+ if(atof(gearman_version()) >= 0.27) {
+ execlp("gearmand", "gearmand", "--threads=10", "--job-retries=0", port, "--verbose=DEBUG", "--log-file=/tmp/gearmand.log" , (char *)NULL);
+ } else if(atof(gearman_version()) > 0.14) {
execlp("gearmand", "gearmand", "--threads=10", "--job-retries=0", port, "--verbose=999", "--log-file=/tmp/gearmand.log" , (char *)NULL);
} else {
/* for gearman 0.14 */
- //diag("having gearmand <= 0.14");
execlp("gearmand", "gearmand", "-t 10", "-j 0", port, (char *)NULL);
}
perror("gearmand");
@@ -348,7 +348,7 @@
diag( "waitpid() %d exited with %d\n", chld, status);
}
- if(!ok(gearmand_pid > 0, "'gearmand --threads=10 --job-retries=0 --port=%d --verbose=5 --log-file=/tmp/gearmand.log' started with pid: %d", GEARMAND_TEST_PORT, gearmand_pid)) {
+ if(!ok(gearmand_pid > 0, "'gearmand started with pid: %d", GEARMAND_TEST_PORT, gearmand_pid)) {
diag("make sure gearmand is in your PATH. Common locations are /usr/sbin or /usr/local/sbin");
exit( EXIT_FAILURE );
}
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/03-exec_checks.c
^
|
@@ -42,7 +42,7 @@
* arg parsing test 1
*/
char *args[MAX_CMD_ARGS];
- strcpy(cmd, "/bin/true");
+ strcpy(cmd, "/bin/hostname");
parse_command_line(cmd, args);
like(args[0], cmd, "parsing args cmd 1");
@@ -82,7 +82,7 @@
/*****************************************
* simple test command 1
*/
- strcpy(cmd, "/bin/true");
+ strcpy(cmd, "/bin/hostname");
rc = run_check(cmd, &result, &error);
cmp_ok(rc, "==", 0, "pclose for cmd '%s' returned rc %d", cmd, rc);
rrc = real_exit_code(rc);
@@ -93,7 +93,7 @@
/*****************************************
* simple test command 2
*/
- strcpy(cmd, "/bin/true 2>&1");
+ strcpy(cmd, "/bin/hostname 2>&1");
rc = run_check(cmd, &result, &error);
cmp_ok(rc, "==", 0, "pclose for cmd '%s' returned rc %d", cmd, rc);
rrc = real_exit_code(rc);
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/06-execvp_vs_popen.c
^
|
@@ -36,9 +36,7 @@
gm_job_t * exec_job;
exec_job = ( gm_job_t * )malloc( sizeof *exec_job );
set_default_job(exec_job, mod_gm_opt);
- //strcpy(cmd, "/bin/true;");
- strcpy(cmd, "/bin/true;");
- //strcpy(cmd, "./t/both");
+ strcpy(cmd, "/bin/hostname;");
run_check(cmd, &result, &error);
free(result);
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/07-epn.c
^
|
@@ -63,7 +63,7 @@
rrc = real_exit_code(run_check(cmd, &result, &error));
cmp_ok(rrc, "==", 3, "cmd '%s' returned rc %d", cmd, rrc);
like(result, "ePN failed to compile", "returned result string");
- like(error, "", "returned error string");
+ like(error, "^$", "returned error string");
free(result);
free(error);
@@ -71,7 +71,7 @@
rrc = real_exit_code(run_check(cmd, &result, &error));
cmp_ok(rrc, "==", 0, "cmd '%s' returned rc %d", cmd, rrc);
like(result, "test plugin OK", "returned result string");
- like(error, "", "returned error string");
+ like(error, "^$", "returned error string");
free(result);
free(error);
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/both
^
|
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
echo "stdout output"
echo "stderr output" >&2
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/killer
^
|
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
SIG="INT"
if [ ! -z "$1" ]; then
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/rc
^
|
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
echo "exiting with exit code $1"
exit $1
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/sleep
^
|
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
seconds=10
if [ ! -z "$1" ]; then
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/t/tap.c
^
|
@@ -264,6 +264,12 @@
#define MAP_ANONYMOUS MAP_ANON
#endif
+#include <sys/param.h>
+#ifdef BSD
+#include <sys/mman.h>
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
/* Create a shared memory int to keep track of whether a piece of code executed
dies. to be used in the dies_ok and lives_ok macros */
int
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/tools/check_gearman.c
^
|
@@ -33,14 +33,13 @@
int opt_job_critical = 100;
int opt_worker_warning = 25;
int opt_worker_critical = 50;
-char * opt_server = NULL;
char * opt_queue = NULL;
char * opt_send = NULL;
char * opt_expect = NULL;
char * opt_unique_id = NULL;
int send_async = 0;
-char * server_list[GM_LISTSIZE];
+gm_server_t * server_list[GM_LISTSIZE];
int server_list_num = 0;
gearman_client_st client;
@@ -75,8 +74,7 @@
break;
case 'C': opt_worker_critical = atoi(optarg);
break;
- case 'H': opt_server = optarg;
- server_list[server_list_num++] = optarg;
+ case 'H': add_server(&server_list_num, server_list, optarg);
break;
case 's': opt_send = optarg;
break;
@@ -95,9 +93,8 @@
}
mod_gm_opt->debug_level = opt_verbose;
mod_gm_opt->logmode = GM_LOG_MODE_TOOLS;
- server_list[server_list_num] = NULL;
- if(opt_server == NULL) {
+ if(server_list_num == 0) {
printf("Error - no hostname given\n\n");
print_usage();
}
@@ -117,7 +114,7 @@
else {
/* get gearman server statistics */
alarm(opt_timeout);
- result = check_server(opt_server);
+ result = check_server(server_list[server_list_num-1]->host, server_list[server_list_num-1]->port);
}
alarm(0);
@@ -191,32 +188,24 @@
void alarm_sighandler(int sig) {
gm_log( GM_LOG_TRACE, "alarm_sighandler(%i)\n", sig );
- printf("timeout while waiting for %s\n", opt_server);
+ printf("timeout while waiting for %s:%i\n", server_list[server_list_num-1]->host, server_list[server_list_num-1]->port);
exit( STATE_CRITICAL );
}
/* check gearman server */
-int check_server(char * hostname) {
- int port = GM_SERVER_DEFAULT_PORT;
+int check_server(char * server, in_port_t port) {
mod_gm_server_status_t *stats;
int x;
char * message = NULL;
char * version = NULL;
- char * server = NULL;
- char * port_c = NULL;
int total_running = 0;
int total_waiting = 0;
int checked = 0;
int rc;
char *buf;
- server = strsep(&hostname, ":");
- port_c = strsep(&hostname, "\x0");
- if(port_c != NULL)
- port = atoi(port_c);
-
stats = malloc(sizeof(mod_gm_server_status_t));
rc = get_gearman_server_data(stats, &message, &version, server, port);
if( rc == STATE_OK ) {
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/tools/gearman_top.c
^
|
@@ -130,8 +130,8 @@
/* print stats */
-void print_stats(char * hostname) {
- char * hst = strdup(hostname);
+void print_stats(char * hostnam) {
+ char * hst = strdup(hostnam);
char * hst_c = hst;
char * server = NULL;
char * port_c = NULL;
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/worker/worker.c
^
|
@@ -590,6 +590,16 @@
if(shmdt(shm) < 0)
perror("shmdt");
+ /*
+ * clean up shared memory
+ * will be removed when last client detaches
+ */
+ if( shmctl( shmid, IPC_RMID, 0 ) == -1 ) {
+ perror("shmctl");
+ } else {
+ gm_log( GM_LOG_DEBUG, "shared memory deleted\n");
+ }
+
gm_log( GM_LOG_INFO, "mod_gearman worker exited\n");
mod_gm_free_opt(mod_gm_opt);
exit( EXIT_SUCCESS );
@@ -674,16 +684,6 @@
if(current_number_of_workers == 0)
return;
- /*
- * clean up shared memory
- * will be removed when last client detaches
- */
- if( shmctl( shmid, IPC_RMID, 0 ) == -1 ) {
- perror("shmctl");
- } else {
- gm_log( GM_LOG_TRACE, "shared memory deleted\n");
- }
-
/* this will kill us too */
gm_log( GM_LOG_ERROR, "exiting by SIGKILL...\n");
killpg(0, SIGKILL);
|
[-]
[+]
|
Changed |
mod_gearman-1.2.4.tar.bz2/worker/worker_client.c
^
|
@@ -304,7 +304,7 @@
else if ( !strcmp( exec_job->type, "host" ) ) {
gm_log( GM_LOG_DEBUG, "got host job: %s\n", exec_job->host_name);
}
- else if ( !strcmp( exec_job->type, "event" ) ) {
+ else if ( !strcmp( exec_job->type, "eventhandler" ) ) {
gm_log( GM_LOG_DEBUG, "got eventhandler job\n");
}
@@ -415,6 +415,9 @@
gm_log( GM_LOG_TRACE, "set_state(%d)\n", status );
+ if(worker_run_mode == GM_WORKER_STANDALONE)
+ return;
+
/* Now we attach the segment to our data space. */
if ((shm = shmat(shmid, NULL, 0)) == (int *) -1) {
perror("shmat");
@@ -467,6 +470,9 @@
deinit_embedded_perl();
#endif
+ if(worker_run_mode == GM_WORKER_STANDALONE)
+ exit( EXIT_SUCCESS );
+
/* Now we attach the segment to our data space. */
if((shm = shmat(shmid, NULL, 0)) == (int *) -1) {
perror("shmat");
@@ -479,17 +485,6 @@
if(shmdt(shm) < 0)
perror("shmdt");
- if(worker_run_mode != GM_WORKER_STANDALONE)
- exit( EXIT_SUCCESS );
-
- /*
- * clean up shared memory
- * will be removed when last client detaches
- */
- if( shmctl( shmid, IPC_RMID, 0 ) == -1 ) {
- perror("shmctl");
- }
-
exit( EXIT_SUCCESS );
}
@@ -529,6 +524,9 @@
snprintf(result, GM_BUFFERSIZE, "%s has %i worker and is working on %i jobs. Version: %s|worker=%i;;;%i;%i jobs=%ic", hostname, shm[1], shm[2], GM_VERSION, shm[1], mod_gm_opt->min_worker, mod_gm_opt->max_worker, shm[0] );
+ /* and increase job counter */
+ shm[0]++;
+
/* detach from shared memory */
if(shmdt(shm) < 0)
perror("shmdt");
|