Changes of Revision 26
[-] | Changed | icinga-mod_gearman.changes |
1
2 ------------------------------------------------------------------- 3 +Wed Jul 6 21:45:27 UTC 2011 - cs@linux-administrator.com 4 + 5 +- update to release 1.0.7 6 + 7 +------------------------------------------------------------------- 8 Tue Jun 7 18:51:29 UTC 2011 - cs@linux-administrator.com 9 10 - update to release 1.0.6 11 |
||
[-] | Changed | icinga-mod_gearman.spec ^ |
10 1
2 %define monitor icinga 3 %define pkgname mod_gearman 4 Name: %{monitor}-%{pkgname} 5 -Version: 1.0.6 6 +Version: 1.0.7 7 Release: 1 8 Group: Application/System 9 License: GPLv3 10 |
||
[+] | Deleted | mod_gearman-1.0.6.tar.bz2/etc/mod_gearman.conf ^ |
@@ -1,163 +0,0 @@ -############################################################################### -# -# mod_gearman - distribute checks with gearman -# -# Copyright (c) 2010 Sven Nierlein -# -# Sample Worker / NEB Module Config -# -############################################################################### - -# use debug to increase the verbosity of the module. -# Possible values are: -# 0 = only errors -# 1 = debug messages -# 2 = trace messages -# 3 = trace and all gearman related logs are going to stdout. -# Default is 0. -debug=0 - - -# sets the addess of your gearman job server. Can be specified -# more than once to add more server. -server=localhost:4730 - - -# sets the address of your 2nd (duplicate) gearman job server. Can -# be specified more than once o add more servers. -#dupserver=<host>:<port> - - -# defines if the module should distribute execution of -# eventhandlers. -eventhandler=yes - - -# defines if the module should distribute execution of -# service checks. -services=yes - - -# defines if the module should distribute execution of -# host checks. -hosts=yes - - -# sets a list of hostgroups which will go into seperate -# queues. Either specify a comma seperated list or use -# multiple lines. -#hostgroups=name1 -#hostgroups=name2,name3 - - -# sets a list of servicegroups which will go into seperate -# queues. -#servicegroups=name1,name2,name3 - -# Set this to 'no' if you want Mod-Gearman to only take care about -# servicechecks. No hostchecks will be processed by Mod-Gearman. Use -# this option to disable hostchecks and still have the possibility to -# use hostgroups for easy configuration of your services. -# If set to yes, you still have to define which hostchecks should be -# processed by either using 'hosts' or the 'hostgroups' option. -# Default is Yes. -do_hostchecks=yes - -# enables or disables encryption. It is strongly -# advised to not disable encryption. Anybody will be -# able to inject packages to your worker. -# Encryption is enabled by default and you have to -# explicitly disable it. -# When using encryption, you will either have to -# specify a shared password with key=... or a -# keyfile with keyfile=... -# Default is On. -encryption=yes - - -# A shared password which will be used for -# encryption of data pakets. Should be at least 8 -# bytes long. Maximum length is 32 characters. -key=should_be_changed - - -# The shared password will be read from this file. -# Use either key or keyfile. Only the first 32 -# characters will be used. -#keyfile=/path/to/secret.file - - -############################################################################### -# -# NEB Module Config -# -# the following settings are for the neb module only and -# will be ignored by the worker. -# -############################################################################### - -# sets a list of hostgroups which will not be executed -# by gearman. They are just passed through. -# Default is none -localhostgroups= - - -# sets a list of servicegroups which will not be executed -# by gearman. They are just passed through. -# Default is none -localservicegroups= - - -# Number of result worker threads. Usually one is -# enough. You may increase the value if your -# result queue is not processed fast enough. -# Default: 1 -result_workers=1 - - -# defines if the module should distribute perfdata -# to gearman. -# Note: processing of perfdata is not part of -# mod_gearman. You will need additional worker for -# handling performance data. For example: pnp4nagios -# Performance data is just written to the gearman -# queue. -# Default no -perfdata=no - - -############################################################################### -# -# Worker Config -# -# the following settings are for the worker only and -# will be ignored by the neb module. -# -############################################################################### - -# Path to the pidfile. Usually set by the init script -#pidfile=/tmp/gm/var/mod_gearman/mod_gearman_worker.pid - -# Path to the logfile. -logfile=/tmp/gm/var/mod_gearman/mod_gearman_worker.log - -# Minimum number of worker processes which should -# run at any time. -min-worker=1 - -# Maximum number of worker processes which should -# run at any time. You may set this equal to -# min-worker setting to disable dynamic starting of -# workers. When setting this to 1, all services from -# this worker will be executed one after another. -max-worker=20 - -# Time after which an idling worker exists -# This parameter controls how fast your waiting workers will -# exit if there are no jobs waiting. -idle-timeout=30 - -# Controls the amount of jobs a worker will do before he exits -# Use this to control how fast the amount of workers will go down -# after high load times -max-jobs=50 | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/Changes ^ |
@@ -1,5 +1,10 @@ This file documents the revision history for mod_gearman. +1.0.7 Sun Jul 3 15:18:16 CEST 2011 + - show plugin output for exit codes > 3 + - fixed send_multi timestamps when client clock is screwed + - fixed send_multi for libgearman > 0.14 + 1.0.6 Sat Jun 4 11:47:02 CEST 2011 - expand server definitions from :4730 to localhost:4730 - fixed latency calculation (was below zero sometimes) | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/README ^ |
@@ -773,7 +773,7 @@ Download -------- -* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.6.tar.gz[version 1.0.6 - June 04 2011] +* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.7.tar.gz[version 1.0.7 - July 03 2011] * Mod Gearman is available for download at: http://labs.consol.de/nagios/mod-gearman * The source is available at GitHub: http://github.com/sni/mod_gearman @@ -781,6 +781,7 @@ Archive ~~~~~~~ +* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.7.tar.gz[version 1.0.7 - July 03 2011] * http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.6.tar.gz[version 1.0.6 - June 04 2011] * http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.5.tar.gz[version 1.0.5 - May 17 2011] * http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.4.tar.gz[version 1.0.4 - April 17 2011] | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/common/gearman.c ^ |
@@ -209,7 +209,7 @@ if( ret1 != GEARMAN_SUCCESS || ret2 != GEARMAN_SUCCESS || task == NULL - || gearman_client_error(client) != NULL + || ( gearman_client_error(client) != NULL && atof(gearman_version()) == 0.14 ) ) { /* log the error */ | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/common/gearman_utils.c ^ |
@@ -92,7 +92,12 @@ if(!strcmp( line, ".")) { if((line = strsep( &output, "\n" )) != NULL) { gm_log( GM_LOG_TRACE, "%s\n", line ); - snprintf(*version, GM_BUFFERSIZE, "%s", line); + if(line[0] == 'O') { + strncpy(*version, line+3, 10); + } else { + snprintf(*version, GM_BUFFERSIZE, "%s", line); + } + gm_log( GM_LOG_TRACE, "extracted version: '%s'\n", *version ); } /* sort our array by queue name */ | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/common/utils.c ^ |
@@ -969,6 +969,12 @@ free(v_c); } +/* convert to time */ +void double2timeval(double value, struct timeval *t) { + t->tv_sec = (int)value; + t->tv_usec = (int)((value - (double)t->tv_sec) * 1000000); +} + /* convert a timeval to double */ double timeval2double(struct timeval * t) { double val = 0.0; @@ -1174,7 +1180,7 @@ /* run the plugin check command */ pclose_result = run_check(exec_job->command_line, &plugin_output); - return_code = pclose_result; + return_code = pclose_result; if(fork_exec == GM_ENABLED) { if(write(pdes[1], plugin_output, strlen(plugin_output)+1) <= 0) @@ -1224,13 +1230,15 @@ /* signaled */ else if(return_code >= 128 && return_code < 144) { char * signame = nr2signal((int)(return_code-128)); - snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of %d is out of bounds. Plugin exited by signal %s. (worker: %s)", (int)(return_code), signame, hostname); + snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of %d is out of bounds. Plugin exited by signal %s. (worker: %s)\n%s", (int)(return_code), signame, hostname, buffer); return_code = STATE_CRITICAL; free(signame); } /* other error codes > 3 */ else if(return_code > 3) { - snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of %d is out of bounds. (worker: %s)", (int)(return_code), hostname); + gm_log( GM_LOG_INFO, "check exited with exit code > 3. Exit: %d\n", (int)(return_code)); + gm_log( GM_LOG_INFO, "stdout: %s\n", buffer); + snprintf( buffer, sizeof( buffer )-1, "CRITICAL: Return code of %d is out of bounds. (worker: %s)\n%s\n", (int)(return_code), hostname, buffer); return_code = STATE_CRITICAL; } | ||
[+] | Changed | mod_gearman-1.0.7.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.0.6. +# Generated by GNU Autoconf 2.65 for mod_gearman 1.0.7. # # 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.0.6' -PACKAGE_STRING='mod_gearman 1.0.6' +PACKAGE_VERSION='1.0.7' +PACKAGE_STRING='mod_gearman 1.0.7' PACKAGE_BUGREPORT='sven.nierlein@consol.de' PACKAGE_URL='' @@ -1249,7 +1249,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.0.6 to adapt to many kinds of systems. +\`configure' configures mod_gearman 1.0.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1315,7 +1315,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mod_gearman 1.0.6:";; + short | recursive ) echo "Configuration of mod_gearman 1.0.7:";; esac cat <<\_ACEOF @@ -1412,7 +1412,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mod_gearman configure 1.0.6 +mod_gearman configure 1.0.7 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -1875,7 +1875,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.0.6, which was +It was created by mod_gearman $as_me 1.0.7, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -2683,7 +2683,7 @@ # Define the identity of the package. PACKAGE='mod_gearman' - VERSION='1.0.6' + VERSION='1.0.7' cat >>confdefs.h <<_ACEOF @@ -5923,7 +5923,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.0.6, which was +This file was extended by mod_gearman $as_me 1.0.7, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5989,7 +5989,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.0.6 +mod_gearman config.status 1.0.7 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/configure.ac ^ |
@@ -3,7 +3,7 @@ ############################################## AC_PREREQ([2.59]) -AC_INIT([mod_gearman], [1.0.6], [sven.nierlein@consol.de]) +AC_INIT([mod_gearman], [1.0.7], [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]) | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/docs/QUICKSTART ^ |
@@ -52,9 +52,9 @@ -------------------------------------- #> cd /tmp -#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.6.tar.gz" -#> tar zxf mod_gearman-1.0.6.tar.gz -#> cd mod_gearman-1.0.6 +#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.7.tar.gz" +#> tar zxf mod_gearman-1.0.7.tar.gz +#> cd mod_gearman-1.0.7 #> ./configure --prefix=/opt --with-gearman=/opt --with-user=nagios --with-init-dir=/etc/init.d #> make #> make install @@ -118,7 +118,7 @@ -------------------------------------- #> grep mod_gearman /var/log/nagios3/nagios.log -[1295003042] mod_gearman: Version 1.0.6 +[1295003042] mod_gearman: Version 1.0.7 [1295003042] Event broker module '/opt/lib/mod_gearman/mod_gearman.o' initialized successfully. -------------------------------------- @@ -152,7 +152,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.0.6|worker=1 jobs=2c +check_gearman OK - debian64 has 1 worker and is working on 0 jobs. Version: 1.0.7|worker=1 jobs=2c -------------------------------------- The interesting number is the last one, '2c' in our case, which means there | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/docs/QUICKSTART.html ^ |
@@ -606,9 +606,9 @@ <div class="listingblock"> <div class="content"> <pre><tt>#> cd /tmp -#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.6.tar.gz" -#> tar zxf mod_gearman-1.0.6.tar.gz -#> cd mod_gearman-1.0.6 +#> wget "http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.7.tar.gz" +#> tar zxf mod_gearman-1.0.7.tar.gz +#> cd mod_gearman-1.0.7 #> ./configure --prefix=/opt --with-gearman=/opt --with-user=nagios --with-init-dir=/etc/init.d #> make #> make install @@ -666,7 +666,7 @@ <div class="listingblock"> <div class="content"> <pre><tt>#> grep mod_gearman /var/log/nagios3/nagios.log -[1295003042] mod_gearman: Version 1.0.6 +[1295003042] mod_gearman: Version 1.0.7 [1295003042] Event broker module '/opt/lib/mod_gearman/mod_gearman.o' initialized successfully.</tt></pre> </div></div> </div> @@ -693,7 +693,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.0.6|worker=1 jobs=2c</tt></pre> +check_gearman OK - debian64 has 1 worker and is working on 0 jobs. Version: 1.0.7|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> @@ -733,7 +733,7 @@ <div id="footnotes"><hr /></div> <div id="footer"> <div id="footer-text"> -Last updated 2011-05-25 17:02:58 CEST +Last updated 2011-06-27 12:20:00 CEST </div> </div> </body> | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/docs/README.html ^ |
@@ -1621,7 +1621,7 @@ <div class="ulist"><ul> <li> <p> -<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.6.tar.gz">version 1.0.6 - June 04 2011</a> +<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.7.tar.gz">version 1.0.7 - July 03 2011</a> </p> </li> <li> @@ -1639,6 +1639,11 @@ <div class="ulist"><ul> <li> <p> +<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.7.tar.gz">version 1.0.7 - July 03 2011</a> +</p> +</li> +<li> +<p> <a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.6.tar.gz">version 1.0.6 - June 04 2011</a> </p> </li> @@ -1708,7 +1713,7 @@ <div id="footnotes"><hr /></div> <div id="footer"> <div id="footer-text"> -Last updated 2011-06-04 11:49:21 CEST +Last updated 2011-07-03 15:20:39 CEST </div> </div> </body> | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/extras/gearmand-init ^ |
@@ -12,13 +12,13 @@ ### END INIT INFO NAME=gearmand -DAEMON="/usr/sbin/gearmand" +DAEMON="/opt/projects/gearmand/gearmand/gearmand" OPTIONS="-d -j 0" PORT=4730 LISTEN=0.0.0.0 PIDFILE=/tmp/gm/var/mod_gearman/gearmand.pid LOGFILE=/tmp/gm/var/mod_gearman/gearmand.log -USER=sven +USER=nagios GRACEFUL_SHUTDOWN_TIME=30 LIBEVENTMINVERSION=1.4 for f in $( which netcat nc 2>/dev/null ) ; do | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/include/common.h ^ |
@@ -52,7 +52,7 @@ #define MOD_GM_COMMON_H /* constants */ -#define GM_VERSION "1.0.6" +#define GM_VERSION "1.0.7" #define GM_ENABLED 1 #define GM_DISABLED 0 #define GM_BUFFERSIZE 98304 | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/include/send_multi.h ^ |
@@ -124,11 +124,12 @@ * read_child_check * * @param[in] bufstart - start of buffer - * @param[in] bufend - end of buffer + * @param[in] bufend - end of buffer + * @param[in] end_time - timestruct when check is over * * @return TRUE on success or FALSE if something went wrong */ -int read_child_check(char *bufstart, char *bufend); +int read_child_check(char *bufstart, char *bufend, struct timeval * end_time); /** * read_multi_attribute | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/include/utils.h ^ |
@@ -257,6 +257,18 @@ void string2timeval(char * value, struct timeval * t); /** + * double2timeval + * + * parse double into timeval + * + * @param[in] value - double value + * @param[out] t - pointer to timeval structure + * + * @return nothing + */ +void double2timeval(double value, struct timeval * t); + +/** * timeval2double * * convert timeval into double | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/support/mod_gearman.spec ^ |
@@ -1,61 +1,93 @@ Name: mod_gearman -Version: 1.0.4 -Release: 3 +Version: 1.0.7 +Release: 1%{?dist} License: GNU Public License version 2 -Packager: Olivier Raginel <babar@cern.ch> -Vendor: Icinga team +Packager: Michael Friedrich <michael.friedrich@univie.ac.at> +Vendor: Icinga Team URL: http://labs.consol.de/nagios/mod-gearman/ -Prefix: /opt/mod_gearman -Source: http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-%{version}.tar.gz +Source0: mod_gearman-%{version}.tar.gz +#Source1: https://github.com/sni/mod_gearman/tarball/v%{version} Group: Applications/Monitoring Requires: gearmand BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n) BuildRequires: autoconf, automake BuildRequires: libtool, libevent-devel, ncurses-devel -Summary: Gearman module for Nagios / Icinga +Summary: Gearman module for Icinga/Nagios Requires(pre,post): /sbin/ldconfig Provides: mod_gearman %description -From the web page (http://labs.consol.de/nagios/mod-gearman/): - -Mod Gearman is a new way of distributing active Nagios checks -across your network. It consists of two parts: There is a NEB -module which resides in the Nagios core and adds servicechecks, -hostchecks and eventhandler to a Gearman queue. There can be -multiple equal gearman servers. The counterpart is one or more -worker clients for the checks itself. They can be bound to host -and servicegroups. +Mod Gearman is a new way of distributing active Icinga/Nagios +checks across your network. It consists of two parts: There is +a NEB module which resides in the Icinga/Nagios core and adds +servicechecks, hostchecks and eventhandler to a Gearman queue. +There can be multiple equal gearman servers. The counterpart +is one or more worker clients for the checks itself. They can +be bound to host and servicegroups. %prep %setup -q [ -f ./configure ] || ./autogen.sh -%configure - %build +%configure \ + --datadir="%{_datadir}" \ + --datarootdir="%{_datadir}" \ + --localstatedir="%{_localstatedir}" \ + --sysconfdir="%{_sysconfdir}/mod_gearman" \ + --with-init-dir="%{_initrddir}" + %{__make} %{_smp_mflags} %install %{__rm} -rf %{buildroot} -%{__make} install install-config DESTDIR="%{buildroot}" AM_INSTALL_PROGRAM_FLAGS="" +%{__make} install \ + install-config \ + DESTDIR="%{buildroot}" \ + AM_INSTALL_PROGRAM_FLAGS="" + +#move shared config from datadir to sysconfdir +mv %{buildroot}/%{_datadir}/mod_gearman/shared.conf %{buildroot}/%{_sysconfdir}/mod_gearman/shared.conf +mv %{buildroot}/%{_datadir}/mod_gearman/standalone_worker.conf %{buildroot}/%{_sysconfdir}/mod_gearman/standalone_worker.conf -%clean -%{__rm} -rf %{buildroot} +# remove custom gearmand initscript +%{__rm} -f %{buildroot}/%{_initrddir}/gearmand %post -p /sbin/ldconfig + %postun -p /sbin/ldconfig +%clean +%{__rm} -rf %{buildroot} + %files +%attr(755,root,root) %{_initrddir}/mod_gearman_worker +%config(noreplace) %{_sysconfdir}/mod_gearman/mod_gearman.conf +%config(noreplace) %{_sysconfdir}/mod_gearman/shared.conf +%config(noreplace) %{_sysconfdir}/mod_gearman/standalone_worker.conf + +%{_bindir}/check_gearman +%{_bindir}/gearman_top +%{_bindir}/mod_gearman_worker +%{_bindir}/send_gearman +%{_bindir}/send_multi + +%{_libdir}/mod_gearman/mod_gearman.o +%{_libdir}/mod_gearman/mod_gearman.so + +%attr(755,nagios,root) %{_localstatedir}/mod_gearman + %defattr(-,root,root) %docdir %{_defaultdocdir} -%{_prefix} -%{_sysconfdir} -%defattr(-,nagios,root) -%{_localstatedir} %changelog +* Mon Jun 06 2011 Michael Friedrich <michael.friedrich@univie.ac.at> +- reworked spec file to fit fhs compliance in /etc/mod_gearman +- moved extras/*conf from localestatedir to sysconfdir +- added config noreplace to config targets +- removed custom gearmand init script, interferes with gearmand dependency on rhel + * Fri Feb 11 2011 Sven Nierlein <sven@consol.de> - Adapted spec file for SLES11 | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/t/02-full.c ^ |
@@ -31,7 +31,13 @@ sid = setsid(); char port[30]; snprintf(port, 30, "--port=%d", GEARMAND_TEST_PORT); - execlp("gearmand", "gearmand", "--threads=10", "--job-retries=0", port, "--verbose=5", (char *)NULL); + /* for newer gearman versions */ + if(atof(gearman_version()) > 0.14) { + execlp("gearmand", "gearmand", "--threads=10", "--job-retries=0", port, "--verbose=5", (char *)NULL); + } else { + /* for gearman 0.14 */ + execlp("gearmand", "gearmand", "-t 10", "-j 0", port, (char *)NULL); + } perror("gearmand"); exit(1); } @@ -152,7 +158,10 @@ /* main tests */ int main(void) { int status, chld; - int tests = 36; + int tests = 40; + int rrc; + char cmd[150]; + char * result; plan(tests); mod_gm_opt = malloc(sizeof(mod_gm_opt_t)); @@ -232,6 +241,23 @@ sleep(1); } + /***************************************** + * send_gearman + */ + snprintf(cmd, 150, "./send_gearman --server=localhost:%d --key=testtest --host=test --service=test --message=test --returncode=0", GEARMAND_TEST_PORT); + rrc = real_exit_code(run_check(cmd, &result)); + cmp_ok(rrc, "==", 0, "cmd '%s' returned rc %d", cmd, rrc); + like(result, "^\s*$", "output from ./send_gearman"); + + /***************************************** + * send_gearman + */ + snprintf(cmd, 150, "./send_multi --server=localhost:%d --host=blah < t/data/send_multi.txt", GEARMAND_TEST_PORT); + rrc = real_exit_code(run_check(cmd, &result)); + cmp_ok(rrc, "==", 0, "cmd '%s' returned rc %d", cmd, rrc); + like(result, "send_multi OK: 2 check_multi child checks submitted", "output from ./send_multi"); + + /* cleanup */ mod_gm_free_opt(mod_gm_opt); free_client(&client); | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/t/03-exec_checks.c ^ |
@@ -12,10 +12,10 @@ int main(void) { int rc, rrc; char * result; - char cmd[100]; + char cmd[120]; char hostname[GM_BUFFERSIZE]; - plan(40); + plan(42); /* set hostname */ gethostname(hostname, GM_BUFFERSIZE-1); @@ -44,6 +44,22 @@ like(argv[3], "foo", "parsing args cmd 2"); /***************************************** + * send_gearman + */ + strcpy(cmd, "./send_gearman --server=blah --key=testtest --host=test --service=test --message=test --returncode=0"); + rrc = real_exit_code(run_check(cmd, &result)); + diag(result); + cmp_ok(rrc, "==", 1, "cmd '%s' returned rc %d", cmd, rrc); + + /***************************************** + * send_gearman + */ + strcpy(cmd, "./send_multi --server=blah --host=blah < t/data/send_multi.txt"); + rrc = real_exit_code(run_check(cmd, &result)); + diag(result); + cmp_ok(rrc, "==", 1, "cmd '%s' returned rc %d", cmd, rrc); + + /***************************************** * simple test command 1 */ strcpy(cmd, "/bin/true"); | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/tools/send_multi.c ^ |
@@ -216,15 +216,13 @@ gm_log( GM_LOG_TRACE, "queue: %s\n", mod_gm_opt->result_queue ); temp_buffer1[0]='\x0'; - snprintf( temp_buffer1, sizeof( temp_buffer1 )-1, "type=%s\nhost_name=%s\nstart_time=%i.%i\nfinish_time=%i.%i\nlatency=%i.%i\nreturn_code=%i\n", + snprintf( temp_buffer1, sizeof( temp_buffer1 )-1, "type=%s\nhost_name=%s\nstart_time=%i.%i\nfinish_time=%i.%i\nreturn_code=%i\n", mod_gm_opt->active == GM_ENABLED ? "active" : "passive", mod_gm_opt->host, (int)mod_gm_opt->starttime.tv_sec, (int)mod_gm_opt->starttime.tv_usec, (int)mod_gm_opt->finishtime.tv_sec, (int)mod_gm_opt->finishtime.tv_usec, - (int)mod_gm_opt->latency.tv_sec, - (int)mod_gm_opt->latency.tv_usec, mod_gm_opt->return_code ); @@ -308,6 +306,9 @@ char *bufstart=NULL; char *bufend=NULL; int count=0; + struct timeval end_time; + + gettimeofday(&end_time, NULL); do { /* opening tag <CHILD> found? read from buffer start with maximum buffer len */ @@ -324,7 +325,7 @@ bufstart+=strlen("<CHILD>"); /* if valid check_multi chunk found, send the result*/ - if (read_child_check(bufstart,bufend)) { + if (read_child_check(bufstart,bufend,&end_time)) { if (send_result() == GM_ERROR) { count--; } @@ -372,11 +373,13 @@ return count; } -int read_child_check(char *bufstart, char *bufend) { +int read_child_check(char *bufstart, char *bufend, struct timeval * end_time) { char *attribute = NULL; char *attribute2 = NULL; char *error = NULL; char temp_buffer[GM_BUFFERSIZE]; + double end_time_d; + struct timeval start_time; /* child check number */ if ((attribute=read_multi_attribute(bufstart,bufend,"no")) == NULL) { @@ -401,28 +404,20 @@ mod_gm_opt->return_code=atoi(attribute); gm_log( GM_LOG_TRACE, "mod_gm_opt->return_code: %d\n", mod_gm_opt->return_code); - /* start time */ - if ((attribute=read_multi_attribute(bufstart,bufend,"starttime")) == NULL) + /* runtime */ + if ((attribute=read_multi_attribute(bufstart,bufend,"runtime")) == NULL) return 0; - if (strchr(attribute, '.') != NULL) { - mod_gm_opt->starttime.tv_sec=atoi(strtok(attribute, ".")); - mod_gm_opt->starttime.tv_usec=atoi(strtok(NULL, ".")); - } else { - mod_gm_opt->starttime.tv_sec=atoi(attribute); - mod_gm_opt->starttime.tv_usec=0; - } + end_time_d = timeval2double(end_time); + double2timeval(end_time_d - atof(attribute), &start_time); + + mod_gm_opt->starttime.tv_sec = start_time.tv_sec; + mod_gm_opt->starttime.tv_usec = start_time.tv_usec; gm_log( GM_LOG_TRACE, "starttime: %d.%d\n", mod_gm_opt->starttime.tv_sec, mod_gm_opt->starttime.tv_usec); - /* end time */ - if ((attribute=read_multi_attribute(bufstart,bufend,"endtime")) == NULL) - return 0; - if (strchr(attribute, '.') != NULL) { - mod_gm_opt->finishtime.tv_sec=atoi(strtok(attribute, ".")); - mod_gm_opt->finishtime.tv_usec=atoi(strtok(NULL, ".")); - } else { - mod_gm_opt->finishtime.tv_sec=atoi(attribute); - mod_gm_opt->finishtime.tv_usec=0; - } + + /* end time is the execution time of send_multi itself */ + mod_gm_opt->finishtime.tv_sec = end_time->tv_sec; + mod_gm_opt->finishtime.tv_usec = end_time->tv_usec; gm_log( GM_LOG_TRACE, "endtime: %d.%d\n", mod_gm_opt->finishtime.tv_sec, mod_gm_opt->finishtime.tv_usec); /* message */ | ||
[+] | Changed | mod_gearman-1.0.7.tar.bz2/worker/initscript.in ^ |
@@ -20,6 +20,11 @@ USER=%USER% USERID=`id -u` +# load extra environment variables +if [ -f /etc/sysconfig/mod_gearman_worker ]; then + . /etc/sysconfig/mod_gearman_worker +fi + # create state dir if [ "$USERID" -eq 0 ]; then mkdir -p $(dirname $PIDFILE) |