[-]
[+]
|
Changed |
icinga-mod_gearman.changes
|
|
[-]
[+]
|
Changed |
icinga-mod_gearman.spec
^
|
|
|
Deleted |
mod_gearman-1.4.1.99.tar.bz2
^
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/Changes
^
|
@@ -1,5 +1,14 @@
This file documents the revision history for mod_gearman.
+1.4.2 Thu Jan 10 10:56:37 CET 2013
+ - force check on orphaned events
+ - added mini epn
+ - added logrotate config (Ricardo Maraschini)
+ - added new option load_limit1,5,15 to prevent new workers from spawning under heavy load. (sponsored by Ovido GmbH)
+
+1.4.0 Thu Sep 25 22:14:31 CEST 2012
+ - implemented support for nagios 4
+
1.3.8 Sun Aug 19 16:52:13 CEST 2012
- fixed sending 2 results back when hit timeout
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/Makefile.am
^
|
@@ -26,11 +26,13 @@
EXTRA_03_exec_SOURCES=common/perlxsi.c common/epn_utils.c
EXTRA_06_exec_SOURCES=common/perlxsi.c common/epn_utils.c
EXTRA_07_epn_SOURCES=common/perlxsi.c common/epn_utils.c
+EPN_BIN = mod_gearman_mini_epn
else
PERLLIB =
P1FILE =
install_p1file =
perl_objects =
+EPN_BIN =
endif
# source definitions
@@ -107,7 +109,10 @@
THANKS README docs/README.html Changes worker/initscript.in \
docs/QUICKSTART docs/QUICKSTART.html support/mod_gearman.spec \
t/data/* t/rc t/both t/killer t/sleep t/*.pl t/*.t \
- worker/mod_gearman_p1.pl t/test_all.pl t/valgrind_suppress.cfg contrib
+ worker/mod_gearman_p1.pl t/test_all.pl t/valgrind_suppress.cfg contrib \
+ etc/mod_gearman_worker_logrotate
+
+include contrib/Makefile.am
# other targets
mod_gearman.o: $(mod_gearman_so_OBJECTS) $(mod_gearman_so_DEPENDENCIES)
@@ -151,7 +156,7 @@
@sed -i -e 's:%GEARMAND%:/usr/sbin/gearmand:g' extras/gearmand-init
@chmod 755 extras/gearmand-init
-all-local: mod_gearman.o initscript-local mod_gearman_neb.conf-local mod_gearman_worker.conf-local gearmand-init-local
+all-local: mod_gearman.o initscript-local mod_gearman_neb.conf-local mod_gearman_worker.conf-local gearmand-init-local $(EPN_BIN)
@echo ""
@echo "################################################################"
@echo ""
@@ -162,7 +167,8 @@
@echo " worker/initscript"
@echo " etc/mod_gearman_neb.conf"
@echo " etc/mod_gearman_worker.conf"
- @echo " $(P1FILE)"
+ @[ "$(P1FILE)" = "" ] || echo " $(P1FILE)"
+ @[ "$(EPN_BIN)" = "" ] || echo " $(EPN_BIN)"
@echo ""
@echo " read the README for configuration details"
@echo ""
@@ -172,10 +178,10 @@
@echo "################################################################"
distclean-local: clean
- $(RM) -rf .deps/ Makefile.in aclocal.m4 autom4te.cache config.* configure depcomp install-sh missing *.gz
+ $(RM) -rf .deps/ Makefile.in aclocal.m4 autom4te.cache config.* configure depcomp install-sh missing *.gz contrib/.deps/ contrib/.dirstamp
clean-local:
- $(RM) -f worker.static worker/initscript etc/mod_gearman.conf rpm.topdir *.o */*.o extras/gearmand-init etc/mod_gearman_neb.conf etc/mod_gearman_worker.conf
+ $(RM) -f worker.static worker/initscript etc/mod_gearman.conf rpm.topdir *.o */*.o extras/gearmand-init etc/mod_gearman_neb.conf etc/mod_gearman_worker.conf mod_gearman_mini_epn perlxsi.c
worker.static: worker
@echo "################################################################"
@@ -245,6 +251,7 @@
install-config:
$(install_sh_PROGRAM) etc/mod_gearman_neb.conf $(DESTDIR)$(sysconfdir)/mod_gearman_neb.conf
$(install_sh_PROGRAM) etc/mod_gearman_worker.conf $(DESTDIR)$(sysconfdir)/mod_gearman_worker.conf
+ $(install_sh_PROGRAM) etc/mod_gearman_worker_logrotate $(DESTDIR)$(sysconfdir)/../logrotate.d/mod_gearman_worker
@echo "################################################################"
@echo ""
@echo " configuration:"
@@ -283,10 +290,12 @@
cp -p README.asciidoc docs/README && cd docs && asciidoc --unsafe -a toc -a toclevels=2 -a max-width=800 README
chmod 644 docs/README.html
$(DOS2UNIX) docs/README.html
+ ./replace_doc_toc.pl docs/README.html
$(RM) -f docs/README
cd docs && asciidoc --unsafe -a toc -a toclevels=2 -a max-width=800 QUICKSTART
chmod 644 docs/QUICKSTART.html
$(DOS2UNIX) docs/QUICKSTART.html
+ ./replace_doc_toc.pl docs/QUICKSTART.html
rpm: dist
mkdir -p $(RPM_TOPDIR)/{SOURCES,BUILD,RPMS,SRPMS,SPECS}
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/Makefile.in
^
|
@@ -48,11 +48,11 @@
check_PROGRAMS = 01_utils$(EXEEXT) 02_full$(EXEEXT) 03_exec$(EXEEXT) \
04_log$(EXEEXT) 05_neb$(EXEEXT) 06_exec$(EXEEXT) \
07_epn$(EXEEXT)
-subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(top_srcdir)/configure COPYING INSTALL THANKS TODO compile \
- depcomp install-sh missing
+ $(srcdir)/contrib/Makefile.am $(top_srcdir)/configure COPYING \
+ INSTALL THANKS TODO compile depcomp install-sh missing
+subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -311,6 +311,8 @@
@USEPERL_TRUE@EXTRA_03_exec_SOURCES = common/perlxsi.c common/epn_utils.c
@USEPERL_TRUE@EXTRA_06_exec_SOURCES = common/perlxsi.c common/epn_utils.c
@USEPERL_TRUE@EXTRA_07_epn_SOURCES = common/perlxsi.c common/epn_utils.c
+@USEPERL_FALSE@EPN_BIN =
+@USEPERL_TRUE@EPN_BIN = mod_gearman_mini_epn
# source definitions
common_SOURCES = common/base64.c \
@@ -373,7 +375,8 @@
THANKS README docs/README.html Changes worker/initscript.in \
docs/QUICKSTART docs/QUICKSTART.html support/mod_gearman.spec \
t/data/* t/rc t/both t/killer t/sleep t/*.pl t/*.t \
- worker/mod_gearman_p1.pl t/test_all.pl t/valgrind_suppress.cfg contrib
+ worker/mod_gearman_p1.pl t/test_all.pl t/valgrind_suppress.cfg contrib \
+ etc/mod_gearman_worker_logrotate
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -382,7 +385,7 @@
.SUFFIXES: .c .o .obj
am--refresh:
@:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/contrib/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -1108,6 +1111,11 @@
.PHONY: docs
+mod_gearman_mini_epn: contrib/mod_gearman_mini_epn.c
+ perl -MExtUtils::Embed -e xsinit
+ $(CC) $(CFLAGS) -c perlxsi.c `perl -MExtUtils::Embed -e ccopts`
+ $(CC) $(CFLAGS) -c contrib/mod_gearman_mini_epn.c `perl -MExtUtils::Embed -e ccopts`
+ $(CC) $(CFLAGS) $(LDFLAGS) perlxsi.o mod_gearman_mini_epn.o `perl -MExtUtils::Embed -e ccopts -e ldopts` -o $@
# other targets
mod_gearman.o: $(mod_gearman_so_OBJECTS) $(mod_gearman_so_DEPENDENCIES)
@@ -1151,7 +1159,7 @@
@sed -i -e 's:%GEARMAND%:/usr/sbin/gearmand:g' extras/gearmand-init
@chmod 755 extras/gearmand-init
-all-local: mod_gearman.o initscript-local mod_gearman_neb.conf-local mod_gearman_worker.conf-local gearmand-init-local
+all-local: mod_gearman.o initscript-local mod_gearman_neb.conf-local mod_gearman_worker.conf-local gearmand-init-local $(EPN_BIN)
@echo ""
@echo "################################################################"
@echo ""
@@ -1162,7 +1170,8 @@
@echo " worker/initscript"
@echo " etc/mod_gearman_neb.conf"
@echo " etc/mod_gearman_worker.conf"
- @echo " $(P1FILE)"
+ @[ "$(P1FILE)" = "" ] || echo " $(P1FILE)"
+ @[ "$(EPN_BIN)" = "" ] || echo " $(EPN_BIN)"
@echo ""
@echo " read the README for configuration details"
@echo ""
@@ -1172,10 +1181,10 @@
@echo "################################################################"
distclean-local: clean
- $(RM) -rf .deps/ Makefile.in aclocal.m4 autom4te.cache config.* configure depcomp install-sh missing *.gz
+ $(RM) -rf .deps/ Makefile.in aclocal.m4 autom4te.cache config.* configure depcomp install-sh missing *.gz contrib/.deps/ contrib/.dirstamp
clean-local:
- $(RM) -f worker.static worker/initscript etc/mod_gearman.conf rpm.topdir *.o */*.o extras/gearmand-init etc/mod_gearman_neb.conf etc/mod_gearman_worker.conf
+ $(RM) -f worker.static worker/initscript etc/mod_gearman.conf rpm.topdir *.o */*.o extras/gearmand-init etc/mod_gearman_neb.conf etc/mod_gearman_worker.conf mod_gearman_mini_epn perlxsi.c
worker.static: worker
@echo "################################################################"
@@ -1244,6 +1253,7 @@
install-config:
$(install_sh_PROGRAM) etc/mod_gearman_neb.conf $(DESTDIR)$(sysconfdir)/mod_gearman_neb.conf
$(install_sh_PROGRAM) etc/mod_gearman_worker.conf $(DESTDIR)$(sysconfdir)/mod_gearman_worker.conf
+ $(install_sh_PROGRAM) etc/mod_gearman_worker_logrotate $(DESTDIR)$(sysconfdir)/../logrotate.d/mod_gearman_worker
@echo "################################################################"
@echo ""
@echo " configuration:"
@@ -1282,10 +1292,12 @@
cp -p README.asciidoc docs/README && cd docs && asciidoc --unsafe -a toc -a toclevels=2 -a max-width=800 README
chmod 644 docs/README.html
$(DOS2UNIX) docs/README.html
+ ./replace_doc_toc.pl docs/README.html
$(RM) -f docs/README
cd docs && asciidoc --unsafe -a toc -a toclevels=2 -a max-width=800 QUICKSTART
chmod 644 docs/QUICKSTART.html
$(DOS2UNIX) docs/QUICKSTART.html
+ ./replace_doc_toc.pl docs/QUICKSTART.html
rpm: dist
mkdir -p $(RPM_TOPDIR)/{SOURCES,BUILD,RPMS,SRPMS,SPECS}
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/README
^
|
@@ -507,7 +507,7 @@
Default is automatic.
+
====
- debug=1
+ logmode=automatic
====
@@ -829,6 +829,35 @@
====
+load_limit1::
+Set a limit based on the 1min load average. When exceding the load limit,
+no new worker will be started until the current load is below the limit.
+No limit will be used when set to 0.
+Default: no limit
++
+====
+ load_limit1=0
+====
+
+
+load_limit5::
+Set a limit based on the 5min load average. See 'load_limit1' for details.
+Default: no limit
++
+====
+ load_limit5=0
+====
+
+
+load_limit15::
+Set a limit based on the 15min load average. See 'load_limit1' for details.
+Default: no limit
++
+====
+ load_limit15=0
+====
+
+
idle-timeout::
Time in seconds after which an idling worker exits. This parameter
controls how fast your waiting workers will exit if there are no jobs
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/common/epn_utils.c
^
|
@@ -220,9 +220,9 @@
/* checks to see if we should run a script using the embedded Perl interpreter */
int file_uses_embedded_perl(char *fname) {
- #ifndef EMBEDDEDPERL
+#ifndef EMBEDDEDPERL
return FALSE;
- #else
+#else
int line;
FILE *fp = NULL;
char buf[256] = "";
@@ -268,7 +268,7 @@
fclose(fp);
return use_embedded_perl_implicitly;
- #endif
+#endif
}
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/common/gearman_utils.c
^
|
@@ -271,64 +271,16 @@
/* get worker/jobs data from gearman server */
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;
- char * cmd;
- char buf[GM_BUFFERSIZE];
- char * line;
- char * output;
- char * output_c;
- char * name;
- char * total;
- char * running;
- char * worker;
+ int rc;
+ char *total, *running, *worker, *output, *output_c, *line, *name;
mod_gm_status_function_t *func;
- *message = malloc(GM_BUFFERSIZE);
- *version = malloc(GM_BUFFERSIZE);
- snprintf(*message, GM_BUFFERSIZE, "%s", "" );
- snprintf(*version, GM_BUFFERSIZE, "%s", "" );
-
- sockfd = socket(AF_INET, SOCK_STREAM, 0);
- if( sockfd < 0 ) {
- snprintf(*message, GM_BUFFERSIZE, "failed to open socket: %s\n", strerror(errno));
- return( STATE_CRITICAL );
- }
-
- server = gethostbyname(hostnam);
- if( server == NULL ) {
- snprintf(*message, GM_BUFFERSIZE, "failed to resolve %s\n", hostnam);
- return( STATE_CRITICAL );
- }
- serv_addr.sin_family = AF_INET;
- bcopy((char *)server->h_addr,
- (char *)&serv_addr.sin_addr.s_addr,
- 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", hostnam, (int)port, strerror(errno));
- close(sockfd);
- return( STATE_CRITICAL );
- }
-
- 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", hostnam, (int)port, strerror(errno));
- close(sockfd);
- return( STATE_CRITICAL );
- }
+ *version = malloc(GM_BUFFERSIZE);
+ snprintf(*version, GM_BUFFERSIZE, "%s", "" );
- n = read( sockfd, buf, GM_BUFFERSIZE-1 );
- buf[n] = '\x0';
- if (n < 0) {
- snprintf(*message, GM_BUFFERSIZE, "error reading from %s:%i - %s\n", hostnam, (int)port, strerror(errno));
- close(sockfd);
- return( STATE_CRITICAL );
- }
+ rc = send2gearmandadmin("status\nversion\n", hostnam, port, &output, message);
+ if(rc != STATE_OK) { return rc; }
- output = strdup(buf);
output_c = output;
while ( (line = strsep( &output, "\n" )) != NULL ) {
gm_log( GM_LOG_TRACE, "%s\n", line );
@@ -346,7 +298,6 @@
/* sort our array by queue name */
qsort(stats->function, stats->function_num, sizeof(mod_gm_status_function_t*), struct_cmp_by_queue);
- close(sockfd);
free(output_c);
return( STATE_OK );
}
@@ -382,8 +333,63 @@
snprintf(*message, GM_BUFFERSIZE, "got no valid data from %s:%i\n", hostnam, (int)port);
free(output_c);
+ return(rc);
+}
+
+
+/* send gearman admin */
+int send2gearmandadmin(char * cmd, char * hostnam, int port, char ** output, char ** error) {
+ int sockfd, n;
+ struct sockaddr_in serv_addr;
+ struct hostent *server;
+ char buf[GM_BUFFERSIZE];
+
+ *error = malloc(GM_BUFFERSIZE);
+ snprintf(*error, GM_BUFFERSIZE, "%s", "" );
+ *output = malloc(GM_BUFFERSIZE);
+ snprintf(*output, GM_BUFFERSIZE, "%s", "" );
+
+ sockfd = socket(AF_INET, SOCK_STREAM, 0);
+ if( sockfd < 0 ) {
+ snprintf(*error, GM_BUFFERSIZE, "failed to open socket: %s\n", strerror(errno));
+ return( STATE_CRITICAL );
+ }
+
+ server = gethostbyname(hostnam);
+ if( server == NULL ) {
+ snprintf(*error, GM_BUFFERSIZE, "failed to resolve %s\n", hostnam);
+ return( STATE_CRITICAL );
+ }
+ serv_addr.sin_family = AF_INET;
+ bcopy((char *)server->h_addr,
+ (char *)&serv_addr.sin_addr.s_addr,
+ server->h_length);
+ serv_addr.sin_port = htons(port);
+ if (connect(sockfd,(const struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) {
+ snprintf(*error, GM_BUFFERSIZE, "failed to connect to %s:%i - %s\n", hostnam, (int)port, strerror(errno));
+ close(sockfd);
+ return( STATE_CRITICAL );
+ }
+
+ n = write(sockfd,cmd,strlen(cmd));
+ if (n < 0) {
+ snprintf(*error, GM_BUFFERSIZE, "failed to send to %s:%i - %s\n", hostnam, (int)port, strerror(errno));
+ close(sockfd);
+ return( STATE_CRITICAL );
+ }
+
+ n = read( sockfd, buf, GM_BUFFERSIZE-1 );
+ buf[n] = '\x0';
+ if (n < 0) {
+ snprintf(*error, GM_BUFFERSIZE, "error reading from %s:%i - %s\n", hostnam, (int)port, strerror(errno));
+ close(sockfd);
+ return( STATE_CRITICAL );
+ }
+ free(*output);
+ *output = strdup(buf);
close(sockfd);
- return( STATE_UNKNOWN );
+
+ return( STATE_OK );
}
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/common/utils.c
^
|
@@ -688,6 +688,22 @@
if(opt->spawn_rate < 0) { opt->spawn_rate = GM_DEFAULT_SPAWN_RATE; }
}
+ /* load limit 1min */
+ else if ( !strcmp( key, "load_limit1" ) ) {
+ opt->load_limit1 = atof( value );
+ if(opt->load_limit1 < 0) { opt->load_limit1 = 0; }
+ }
+ /* load limit 5min */
+ else if ( !strcmp( key, "load_limit5" ) ) {
+ opt->load_limit5 = atof( value );
+ if(opt->load_limit5 < 0) { opt->load_limit5 = 0; }
+ }
+ /* load limit 15min */
+ else if ( !strcmp( key, "load_limit15" ) ) {
+ opt->load_limit15 = atof( value );
+ if(opt->load_limit15 < 0) { opt->load_limit15 = 0; }
+ }
+
/* timeout_return */
else if ( !strcmp( key, "timeout_return" ) ) {
opt->timeout_return = atoi( value );
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/configure
^
|
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for mod_gearman 1.3.8.
+# Generated by GNU Autoconf 2.67 for mod_gearman 1.4.2.
#
# 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.3.8'
-PACKAGE_STRING='mod_gearman 1.3.8'
+PACKAGE_VERSION='1.4.2'
+PACKAGE_STRING='mod_gearman 1.4.2'
PACKAGE_BUGREPORT='sven.nierlein@consol.de'
PACKAGE_URL=''
@@ -1257,7 +1257,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.3.8 to adapt to many kinds of systems.
+\`configure' configures mod_gearman 1.4.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1323,7 +1323,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of mod_gearman 1.3.8:";;
+ short | recursive ) echo "Configuration of mod_gearman 1.4.2:";;
esac
cat <<\_ACEOF
@@ -1422,7 +1422,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-mod_gearman configure 1.3.8
+mod_gearman configure 1.4.2
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1883,7 +1883,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.3.8, which was
+It was created by mod_gearman $as_me 1.4.2, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -2698,7 +2698,7 @@
# Define the identity of the package.
PACKAGE='mod_gearman'
- VERSION='1.3.8'
+ VERSION='1.4.2'
cat >>confdefs.h <<_ACEOF
@@ -6066,7 +6066,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.3.8, which was
+This file was extended by mod_gearman $as_me 1.4.2, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6132,7 +6132,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.3.8
+mod_gearman config.status 1.4.2
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.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.3.8], [sven.nierlein@consol.de])
+AC_INIT([mod_gearman], [1.4.2], [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])
|
[-]
[+]
|
Added |
mod_gearman-1.4.2.tar.bz2/contrib/Makefile.am
^
|
@@ -0,0 +1,5 @@
+mod_gearman_mini_epn: contrib/mod_gearman_mini_epn.c
+ perl -MExtUtils::Embed -e xsinit
+ $(CC) $(CFLAGS) -c perlxsi.c `perl -MExtUtils::Embed -e ccopts`
+ $(CC) $(CFLAGS) -c contrib/mod_gearman_mini_epn.c `perl -MExtUtils::Embed -e ccopts`
+ $(CC) $(CFLAGS) $(LDFLAGS) perlxsi.o mod_gearman_mini_epn.o `perl -MExtUtils::Embed -e ccopts -e ldopts` -o $@
|
[-]
[+]
|
Added |
mod_gearman-1.4.2.tar.bz2/contrib/mod_gearman_mini_epn.c
^
|
@@ -0,0 +1,132 @@
+/*
+ mini_epn.c
+*/
+
+#include <EXTERN.h>
+#include <perl.h>
+#include "../include/nagios/epn_nagios.h"
+
+#define MAX_INPUT_CHARS 1024
+
+static PerlInterpreter *my_perl = NULL;
+
+int run_epn(char *command_line);
+
+int main(int argc, char **argv, char **env) {
+ char *embedding[] = { "", "worker/mod_gearman_p1.pl" };
+ char command_line[MAX_INPUT_CHARS];
+ int exitstatus;
+
+ if((my_perl = perl_alloc()) == NULL) {
+ printf("%s\n", "Error: Could not allocate memory for embedded Perl interpreter!");
+ exit(1);
+ }
+ perl_construct(my_perl);
+ exitstatus = perl_parse(my_perl, xs_init, 2, embedding, NULL);
+ if(!exitstatus) {
+ exitstatus = perl_run(my_perl);
+ if(argc > 1) {
+ int x;
+ command_line[0] = '\0';
+ for(x=1; x<argc; x++) {
+ strncat(command_line, argv[x], MAX_INPUT_CHARS - 1);
+ if(argc != x) {
+ strncat(command_line, " ", MAX_INPUT_CHARS - 1);
+ }
+ }
+ exitstatus = run_epn(command_line);
+ } else {
+ while(printf("Enter file name: ") && fgets(command_line, MAX_INPUT_CHARS - 1, stdin)) {
+ exitstatus = run_epn(command_line);
+ }
+ }
+
+ PL_perl_destruct_level = 0;
+ perl_destruct(my_perl);
+ perl_free(my_perl);
+ exit(exitstatus);
+ }
+}
+
+int run_epn(char *command_line) {
+ SV *plugin_hndlr_cr;
+ STRLEN n_a;
+ int count = 0 ;
+ char fname[MAX_INPUT_CHARS];
+ char *args[] = {"", "0", "", "", NULL };
+ int pclose_result;
+ char *plugin_output ;
+
+
+ dSP;
+
+ command_line[strlen(command_line) - 1] = '\0';
+
+ strncpy(fname, command_line, strcspn(command_line, " "));
+ fname[strcspn(command_line, " ")] = '\x0';
+ args[0] = fname ;
+ args[3] = command_line + strlen(fname) + 1 ;
+
+ args[2] = "";
+
+ /* call our perl interpreter to compile and optionally cache the command */
+
+ ENTER;
+ SAVETMPS;
+ PUSHMARK(SP);
+
+ XPUSHs(sv_2mortal(newSVpv(args[0], 0)));
+ XPUSHs(sv_2mortal(newSVpv(args[1], 0)));
+ XPUSHs(sv_2mortal(newSVpv(args[2], 0)));
+ XPUSHs(sv_2mortal(newSVpv(args[3], 0)));
+
+ PUTBACK;
+
+ count = call_pv("Embed::Persistent::eval_file", G_SCALAR | G_EVAL);
+
+ SPAGAIN;
+
+ /* check return status */
+ if(SvTRUE(ERRSV)) {
+ (void) POPs;
+
+ pclose_result = -2;
+ printf("embedded perl ran %s with error %s\n", fname, SvPVX(ERRSV));
+ return 1;
+ }
+ else {
+ plugin_hndlr_cr = newSVsv(POPs);
+
+ PUTBACK;
+ FREETMPS;
+ LEAVE;
+ }
+
+ ENTER;
+ SAVETMPS;
+ PUSHMARK(SP);
+
+ XPUSHs(sv_2mortal(newSVpv(args[0], 0)));
+ XPUSHs(sv_2mortal(newSVpv(args[1], 0)));
+ XPUSHs(plugin_hndlr_cr);
+ XPUSHs(sv_2mortal(newSVpv(args[3], 0)));
+
+ PUTBACK;
+
+ count = perl_call_pv("Embed::Persistent::run_package", G_EVAL | G_ARRAY);
+
+ SPAGAIN;
+
+ plugin_output = POPpx ;
+ pclose_result = POPi ;
+
+ printf("plugin return code: %d\n", pclose_result);
+ printf("perl plugin output: '%s'\n", plugin_output);
+
+ PUTBACK;
+ FREETMPS;
+ LEAVE;
+
+ alarm(0);
+ return 0;
+}
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/docs/QUICKSTART
^
|
@@ -54,9 +54,9 @@
--------------------------------------
#> cd /tmp
-#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.3.8.tar.gz"
-#> tar zxf mod_gearman-1.3.8.tar.gz
-#> cd mod_gearman-1.3.8
+#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.4.2.tar.gz"
+#> tar zxf mod_gearman-1.4.2.tar.gz
+#> cd mod_gearman-1.4.2
#> ./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.3.8
+[1295003042] mod_gearman: Version 1.4.2
[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.3.8|worker=1 jobs=2c
+check_gearman OK - debian64 has 1 worker and is working on 0 jobs. Version: 1.4.2|worker=1 jobs=2c
--------------------------------------
The interesting number is the last one, '2c' in our case, which means there
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/docs/QUICKSTART.html
^
|
@@ -415,147 +415,24 @@
/* IE6 sets dynamically generated links as visited. */
div#toc a:visited { color: blue; }
</style>
-<script type="text/javascript">
-/*<![CDATA[*/
-window.onload = function(){asciidoc.footnotes(); asciidoc.toc(2);}
-var asciidoc = { // Namespace.
-/////////////////////////////////////////////////////////////////////
-// Table Of Contents generator
-/////////////////////////////////////////////////////////////////////
-
-/* Author: Mihai Bazon, September 2002
- * http://students.infoiasi.ro/~mishoo
- *
- * Table Of Content generator
- * Version: 0.4
- *
- * Feel free to use this script under the terms of the GNU General Public
- * License, as long as you do not remove or alter this notice.
- */
-
- /* modified by Troy D. Hanson, September 2006. License: GPL */
- /* modified by Stuart Rackham, 2006, 2009. License: GPL */
-
-// toclevels = 1..4.
-toc: function (toclevels) {
-
- function getText(el) {
- var text = "";
- for (var i = el.firstChild; i != null; i = i.nextSibling) {
- if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
- text += i.data;
- else if (i.firstChild != null)
- text += getText(i);
- }
- return text;
- }
-
- function TocEntry(el, text, toclevel) {
- this.element = el;
- this.text = text;
- this.toclevel = toclevel;
- }
-
- function tocEntries(el, toclevels) {
- var result = new Array;
- var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
- // Function that scans the DOM tree for header elements (the DOM2
- // nodeIterator API would be a better technique but not supported by all
- // browsers).
- var iterate = function (el) {
- for (var i = el.firstChild; i != null; i = i.nextSibling) {
- if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
- var mo = re.exec(i.tagName);
- if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
- result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
- }
- iterate(i);
- }
- }
- }
- iterate(el);
- return result;
- }
-
- var toc = document.getElementById("toc");
- var entries = tocEntries(document.getElementById("content"), toclevels);
- for (var i = 0; i < entries.length; ++i) {
- var entry = entries[i];
- if (entry.element.id == "")
- entry.element.id = "_toc_" + i;
- var a = document.createElement("a");
- a.href = "#" + entry.element.id;
- a.appendChild(document.createTextNode(entry.text));
- var div = document.createElement("div");
- div.appendChild(a);
- div.className = "toclevel" + entry.toclevel;
- toc.appendChild(div);
- }
- if (entries.length == 0)
- toc.parentNode.removeChild(toc);
-},
-
-
-/////////////////////////////////////////////////////////////////////
-// Footnotes generator
-/////////////////////////////////////////////////////////////////////
-
-/* Based on footnote generation code from:
- * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
- */
-
-footnotes: function () {
- var cont = document.getElementById("content");
- var noteholder = document.getElementById("footnotes");
- var spans = cont.getElementsByTagName("span");
- var refs = {};
- var n = 0;
- for (i=0; i<spans.length; i++) {
- if (spans[i].className == "footnote") {
- n++;
- // Use [\s\S] in place of . so multi-line matches work.
- // Because JavaScript has no s (dotall) regex flag.
- note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
- noteholder.innerHTML +=
- "<div class='footnote' id='_footnote_" + n + "'>" +
- "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
- n + "</a>. " + note + "</div>";
- spans[i].innerHTML =
- "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
- "' title='View footnote' class='footnote'>" + n + "</a>]";
- var id =spans[i].getAttribute("id");
- if (id != null) refs["#"+id] = n;
- }
- }
- if (n == 0)
- noteholder.parentNode.removeChild(noteholder);
- else {
- // Process footnoterefs.
- for (i=0; i<spans.length; i++) {
- if (spans[i].className == "footnoteref") {
- var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
- href = href.match(/#.*/)[0]; // Because IE return full URL.
- n = refs[href];
- spans[i].innerHTML =
- "[<a href='#_footnote_" + n +
- "' title='View footnote' class='footnote'>" + n + "</a>]";
- }
- }
- }
-}
-
-}
-/*]]>*/
-</script>
</head>
<body style="max-width:800">
<div id="header">
<h1>Mod-Gearman Quickstart Guide</h1>
-<div id="toc">
- <div id="toctitle">Table of Contents</div>
- <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+<div id="toc"><div id="toctitle">Table of Contents</div>
+<div class='toclevel1'><a href='#_build_preparation'>Build Preparation</a></div>
+<div class='toclevel1'><a href='#_install_gearman'>Install Gearman</a></div>
+<div class='toclevel1'><a href='#_mod_gearman'>Mod-Gearman</a></div>
+<div class='toclevel1'><a href='#_nagios'>Nagios</a></div>
+<div class='toclevel1'><a href='#_starting_up'>Starting Up</a></div>
+<div class='toclevel1'><a href='#_nagios_configuration'>Nagios Configuration</a></div>
+<div class='toclevel1'><a href='#_testing'>Testing</a></div>
+<div class='toclevel2'><a href='#_gearman_top'>Gearman-Top</a></div>
+<div class='toclevel2'><a href='#_check_gearman'>Check-Gearman</a></div>
+<div class='toclevel1'><a href='#_troubleshooting'>Troubleshooting</a></div>
</div>
+
</div>
<div id="content">
<div id="preamble">
@@ -614,9 +491,9 @@
<div class="listingblock">
<div class="content">
<pre><tt>#> cd /tmp
-#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.3.8.tar.gz"
-#> tar zxf mod_gearman-1.3.8.tar.gz
-#> cd mod_gearman-1.3.8
+#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.4.2.tar.gz"
+#> tar zxf mod_gearman-1.4.2.tar.gz
+#> cd mod_gearman-1.4.2
#> ./configure --prefix=/opt --with-gearman=/opt --with-user=nagios --with-init-dir=/etc/init.d
#> make
#> make install
@@ -674,7 +551,7 @@
<div class="listingblock">
<div class="content">
<pre><tt>#> grep mod_gearman /var/log/nagios3/nagios.log
-[1295003042] mod_gearman: Version 1.3.8
+[1295003042] mod_gearman: Version 1.4.2
[1295003042] Event broker module '/opt/lib/mod_gearman/mod_gearman.o' initialized successfully.</tt></pre>
</div></div>
</div>
@@ -701,7 +578,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.3.8|worker=1 jobs=2c</tt></pre>
+check_gearman OK - debian64 has 1 worker and is working on 0 jobs. Version: 1.4.2|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 +618,7 @@
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2012-08-19 16:52:16 CEST
+Last updated 2013-01-10 10:56:44 CEST
</div>
</div>
</body>
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/docs/README.html
^
|
@@ -415,147 +415,54 @@
/* IE6 sets dynamically generated links as visited. */
div#toc a:visited { color: blue; }
</style>
-<script type="text/javascript">
-/*<![CDATA[*/
-window.onload = function(){asciidoc.footnotes(); asciidoc.toc(2);}
-var asciidoc = { // Namespace.
-/////////////////////////////////////////////////////////////////////
-// Table Of Contents generator
-/////////////////////////////////////////////////////////////////////
-
-/* Author: Mihai Bazon, September 2002
- * http://students.infoiasi.ro/~mishoo
- *
- * Table Of Content generator
- * Version: 0.4
- *
- * Feel free to use this script under the terms of the GNU General Public
- * License, as long as you do not remove or alter this notice.
- */
-
- /* modified by Troy D. Hanson, September 2006. License: GPL */
- /* modified by Stuart Rackham, 2006, 2009. License: GPL */
-
-// toclevels = 1..4.
-toc: function (toclevels) {
-
- function getText(el) {
- var text = "";
- for (var i = el.firstChild; i != null; i = i.nextSibling) {
- if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
- text += i.data;
- else if (i.firstChild != null)
- text += getText(i);
- }
- return text;
- }
-
- function TocEntry(el, text, toclevel) {
- this.element = el;
- this.text = text;
- this.toclevel = toclevel;
- }
-
- function tocEntries(el, toclevels) {
- var result = new Array;
- var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
- // Function that scans the DOM tree for header elements (the DOM2
- // nodeIterator API would be a better technique but not supported by all
- // browsers).
- var iterate = function (el) {
- for (var i = el.firstChild; i != null; i = i.nextSibling) {
- if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
- var mo = re.exec(i.tagName);
- if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
- result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
- }
- iterate(i);
- }
- }
- }
- iterate(el);
- return result;
- }
-
- var toc = document.getElementById("toc");
- var entries = tocEntries(document.getElementById("content"), toclevels);
- for (var i = 0; i < entries.length; ++i) {
- var entry = entries[i];
- if (entry.element.id == "")
- entry.element.id = "_toc_" + i;
- var a = document.createElement("a");
- a.href = "#" + entry.element.id;
- a.appendChild(document.createTextNode(entry.text));
- var div = document.createElement("div");
- div.appendChild(a);
- div.className = "toclevel" + entry.toclevel;
- toc.appendChild(div);
- }
- if (entries.length == 0)
- toc.parentNode.removeChild(toc);
-},
-
-
-/////////////////////////////////////////////////////////////////////
-// Footnotes generator
-/////////////////////////////////////////////////////////////////////
-
-/* Based on footnote generation code from:
- * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
- */
-
-footnotes: function () {
- var cont = document.getElementById("content");
- var noteholder = document.getElementById("footnotes");
- var spans = cont.getElementsByTagName("span");
- var refs = {};
- var n = 0;
- for (i=0; i<spans.length; i++) {
- if (spans[i].className == "footnote") {
- n++;
- // Use [\s\S] in place of . so multi-line matches work.
- // Because JavaScript has no s (dotall) regex flag.
- note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
- noteholder.innerHTML +=
- "<div class='footnote' id='_footnote_" + n + "'>" +
- "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
- n + "</a>. " + note + "</div>";
- spans[i].innerHTML =
- "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
- "' title='View footnote' class='footnote'>" + n + "</a>]";
- var id =spans[i].getAttribute("id");
- if (id != null) refs["#"+id] = n;
- }
- }
- if (n == 0)
- noteholder.parentNode.removeChild(noteholder);
- else {
- // Process footnoterefs.
- for (i=0; i<spans.length; i++) {
- if (spans[i].className == "footnoteref") {
- var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
- href = href.match(/#.*/)[0]; // Because IE return full URL.
- n = refs[href];
- spans[i].innerHTML =
- "[<a href='#_footnote_" + n +
- "' title='View footnote' class='footnote'>" + n + "</a>]";
- }
- }
- }
-}
-
-}
-/*]]>*/
-</script>
</head>
<body style="max-width:800">
<div id="header">
<h1>Gearman Module for Nagios / Icinga</h1>
-<div id="toc">
- <div id="toctitle">Table of Contents</div>
- <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+<div id="toc"><div id="toctitle">Table of Contents</div>
+<div class='toclevel1'><a href='#_what_is_mod_gearman'>What is Mod-Gearman</a></div>
+<div class='toclevel1'><a href='#_features'>Features</a></div>
+<div class='toclevel1'><a href='#_download'>Download</a></div>
+<div class='toclevel1'><a href='#_support'>Support</a></div>
+<div class='toclevel1'><a href='#_changelog'>Changelog</a></div>
+<div class='toclevel1'><a href='#_how_does_it_work'>How does it work</a></div>
+<div class='toclevel1'><a href='#_common_scenarios'>Common Scenarios</a></div>
+<div class='toclevel2'><a href='#_load_balancing'>Load Balancing</a></div>
+<div class='toclevel2'><a href='#_distributed_monitoring'>Distributed Monitoring</a></div>
+<div class='toclevel2'><a href='#_distributed_monitoring_with_load_balancing'>Distributed Monitoring with Load Balancing</a></div>
+<div class='toclevel2'><a href='#_nsca_replacement'>NSCA Replacement</a></div>
+<div class='toclevel2'><a href='#_distributed_setup_with_remote_scheduler'>Distributed Setup With Remote Scheduler</a></div>
+<div class='toclevel2'><a href='#_gearman_proxy'>Gearman Proxy</a></div>
+<div class='toclevel1'><a href='#_installation'>Installation</a></div>
+<div class='toclevel2'><a href='#_omd'>OMD</a></div>
+<div class='toclevel2'><a href='#_debian_ubuntu'>Debian / Ubuntu</a></div>
+<div class='toclevel2'><a href='#_centos_redhat'>Centos/Redhat</a></div>
+<div class='toclevel2'><a href='#_from_source'>From Source</a></div>
+<div class='toclevel1'><a href='#_configuration'>Configuration</a></div>
+<div class='toclevel2'><a href='#_nagios_core'>Nagios Core</a></div>
+<div class='toclevel2'><a href='#_common_options'>Common Options</a></div>
+<div class='toclevel2'><a href='#_server_options'>Server Options</a></div>
+<div class='toclevel2'><a href='#_worker_options'>Worker Options</a></div>
+<div class='toclevel1'><a href='#_queue_names'>Queue Names</a></div>
+<div class='toclevel1'><a href='#_performance'>Performance</a></div>
+<div class='toclevel1'><a href='#_exports'>Exports</a></div>
+<div class='toclevel1'><a href='#_embedded_perl'>Embedded Perl</a></div>
+<div class='toclevel1'><a href='#_how_to'>How To</a></div>
+<div class='toclevel2'><a href='#_how_to_monitor_job_server_and_worker'>How to Monitor Job Server and Worker</a></div>
+<div class='toclevel2'><a href='#_how_to_submit_passive_checks'>How to Submit Passive Checks</a></div>
+<div class='toclevel2'><a href='#_how_to_build_send_gearman_exe'>How to build send_gearman.exe</a></div>
+<div class='toclevel2'><a href='#_how_to_submit_check_multi_results'>How to Submit check_multi Results</a></div>
+<div class='toclevel2'><a href='#_how_to_set_queue_by_custom_variable'>How to Set Queue by Custom Variable</a></div>
+<div class='toclevel1'><a href='#_what_about_notifications'>What About Notifications</a></div>
+<div class='toclevel1'><a href='#_supported_dependencies'>Supported Dependencies</a></div>
+<div class='toclevel2'><a href='#_lib_gearman'>Lib-Gearman</a></div>
+<div class='toclevel2'><a href='#_nagios'>Nagios</a></div>
+<div class='toclevel2'><a href='#_icinga'>Icinga</a></div>
+<div class='toclevel1'><a href='#_hints'>Hints</a></div>
+<div class='toclevel1'><a href='#_archive'>Archive</a></div>
</div>
+
</div>
<div id="content">
<h2 id="_what_is_mod_gearman">What is Mod-Gearman</h2>
@@ -640,7 +547,7 @@
<div class="ulist"><ul>
<li>
<p>
-Latest stable <a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.3.6.tar.gz">version 1.3.6</a>, released July 19 2012
+Latest stable <a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.3.8.tar.gz">version 1.3.8</a>, released August 19 2012
</p>
</li>
<li>
@@ -1248,7 +1155,7 @@
<div class="exampleblock-content">
<div class="literalblock">
<div class="content">
-<pre><tt>debug=1</tt></pre>
+<pre><tt>logmode=automatic</tt></pre>
</div></div>
</div></div>
</dd>
@@ -1786,6 +1693,56 @@
</div></div>
</dd>
<dt class="hdlist1">
+load_limit1
+</dt>
+<dd>
+<p>
+Set a limit based on the 1min load average. When exceding the load limit,
+no new worker will be started until the current load is below the limit.
+No limit will be used when set to 0.
+Default: no limit
+</p>
+<div class="exampleblock">
+<div class="exampleblock-content">
+<div class="literalblock">
+<div class="content">
+<pre><tt>load_limit1=0</tt></pre>
+</div></div>
+</div></div>
+</dd>
+<dt class="hdlist1">
+load_limit5
+</dt>
+<dd>
+<p>
+Set a limit based on the 5min load average. See <em>load_limit1</em> for details.
+Default: no limit
+</p>
+<div class="exampleblock">
+<div class="exampleblock-content">
+<div class="literalblock">
+<div class="content">
+<pre><tt>load_limit5=0</tt></pre>
+</div></div>
+</div></div>
+</dd>
+<dt class="hdlist1">
+load_limit15
+</dt>
+<dd>
+<p>
+Set a limit based on the 15min load average. See <em>load_limit1</em> for details.
+Default: no limit
+</p>
+<div class="exampleblock">
+<div class="exampleblock-content">
+<div class="literalblock">
+<div class="content">
+<pre><tt>load_limit15=0</tt></pre>
+</div></div>
+</div></div>
+</dd>
+<dt class="hdlist1">
idle-timeout
</dt>
<dd>
@@ -2385,6 +2342,11 @@
<div class="ulist"><ul>
<li>
<p>
+<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.3.8.tar.gz">version 1.3.8 - August 19 2012</a>
+</p>
+</li>
+<li>
+<p>
<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.3.6.tar.gz">version 1.3.6 - July 19 2012</a>
</p>
</li>
@@ -2529,7 +2491,7 @@
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2012-07-18 01:05:05 CEST
+Last updated 2012-12-20 19:13:07 CEST
</div>
</div>
</body>
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/etc/mod_gearman_worker.conf.in
^
|
@@ -144,6 +144,17 @@
# unclean plugin. Default: yes
fork_on_exec=no
+# Set a limit based on the 1min load average. When exceding the load limit,
+# no new worker will be started until the current load is below the limit.
+# No limit will be used when set to 0.
+load_limit1=0
+
+# Same as load_limit1 but for the 5min load average.
+load_limit5=0
+
+# Same as load_limit1 but for the 15min load average.
+load_limit15=0
+
# Use this option to show stderr output of plugins too.
# Default: yes
show_error_output=yes
|
[-]
[+]
|
Added |
mod_gearman-1.4.2.tar.bz2/etc/mod_gearman_worker_logrotate
^
|
@@ -0,0 +1,8 @@
+/var/log/mod_gearman/*log {
+ missingok
+ notifempty
+ sharedscripts
+ postrotate
+ /etc/init.d/mod_gearman_worker reload > /dev/null 2>/dev/null || true
+ endscript
+}
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/extras/standalone_worker.conf
^
|
@@ -132,6 +132,17 @@
# unclean plugin. Default: no
fork_on_exec=no
+# Set a limit based on the 1min load average. When exceding the load limit,
+# no new worker will be started until the current load is below the limit.
+# No limit will be used when set to 0.
+load_limit1=0
+
+# Same as load_limit1 but for the 5min load average.
+load_limit5=0
+
+# Same as load_limit1 but for the 15min load average.
+load_limit15=0
+
# Use this option to show stderr output of plugins too.
# Default: yes
show_error_output=yes
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/include/common.h
^
|
@@ -54,7 +54,7 @@
#define MOD_GM_COMMON_H
/* constants */
-#define GM_VERSION "1.3.8"
+#define GM_VERSION "1.4.2"
#define GM_ENABLED 1
#define GM_DISABLED 0
#define GM_BUFFERSIZE 98304
@@ -225,6 +225,9 @@
int show_error_output; /**< optional display the stderr output of plugins */
int timeout_return; /**< timeout return code */
int dup_results_are_passive; /**< send duplicate results as passive checks */
+ double load_limit1; /**< load limit 1min for new worker */
+ double load_limit5; /**< load limit 5min for new worker */
+ double load_limit15; /**< load limit 15min for new worker */
#ifdef EMBEDDEDPERL
int enable_embedded_perl; /**< enabled embedded perl */
int use_embedded_perl_implicitly; /**< use embedded perl implicitly */
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/include/gearman_utils.h
^
|
@@ -103,6 +103,22 @@
int get_gearman_server_data(mod_gm_server_status_t *stats, char ** message, char **version, char * hostname, int port);
/**
+ * send2gearmandadmin
+ *
+ * send command via gearman admin protocol
+ *
+ * @param[in] cmd - cmd to send
+ * @param[in] hostname - hostname to connect to
+ * @param[in] port - port to connect
+ * @param[out] output - result from gearmand
+ * @param[out] error - error message
+ *
+ * @return true on success
+ */
+
+int send2gearmandadmin(char * cmd, char * hostnam, int port, char ** output, char ** error);
+
+/**
* free_mod_gm_status_server
*
* free status structure
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/neb_module/mod_gearman.c
^
|
@@ -534,31 +534,6 @@
temp_buffer[0]='\x0';
- /* orphanded check? */
- if(mod_gm_opt->orphan_host_checks == GM_ENABLED && check_options & CHECK_OPTION_ORPHAN_CHECK) {
- gm_log( GM_LOG_DEBUG, "host check for %s orphanded\n", hst->name );
- if ( ( chk_result = ( check_result * )malloc( sizeof *chk_result ) ) == 0 )
- return NEBERROR_CALLBACKCANCEL;
- snprintf( temp_buffer,GM_BUFFERSIZE-1,"(host check orphaned, is the mod-gearman worker on queue '%s' running?)\n", target_queue);
- init_check_result(chk_result);
- chk_result->host_name = strdup( hst->name );
- chk_result->scheduled_check = TRUE;
- chk_result->reschedule_check = TRUE;
- chk_result->output_file = 0;
- chk_result->output_file_fd = -1;
- chk_result->output = strdup(temp_buffer);
- chk_result->return_code = 2;
- chk_result->check_options = CHECK_OPTION_NONE;
- chk_result->object_check_type = HOST_CHECK;
- chk_result->check_type = HOST_CHECK_ACTIVE;
- chk_result->start_time.tv_sec = (unsigned long)time(NULL);
- chk_result->finish_time.tv_sec = (unsigned long)time(NULL);
- chk_result->latency = 0;
- mod_gm_add_result_to_list( chk_result );
- chk_result = NULL;
- return NEBERROR_CALLBACKCANCEL;
- }
-
/* grab the host macro variables */
clear_volatile_macros();
grab_host_macros(hst);
@@ -632,6 +607,30 @@
my_free(raw_command);
my_free(processed_command);
+ /* orphanded check - submit fake result to mark host as orphaned */
+ if(mod_gm_opt->orphan_host_checks == GM_ENABLED && check_options & CHECK_OPTION_ORPHAN_CHECK) {
+ gm_log( GM_LOG_DEBUG, "host check for %s orphanded\n", hst->name );
+ if ( ( chk_result = ( check_result * )malloc( sizeof *chk_result ) ) == 0 )
+ return NEBERROR_CALLBACKCANCEL;
+ snprintf( temp_buffer,GM_BUFFERSIZE-1,"(host check orphaned, is the mod-gearman worker on queue '%s' running?)\n", target_queue);
+ init_check_result(chk_result);
+ chk_result->host_name = strdup( hst->name );
+ chk_result->scheduled_check = TRUE;
+ chk_result->reschedule_check = TRUE;
+ chk_result->output_file = 0;
+ chk_result->output_file_fd = -1;
+ chk_result->output = strdup(temp_buffer);
+ chk_result->return_code = 2;
+ chk_result->check_options = CHECK_OPTION_NONE;
+ chk_result->object_check_type = HOST_CHECK;
+ chk_result->check_type = HOST_CHECK_ACTIVE;
+ chk_result->start_time.tv_sec = (unsigned long)time(NULL);
+ chk_result->finish_time.tv_sec = (unsigned long)time(NULL);
+ chk_result->latency = 0;
+ mod_gm_add_result_to_list( chk_result );
+ chk_result = NULL;
+ }
+
/* tell nagios to not execute */
gm_log( GM_LOG_TRACE, "handle_host_check() finished successfully -> %d\n", NEBERROR_CALLBACKOVERRIDE );
return NEBERROR_CALLBACKOVERRIDE;
@@ -692,32 +691,6 @@
temp_buffer[0]='\x0';
- /* orphanded check? */
- if(mod_gm_opt->orphan_service_checks == GM_ENABLED && svc->check_options & CHECK_OPTION_ORPHAN_CHECK) {
- gm_log( GM_LOG_DEBUG, "service check for %s - %s orphanded\n", svc->host_name, svc->description );
- if ( ( chk_result = ( check_result * )malloc( sizeof *chk_result ) ) == 0 )
- return NEBERROR_CALLBACKCANCEL;
- snprintf( temp_buffer,GM_BUFFERSIZE-1,"(service check orphaned, is the mod-gearman worker on queue '%s' running?)\n", target_queue);
- init_check_result(chk_result);
- chk_result->host_name = strdup( svc->host_name );
- chk_result->service_description = strdup( svc->description );
- chk_result->scheduled_check = TRUE;
- chk_result->reschedule_check = TRUE;
- chk_result->output_file = 0;
- chk_result->output_file_fd = -1;
- chk_result->output = strdup(temp_buffer);
- chk_result->return_code = 2;
- chk_result->check_options = CHECK_OPTION_NONE;
- chk_result->object_check_type = SERVICE_CHECK;
- chk_result->check_type = SERVICE_CHECK_ACTIVE;
- chk_result->start_time.tv_sec = (unsigned long)time(NULL);
- chk_result->finish_time.tv_sec = (unsigned long)time(NULL);
- chk_result->latency = 0;
- mod_gm_add_result_to_list( chk_result );
- chk_result = NULL;
- return NEBERROR_CALLBACKCANCEL;
- }
-
/* as we have to intercept service checks so early
* (we cannot cancel checks otherwise)
* we have to do some service check logic here
@@ -810,7 +783,34 @@
my_free(raw_command);
my_free(processed_command);
+ /* orphanded check - submit fake result to mark service as orphaned */
+ if(mod_gm_opt->orphan_service_checks == GM_ENABLED && svc->check_options & CHECK_OPTION_ORPHAN_CHECK) {
+ gm_log( GM_LOG_DEBUG, "service check for %s - %s orphanded\n", svc->host_name, svc->description );
+ if ( ( chk_result = ( check_result * )malloc( sizeof *chk_result ) ) == 0 )
+ return NEBERROR_CALLBACKCANCEL;
+ snprintf( temp_buffer,GM_BUFFERSIZE-1,"(service check orphaned, is the mod-gearman worker on queue '%s' running?)\n", target_queue);
+ init_check_result(chk_result);
+ chk_result->host_name = strdup( svc->host_name );
+ chk_result->service_description = strdup( svc->description );
+ chk_result->scheduled_check = TRUE;
+ chk_result->reschedule_check = TRUE;
+ chk_result->output_file = 0;
+ chk_result->output_file_fd = -1;
+ chk_result->output = strdup(temp_buffer);
+ chk_result->return_code = 2;
+ chk_result->check_options = CHECK_OPTION_NONE;
+ chk_result->object_check_type = SERVICE_CHECK;
+ chk_result->check_type = SERVICE_CHECK_ACTIVE;
+ chk_result->start_time.tv_sec = (unsigned long)time(NULL);
+ chk_result->finish_time.tv_sec = (unsigned long)time(NULL);
+ chk_result->latency = 0;
+ mod_gm_add_result_to_list( chk_result );
+ chk_result = NULL;
+ }
+
/* tell nagios to not execute */
+ gm_log( GM_LOG_TRACE, "handle_svc_check() finished successfully -> %d\n", NEBERROR_CALLBACKOVERRIDE );
+
return NEBERROR_CALLBACKOVERRIDE;
}
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/support/mod_gearman.spec
^
|
@@ -1,5 +1,5 @@
Name: mod_gearman
-Version: 1.3.8
+Version: 1.4.2
Release: 1%{?dist}
License: GNU Public License version 2
Packager: Sven Nierlein <sven.nierlein@consol.de>
@@ -14,7 +14,7 @@
Summary: Gearman module for Icinga/Nagios
Requires(pre,post): /sbin/ldconfig
Requires(pre): shadow-utils
-Requires: gearmand, perl
+Requires: gearmand, perl, logrotate
Provides: mod_gearman
@@ -71,6 +71,7 @@
%attr(755,root,root) %{_initrddir}/mod_gearman_worker
%config(noreplace) %{_sysconfdir}/mod_gearman/mod_gearman_neb.conf
%config(noreplace) %{_sysconfdir}/mod_gearman/mod_gearman_worker.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/mod_gearman_worker
%{_datadir}/mod_gearman/standalone_worker.conf
%{_datadir}/mod_gearman/shared.conf
@@ -92,6 +93,9 @@
%docdir %{_defaultdocdir}
%changelog
+* Mon Nov 19 2012 Ricardo Maraschini <ricardo.maraschini@opservices.com.br>
+- added logrotate configuration file
+
* Fri Apr 06 2012 Sven Nierlein <sven@consol.de>
- added gearman_proxy to package
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/t/02-full.c
^
|
@@ -220,7 +220,12 @@
}
-/* check logfile for errors, set mode to 1 to display file by diag() */
+/* check logfile for errors
+ * mode:
+ * 1 to display complete file by diag()
+ * 2 to display only errors
+ * 3 to display even without errors
+ */
void check_logfile(char *logfile, int mode);
void check_logfile(char *logfile, int mode) {
FILE * fp;
@@ -235,13 +240,14 @@
line = malloc(GM_BUFFERSIZE);
while(fgets(line, GM_BUFFERSIZE, fp) != NULL) {
if(strstr(line, "ERROR") != NULL) {
+ mode == 2 && diag("logfile: %s", line);
errors++;
}
}
fclose(fp);
/* output complete logfile */
- if(errors > 0 || mode == 1) {
+ if((errors > 0 && mode == 1) || mode == 3) {
fp = fopen(logfile, "r");
while(fgets(line, GM_BUFFERSIZE, fp) != NULL) {
diag("logfile: %s", line);
@@ -252,7 +258,11 @@
ok(errors == 0, "errors in logfile: %d", errors);
/* cleanup logfile */
- ok(unlink(logfile) == 0, "removed temporary logfile: %s", logfile);
+ if(errors == 0) {
+ ok(TRUE, "not removed temporary logfile due to errors: %s", logfile);
+ } else {
+ ok(unlink(logfile) == 0, "removed temporary logfile: %s", logfile);
+ }
free(line);
return;
@@ -310,11 +320,11 @@
/* main tests */
int main (int argc, char **argv, char **env) {
argc = argc; argv = argv; env = env;
- int status, chld;
- int tests = 88;
+ int status, chld, rc;
+ int tests = 92;
int rrc;
char cmd[150];
- char *result, *error;
+ char *result, *error, *message, *output;
plan(tests);
mod_gm_opt = malloc(sizeof(mod_gm_opt_t));
@@ -344,8 +354,9 @@
/* wait one second and catch died procs */
sleep(1);
- while((chld = waitpid(-1, &status, WNOHANG)) != -1 && chld > 0) {
+ while((chld = waitpid(-1, &status, WNOHANG)) != -1 && chld > 0) {
diag( "waitpid() %d exited with %d\n", chld, status);
+ status = 0;
}
if(!ok(gearmand_pid > 0, "'gearmand started with pid: %d", GEARMAND_TEST_PORT, gearmand_pid)) {
@@ -358,7 +369,7 @@
if(!ok(worker_pid > 0, "worker started with pid: %d", worker_pid))
diag("could not start worker");
if(!ok(pid_alive(worker_pid) == TRUE, "worker alive")) {
- check_logfile(worker_logfile, 1);
+ check_logfile(worker_logfile, 3);
kill(gearmand_pid, SIGTERM);
exit( EXIT_FAILURE );
}
@@ -402,6 +413,7 @@
kill(worker_pid, SIGTERM);
waitpid(worker_pid, &status, 0);
ok(status == 0, "worker exited with exit code %d", real_exit_code(status));
+ status = 0;
check_logfile(worker_logfile, 0);
char * test_keys[] = {
@@ -434,6 +446,7 @@
kill(worker_pid, SIGTERM);
waitpid(worker_pid, &status, 0);
ok(status == 0, "worker exited with exit code %d", real_exit_code(status));
+ status = 0;
check_logfile(worker_logfile, 0);
}
@@ -472,20 +485,42 @@
free_client(&client);
free_worker(&worker);
- kill(gearmand_pid, SIGTERM);
- waitpid(gearmand_pid, &status, 0);
- ok(status == 0, "gearmand exited with exit code %d", real_exit_code(status));
+ /* shutdown gearmand */
+ rc = send2gearmandadmin("shutdown\n", "localhost", GEARMAND_TEST_PORT, &output, &message);
+ ok(rc == 0, "rc of send2gearmandadmin %d", rc);
+ like(output, "OK", "output contains OK");
+ free(message);
+ free(output);
+
+ /* wait 5 seconds to shutdown */
+ for(i=0;i<=5;i++) {
+ waitpid(gearmand_pid, &status, WNOHANG);
+ if(pid_alive(gearmand_pid) == FALSE) {
+ todo();
+ ok(status == 0, "gearmand exited with: %d", real_exit_code(status));
+ endtodo;
+ break;
+ }
+ sleep(1);
+ }
+
+ if(pid_alive(gearmand_pid) == TRUE) {
+ /* kill it the hard way */
+ kill(gearmand_pid, SIGTERM);
+ waitpid(gearmand_pid, &status, 0);
+ ok(status == 0, "gearmand exited with exit code %d", real_exit_code(status));
+ status = 0;
+ ok(false, "gearmand had to be killed!");
+ }
+ todo();
+ check_logfile("/tmp/gearmand.log", 2);
+ endtodo;
kill(worker_pid, SIGTERM);
waitpid(worker_pid, &status, 0);
ok(status == 0, "worker exited with exit code %d", real_exit_code(status));
- todo();
- if(status != 0) {
- check_logfile("/tmp/gearmand.log", 1);
- } else {
- check_logfile("/tmp/gearmand.log", 0);
- }
- endtodo;
+ check_logfile(worker_logfile, 2);
+ status = 0;
#ifdef EMBEDDEDPERL
deinit_embedded_perl(0);
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/t/valgrind_suppress.cfg
^
|
@@ -9148,6 +9148,23 @@
fun:malloc
fun:Perl_safesysmalloc
obj:/usr/lib/libperl.so.5.10.1
+ fun:Perl_newSVpv
+ fun:Perl_call_method
+ fun:Perl_pp_print
+ fun:Perl_runops_standard
+ obj:/usr/lib/libperl.so.5.10.1
+ fun:Perl_runops_standard
+ fun:Perl_call_sv
+ fun:Perl_call_pv
+ fun:run_epn_check
+}
+
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:Perl_safesysmalloc
+ obj:/usr/lib/libperl.so.5.10.1
fun:Perl_newSVpvn
fun:Perl_yylex
fun:Perl_yyparse
@@ -9160,6 +9177,21 @@
}
{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:Perl_safesysmalloc
+ obj:/usr/lib/libperl.so.5.10.1
+ fun:Perl_newSVpvn
+ fun:Perl_yylex
+ fun:Perl_yyparse
+ obj:/usr/lib/libperl.so.5.10.1
+ fun:perl_parse
+ fun:init_embedded_perl
+ fun:main
+}
+
+{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:malloc
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/tools/check_gearman.c
^
|
@@ -156,13 +156,13 @@
printf(" - Thresholds are only for server checks, worker checks are availability only\n");
printf("\n");
printf("perfdata format when checking job server:\n");
- printf(" |'queue waiting'=current waiting jobs;warn;crit;0 'queue running'=current running jobs 'queue worker'=current num worker;warn;crit;0\n");
+ printf(" 'queue waiting'=current waiting jobs;warn;crit;0 'queue running'=current running jobs 'queue worker'=current num worker;warn;crit;0\n");
printf("\n");
printf("Note: set your pnp RRD_STORAGE_TYPE to MULTIPLE to support changeing numbers of queues.\n");
printf(" see http://docs.pnp4nagios.org/de/pnp-0.6/tpl_custom for detailed information\n");
printf("\n");
printf("perfdata format when checking mod gearman worker:\n");
- printf(" |worker=10 jobs=1508c\n");
+ printf(" worker=10 jobs=1508c\n");
printf("\n");
printf("Note: Job thresholds are per queue not totals.\n");
printf("\n");
@@ -171,12 +171,12 @@
printf("Check job server:\n");
printf("\n");
printf("%%>./check_gearman -H localhost -q host\n");
- printf("check_gearman OK - 0 jobs running and 0 jobs waiting. Version: 0.14|'host_waiting'=0;10;15;0 'host_running'=0 'host_worker'=3;5;10;0\n");
+ printf("check_gearman OK - 0 jobs running and 0 jobs waiting. Version: 0.14\n");
printf("\n");
printf("Check worker:\n");
printf("\n");
printf("%%> ./check_gearman -H <job server hostname> -q worker_<worker hostname> -t 10 -s check\n");
- printf("check_gearman OK - host has 5 worker and is working on 0 jobs|worker=5 jobs=96132c\n");
+ printf("check_gearman OK - host has 5 worker and is working on 0 jobs\n");
printf("\n");
exit( STATE_UNKNOWN );
|
[-]
[+]
|
Changed |
mod_gearman-1.4.2.tar.bz2/worker/worker.c
^
|
@@ -462,49 +462,56 @@
/* print usage */
void print_usage() {
- printf("usage:\n");
+ printf("Usage: worker [OPTION]...\n");
printf("\n");
- printf("worker [ --debug=<lvl> ]\n");
- printf(" [ --logmode=<automatic|stdout|syslog|file> ]\n");
- printf(" [ --logfile=<path> ]\n");
- printf(" [ --debug-result ]\n");
- printf(" [ --help|-h ]\n");
- printf(" [ --daemon|-d ]\n");
- printf(" [ --config=<configfile> ]\n");
- printf(" [ --server=<server> ]\n");
- printf(" [ --dupserver=<server> ]\n");
- printf("\n");
- printf(" [ --hosts ]\n");
- printf(" [ --services ]\n");
- printf(" [ --eventhandler ]\n");
- printf(" [ --hostgroup=<name> ]\n");
- printf(" [ --servicegroup=<name> ]\n");
- printf(" [ --do_hostchecks ]\n");
- printf("\n");
- printf(" [ --min-worker=<nr> ]\n");
- printf(" [ --max-worker=<nr> ]\n");
- printf("\n");
- printf(" [ --max-age=<sec> ]\n");
- printf(" [ --timeout ]\n");
- printf("\n");
- printf(" [ --encryption=<yes|no> ]\n");
- printf(" [ --key=<string> ]\n");
- printf(" [ --keyfile=<file> ]\n");
- printf("\n");
- printf(" [ --min-worker=<nr> ]\n");
- printf(" [ --max-worker=<nr> ]\n");
- printf(" [ --idle-timeout=<nr> ]\n");
- printf(" [ --max-jobs=<nr> ]\n");
- printf(" [ --spawn-rate=<nr> ]\n");
- printf(" [ --fork_on_exec ]\n");
- printf(" [ --show_error_output ]\n");
- printf("\n");
- printf(" [ --enable_embedded_perl ]\n");
- printf(" [ --use_embedded_perl_implicitly ]\n");
- printf(" [ --use_perl_cache ]\n");
- printf(" [ --p1_file ]\n");
+ printf("Mod-Gearman worker executes host- and servicechecks.\n");
printf("\n");
- printf(" [ --workaround_rc_25 ]\n");
+ printf("Basic Settings:\n");
+ printf(" --debug=<lvl> \n");
+ printf(" --logmode=<automatic|stdout|syslog|file> \n");
+ printf(" --logfile=<path> \n");
+ printf(" --debug-result \n");
+ printf(" --help|-h \n");
+ printf(" --daemon|-d \n");
+ printf(" --config=<configfile> \n");
+ printf(" --server=<server> \n");
+ printf(" --dupserver=<server> \n");
+ printf("\n");
+ printf("Encryption:\n");
+ printf(" --encryption=<yes|no> \n");
+ printf(" --key=<string> \n");
+ printf(" --keyfile=<file> \n");
+ printf("\n");
+ printf("Job Control:\n");
+ printf(" --hosts \n");
+ printf(" --services \n");
+ printf(" --eventhandler \n");
+ printf(" --hostgroup=<name> \n");
+ printf(" --servicegroup=<name> \n");
+ printf(" --do_hostchecks \n");
+ printf(" --max-age=<sec> \n");
+ printf(" --timeout \n");
+ printf("\n");
+ printf("Worker Control:\n");
+ printf(" --min-worker=<nr> \n");
+ printf(" --max-worker=<nr> \n");
+ printf(" --idle-timeout=<nr> \n");
+ printf(" --max-jobs=<nr> \n");
+ printf(" --spawn-rate=<nr> \n");
+ printf(" --fork_on_exec \n");
+ printf(" --load_limit1=load1 \n");
+ printf(" --load_limit5=load5 \n");
+ printf(" --load_limit15=load15 \n");
+ printf(" --show_error_output \n");
+ printf("\n");
+ printf("Embedded Perl:\n");
+ printf(" --enable_embedded_perl \n");
+ printf(" --use_embedded_perl_implicitly \n");
+ printf(" --use_perl_cache \n");
+ printf(" --p1_file \n");
+ printf("\n");
+ printf("Miscellaneous:\n");
+ printf(" --workaround_rc_25\n");
printf("\n");
printf("see README for a detailed explaination of all options.\n");
printf("\n");
@@ -548,6 +555,7 @@
int perc_running;
int idle;
int target = min;
+ double load[3];
if(cur_workers == 0) {
gm_log( GM_LOG_TRACE3, "adjust_number_of_worker(min %d, max %d, worker %d, jobs %d) -> %d\n", min, max, cur_workers, cur_jobs, mod_gm_opt->min_worker);
@@ -564,7 +572,24 @@
/* > 90% workers running */
if(cur_jobs > 0 && ( perc_running > 90 || idle <= 2 )) {
- /* increase target number by 2 */
+ if (getloadavg(load, 3) == -1) {
+ gm_log( GM_LOG_ERROR, "failed to get current load\n");
+ perror("getloadavg");
+ }
+ if(mod_gm_opt->load_limit1 > 0 && load[0] >= mod_gm_opt->load_limit1) {
+ gm_log( GM_LOG_TRACE, "load limit 1min hit, not starting any more workers: %1.2f > %1.2f\n", load[0], mod_gm_opt->load_limit1);
+ return cur_workers;
+ }
+ if(mod_gm_opt->load_limit5 > 0 && load[1] >= mod_gm_opt->load_limit5) {
+ gm_log( GM_LOG_TRACE, "load limit 5min hit, not starting any more workers: %1.2f > %1.2f\n", load[1], mod_gm_opt->load_limit5);
+ return cur_workers;
+ }
+ if(mod_gm_opt->load_limit15 > 0 && load[2] >= mod_gm_opt->load_limit15) {
+ gm_log( GM_LOG_TRACE, "load limit 15min hit, not starting any more workers: %1.2f > %1.2f\n", load[2], mod_gm_opt->load_limit15);
+ return cur_workers;
+ }
+
+ /* increase target number by spawn rate */
gm_log( GM_LOG_TRACE, "starting %d new workers\n", mod_gm_opt->spawn_rate);
target = cur_workers + mod_gm_opt->spawn_rate;
}
|