Changes of Revision 24
[-] | Changed | icinga-mod_gearman.changes |
1
2 ------------------------------------------------------------------- 3 +Sun May 15 17:15:11 UTC 2011 - cs@linux-administrator.com 4 + 5 +- update to release 1.0.4 6 + 7 +------------------------------------------------------------------- 8 Thu Mar 31 17:44:22 UTC 2011 - cs@linux-administrator.com 9 10 - update to release 1.0.3 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.3 6 +Version: 1.0.4 7 Release: 1 8 Group: Application/System 9 License: GPLv3 10 |
||
[+] | Deleted | mod_gearman-1.0.3.tar.bz2/etc/mod_gearman.conf ^ |
@@ -1,154 +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 - -# 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=/opt/local/var/mod_gearman/mod_gearman_worker.pid - -# Path to the logfile. -logfile=/opt/local/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 | ||
[+] | Deleted | mod_gearman-1.0.3.tar.bz2/include/gm_log.h ^ |
@@ -1,29 +0,0 @@ -/****************************************************************************** - * - * mod_gearman - distribute checks with gearman - * - * Copyright (c) 2010 Sven Nierlein - sven.nierlein@consol.de - * - * This file is part of mod_gearman. - * - * mod_gearman is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * mod_gearman is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with mod_gearman. If not, see <http://www.gnu.org/licenses/>. - * - *****************************************************************************/ - -/** @file - * @brief header for the log module - */ - -#include "nagios/nagios.h" - | ||
[+] | Deleted | mod_gearman-1.0.3.tar.bz2/include/tools_logger.h ^ |
@@ -1,33 +0,0 @@ -/****************************************************************************** - * - * mod_gearman - distribute checks with gearman - * - * Copyright (c) 2010 Sven Nierlein - sven.nierlein@consol.de - * - * This file is part of mod_gearman. - * - * mod_gearman is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * mod_gearman is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with mod_gearman. If not, see <http://www.gnu.org/licenses/>. - * - *****************************************************************************/ - -/** @file - * @brief header for the tools logger component - */ - -#include <stdio.h> -#include <string.h> -#include <time.h> -#include <stdarg.h> -#include <unistd.h> - | ||
[+] | Deleted | mod_gearman-1.0.3.tar.bz2/include/worker_logger.h ^ |
@@ -1,33 +0,0 @@ -/****************************************************************************** - * - * mod_gearman - distribute checks with gearman - * - * Copyright (c) 2010 Sven Nierlein - sven.nierlein@consol.de - * - * This file is part of mod_gearman. - * - * mod_gearman is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * mod_gearman is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with mod_gearman. If not, see <http://www.gnu.org/licenses/>. - * - *****************************************************************************/ - -/** @file - * @brief header for mod-gearman worker logger - */ - -#include <stdio.h> -#include <string.h> -#include <time.h> -#include <stdarg.h> -#include <unistd.h> - | ||
[+] | Deleted | mod_gearman-1.0.3.tar.bz2/neb_module/gm_log.c ^ |
@@ -1,55 +0,0 @@ -/****************************************************************************** - * - * mod_gearman - distribute checks with gearman - * - * Copyright (c) 2010 Sven Nierlein - sven.nierlein@consol.de - * - * This file is part of mod_gearman. - * - * mod_gearman is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * mod_gearman is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with mod_gearman. If not, see <http://www.gnu.org/licenses/>. - * - *****************************************************************************/ - -#include "common.h" -#include "mod_gearman.h" -#include "gm_log.h" - -void gm_log( int lvl, const char *text, ... ) { - char buffer[GM_BUFFERSIZE]; - va_list ap; - - /* check log level */ - if ( mod_gm_opt->debug_level < 0 ) - return; - if ( lvl != GM_LOG_ERROR && lvl > mod_gm_opt->debug_level ) - return; - - if ( lvl == GM_LOG_ERROR ) { - snprintf( buffer, 22, "mod_gearman: ERROR - " ); - } else { - snprintf( buffer, 14, "mod_gearman: " ); - } - va_start( ap, text ); - vsnprintf( buffer + strlen( buffer ), sizeof( buffer ) - strlen( buffer ), text, ap ); - va_end( ap ); - - /* in case of stdout logging just print and return */ - if ( mod_gm_opt->debug_level >= GM_LOG_STDOUT ) { - printf( "%s", buffer ); - return; - } - - /* send everything as info message to the core */ - write_to_all_logs( buffer, NSLOG_INFO_MESSAGE ); -} | ||
[+] | Deleted | mod_gearman-1.0.3.tar.bz2/tools/tools_logger.c ^ |
@@ -1,79 +0,0 @@ -/****************************************************************************** - * - * mod_gearman - distribute checks with gearman - * - * Copyright (c) 2010 Sven Nierlein - sven.nierlein@consol.de - * - * This file is part of mod_gearman. - * - * mod_gearman is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * mod_gearman is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with mod_gearman. If not, see <http://www.gnu.org/licenses/>. - * - *****************************************************************************/ - -#include "common.h" -#include "worker.h" -#include "tools_logger.h" - -struct tm now; - -void gm_log( int lvl, const char *text, ... ) { - FILE * fp = NULL; - int debug_level = GM_LOG_ERROR; - char buffer[GM_BUFFERSIZE]; - time_t t; - char * level; - va_list ap; - char buffer2[GM_BUFFERSIZE]; - - if(mod_gm_opt != NULL) { - debug_level = mod_gm_opt->debug_level; - fp = mod_gm_opt->logfile_fp; - } - - /* check log level */ - if ( lvl != GM_LOG_ERROR && lvl > debug_level ) { - return; - } - - if ( lvl == GM_LOG_ERROR ) - level = "ERROR"; - else if ( lvl == GM_LOG_INFO ) - level = "INFO "; - else if ( lvl == GM_LOG_DEBUG ) - level = "DEBUG"; - else if ( lvl == GM_LOG_TRACE ) - level = "TRACE"; - else - level = "UNKNO"; - - t = time(NULL); - now = *(localtime(&t)); - - strftime(buffer, sizeof(buffer), "[%Y-%m-%d %H:%M:%S]", &now ); - - snprintf(buffer2, sizeof(buffer2), "[%i][%s] ", getpid(), level ); - strncat(buffer, buffer2, (sizeof(buffer)-1)); - - va_start( ap, text ); - vsnprintf( buffer + strlen( buffer ), sizeof( buffer ) - strlen( buffer ), text, ap ); - va_end( ap ); - - if(fp != NULL) { - fprintf( fp, "%s", buffer ); - fflush( fp ); - } else { - printf( "%s", buffer ); - } - return; -} | ||
[+] | Deleted | mod_gearman-1.0.3.tar.bz2/worker/worker_logger.c ^ |
@@ -1,79 +0,0 @@ -/****************************************************************************** - * - * mod_gearman - distribute checks with gearman - * - * Copyright (c) 2010 Sven Nierlein - sven.nierlein@consol.de - * - * This file is part of mod_gearman. - * - * mod_gearman is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * mod_gearman is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with mod_gearman. If not, see <http://www.gnu.org/licenses/>. - * - *****************************************************************************/ - -#include "common.h" -#include "worker.h" -#include "worker_logger.h" - -void gm_log( int lvl, const char *text, ... ) { - FILE * fp = NULL; - int debug_level = GM_LOG_ERROR; - char buffer[GM_BUFFERSIZE]; - char * level; - char buffer2[GM_BUFFERSIZE]; - time_t t; - va_list ap; - struct tm now; - - if(mod_gm_opt != NULL) { - debug_level = mod_gm_opt->debug_level; - fp = mod_gm_opt->logfile_fp; - } - - /* check log level */ - if ( lvl != GM_LOG_ERROR && lvl > debug_level ) { - return; - } - - t = time(NULL); - - if ( lvl == GM_LOG_ERROR ) - level = "ERROR"; - else if ( lvl == GM_LOG_INFO ) - level = "INFO "; - else if ( lvl == GM_LOG_DEBUG ) - level = "DEBUG"; - else if ( lvl == GM_LOG_TRACE ) - level = "TRACE"; - else - level = "UNKNO"; - - localtime_r(&t, &now); - - strftime(buffer, sizeof(buffer), "[%Y-%m-%d %H:%M:%S]", &now ); - - snprintf(buffer2, sizeof(buffer2), "[%i][%s] ", getpid(), level ); - strncat(buffer, buffer2, (sizeof(buffer)-1)); - - va_start( ap, text ); - vsnprintf( buffer + strlen( buffer ), sizeof( buffer ) - strlen( buffer ), text, ap ); - va_end( ap ); - - if(fp != NULL) { - fprintf( fp, "%s", buffer ); - fflush( fp ); - } else { - printf( "%s", buffer ); - } - return; -} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/Changes ^ |
@@ -1,5 +1,14 @@ This file documents the revision history for mod_gearman. +1.0.4 Sun Apr 17 17:58:47 CEST 2011 + - added generic logger + - enables logging to stdout, file, syslog or nagios + - changed latency calculation (use time of next_check instead of time of job submission) + - added nsca replacements docs + +1.0.3 Wed Mar 23 21:53:09 CET 2011 + - fixed worker handling exit codes > 127 + 1.0.2 Fri Mar 11 10:30:21 CET 2011 - added new option do_hostchecks to completly disable hostchecks - fixed reading keyfiles | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/Makefile.am ^ |
@@ -29,7 +29,6 @@ pkglib_LIBRARIES = mod_gearman.so mod_gearman_so_SOURCES = $(common_SOURCES) \ - neb_module/gm_log.c \ neb_module/result_thread.c \ neb_module/mod_gearman.c @@ -40,32 +39,28 @@ gearman_top mod_gearman_worker_SOURCES = $(common_SOURCES) \ - worker/worker_logger.c \ worker/worker_client.c \ worker/worker.c send_gearman_SOURCES = $(common_SOURCES) \ - tools/tools_logger.c \ tools/send_gearman.c send_multi_SOURCES = $(common_SOURCES) \ - tools/tools_logger.c \ tools/send_multi.c check_gearman_SOURCES = $(common_SOURCES) \ - tools/tools_logger.c \ tools/check_gearman.c gearman_top_SOURCES = $(common_SOURCES) \ - tools/tools_logger.c \ tools/gearman_top.c gearman_top_LDFLAGS = -lncurses # tests -check_PROGRAMS = 01_utils 02_full 03_exec -01_utils_SOURCES = $(common_SOURCES) t/tap.h t/tap.c worker/worker_logger.c t/01-utils.c -02_full_SOURCES = $(common_SOURCES) t/tap.h t/tap.c worker/worker_logger.c t/02-full.c -03_exec_SOURCES = $(common_SOURCES) t/tap.h t/tap.c worker/worker_logger.c t/03-exec_checks.c +check_PROGRAMS = 01_utils 02_full 03_exec 04_log +01_utils_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/01-utils.c +02_full_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/02-full.c +03_exec_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/03-exec_checks.c +04_log_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/04-log.c TESTS = $(check_PROGRAMS) @@ -228,3 +223,6 @@ deb: dpkg-buildpackage -us -uc + +mrproper: + git clean -xfd | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/Makefile.in ^ |
@@ -45,7 +45,8 @@ bin_PROGRAMS = mod_gearman_worker$(EXEEXT) send_gearman$(EXEEXT) \ send_multi$(EXEEXT) check_gearman$(EXEEXT) \ gearman_top$(EXEEXT) -check_PROGRAMS = 01_utils$(EXEEXT) 02_full$(EXEEXT) 03_exec$(EXEEXT) +check_PROGRAMS = 01_utils$(EXEEXT) 02_full$(EXEEXT) 03_exec$(EXEEXT) \ + 04_log$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ @@ -93,43 +94,44 @@ common/rijndael.$(OBJEXT) common/gearman.$(OBJEXT) \ common/gearman_utils.$(OBJEXT) common/utils.$(OBJEXT) am_mod_gearman_so_OBJECTS = $(am__objects_1) \ - neb_module/gm_log.$(OBJEXT) neb_module/result_thread.$(OBJEXT) \ + neb_module/result_thread.$(OBJEXT) \ neb_module/mod_gearman.$(OBJEXT) mod_gearman_so_OBJECTS = $(am_mod_gearman_so_OBJECTS) PROGRAMS = $(bin_PROGRAMS) am_01_utils_OBJECTS = $(am__objects_1) t/tap.$(OBJEXT) \ - worker/worker_logger.$(OBJEXT) t/01-utils.$(OBJEXT) + t/01-utils.$(OBJEXT) 01_utils_OBJECTS = $(am_01_utils_OBJECTS) 01_utils_LDADD = $(LDADD) am_02_full_OBJECTS = $(am__objects_1) t/tap.$(OBJEXT) \ - worker/worker_logger.$(OBJEXT) t/02-full.$(OBJEXT) + t/02-full.$(OBJEXT) 02_full_OBJECTS = $(am_02_full_OBJECTS) 02_full_LDADD = $(LDADD) am_03_exec_OBJECTS = $(am__objects_1) t/tap.$(OBJEXT) \ - worker/worker_logger.$(OBJEXT) t/03-exec_checks.$(OBJEXT) + t/03-exec_checks.$(OBJEXT) 03_exec_OBJECTS = $(am_03_exec_OBJECTS) 03_exec_LDADD = $(LDADD) +am_04_log_OBJECTS = $(am__objects_1) t/tap.$(OBJEXT) \ + t/04-log.$(OBJEXT) +04_log_OBJECTS = $(am_04_log_OBJECTS) +04_log_LDADD = $(LDADD) am_check_gearman_OBJECTS = $(am__objects_1) \ - tools/tools_logger.$(OBJEXT) tools/check_gearman.$(OBJEXT) + tools/check_gearman.$(OBJEXT) check_gearman_OBJECTS = $(am_check_gearman_OBJECTS) check_gearman_LDADD = $(LDADD) -am_gearman_top_OBJECTS = $(am__objects_1) tools/tools_logger.$(OBJEXT) \ - tools/gearman_top.$(OBJEXT) +am_gearman_top_OBJECTS = $(am__objects_1) tools/gearman_top.$(OBJEXT) gearman_top_OBJECTS = $(am_gearman_top_OBJECTS) gearman_top_LDADD = $(LDADD) gearman_top_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(gearman_top_LDFLAGS) $(LDFLAGS) -o $@ am_mod_gearman_worker_OBJECTS = $(am__objects_1) \ - worker/worker_logger.$(OBJEXT) worker/worker_client.$(OBJEXT) \ - worker/worker.$(OBJEXT) + worker/worker_client.$(OBJEXT) worker/worker.$(OBJEXT) mod_gearman_worker_OBJECTS = $(am_mod_gearman_worker_OBJECTS) mod_gearman_worker_LDADD = $(LDADD) am_send_gearman_OBJECTS = $(am__objects_1) \ - tools/tools_logger.$(OBJEXT) tools/send_gearman.$(OBJEXT) + tools/send_gearman.$(OBJEXT) send_gearman_OBJECTS = $(am_send_gearman_OBJECTS) send_gearman_LDADD = $(LDADD) -am_send_multi_OBJECTS = $(am__objects_1) tools/tools_logger.$(OBJEXT) \ - tools/send_multi.$(OBJEXT) +am_send_multi_OBJECTS = $(am__objects_1) tools/send_multi.$(OBJEXT) send_multi_OBJECTS = $(am_send_multi_OBJECTS) send_multi_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ @@ -141,13 +143,15 @@ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(mod_gearman_so_SOURCES) $(01_utils_SOURCES) \ - $(02_full_SOURCES) $(03_exec_SOURCES) $(check_gearman_SOURCES) \ - $(gearman_top_SOURCES) $(mod_gearman_worker_SOURCES) \ - $(send_gearman_SOURCES) $(send_multi_SOURCES) + $(02_full_SOURCES) $(03_exec_SOURCES) $(04_log_SOURCES) \ + $(check_gearman_SOURCES) $(gearman_top_SOURCES) \ + $(mod_gearman_worker_SOURCES) $(send_gearman_SOURCES) \ + $(send_multi_SOURCES) DIST_SOURCES = $(mod_gearman_so_SOURCES) $(01_utils_SOURCES) \ - $(02_full_SOURCES) $(03_exec_SOURCES) $(check_gearman_SOURCES) \ - $(gearman_top_SOURCES) $(mod_gearman_worker_SOURCES) \ - $(send_gearman_SOURCES) $(send_multi_SOURCES) + $(02_full_SOURCES) $(03_exec_SOURCES) $(04_log_SOURCES) \ + $(check_gearman_SOURCES) $(gearman_top_SOURCES) \ + $(mod_gearman_worker_SOURCES) $(send_gearman_SOURCES) \ + $(send_multi_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -276,35 +280,30 @@ pkglib_LIBRARIES = mod_gearman.so mod_gearman_so_SOURCES = $(common_SOURCES) \ - neb_module/gm_log.c \ neb_module/result_thread.c \ neb_module/mod_gearman.c mod_gearman_worker_SOURCES = $(common_SOURCES) \ - worker/worker_logger.c \ worker/worker_client.c \ worker/worker.c send_gearman_SOURCES = $(common_SOURCES) \ - tools/tools_logger.c \ tools/send_gearman.c send_multi_SOURCES = $(common_SOURCES) \ - tools/tools_logger.c \ tools/send_multi.c check_gearman_SOURCES = $(common_SOURCES) \ - tools/tools_logger.c \ tools/check_gearman.c gearman_top_SOURCES = $(common_SOURCES) \ - tools/tools_logger.c \ tools/gearman_top.c gearman_top_LDFLAGS = -lncurses -01_utils_SOURCES = $(common_SOURCES) t/tap.h t/tap.c worker/worker_logger.c t/01-utils.c -02_full_SOURCES = $(common_SOURCES) t/tap.h t/tap.c worker/worker_logger.c t/02-full.c -03_exec_SOURCES = $(common_SOURCES) t/tap.h t/tap.c worker/worker_logger.c t/03-exec_checks.c +01_utils_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/01-utils.c +02_full_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/02-full.c +03_exec_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/03-exec_checks.c +04_log_SOURCES = $(common_SOURCES) t/tap.h t/tap.c t/04-log.c TESTS = $(check_PROGRAMS) GEARMANDS = /usr/sbin/gearmand /opt/sbin/gearmand replace_vars = sed -e 's:%CONFIG%:$(sysconfdir)/mod_gearman.conf:g' \ @@ -431,8 +430,6 @@ neb_module/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) neb_module/$(DEPDIR) @: > neb_module/$(DEPDIR)/$(am__dirstamp) -neb_module/gm_log.$(OBJEXT): neb_module/$(am__dirstamp) \ - neb_module/$(DEPDIR)/$(am__dirstamp) neb_module/result_thread.$(OBJEXT): neb_module/$(am__dirstamp) \ neb_module/$(DEPDIR)/$(am__dirstamp) neb_module/mod_gearman.$(OBJEXT): neb_module/$(am__dirstamp) \ @@ -488,14 +485,6 @@ @$(MKDIR_P) t/$(DEPDIR) @: > t/$(DEPDIR)/$(am__dirstamp) t/tap.$(OBJEXT): t/$(am__dirstamp) t/$(DEPDIR)/$(am__dirstamp) -worker/$(am__dirstamp): - @$(MKDIR_P) worker - @: > worker/$(am__dirstamp) -worker/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) worker/$(DEPDIR) - @: > worker/$(DEPDIR)/$(am__dirstamp) -worker/worker_logger.$(OBJEXT): worker/$(am__dirstamp) \ - worker/$(DEPDIR)/$(am__dirstamp) t/01-utils.$(OBJEXT): t/$(am__dirstamp) t/$(DEPDIR)/$(am__dirstamp) 01_utils$(EXEEXT): $(01_utils_OBJECTS) $(01_utils_DEPENDENCIES) @rm -f 01_utils$(EXEEXT) @@ -509,14 +498,16 @@ 03_exec$(EXEEXT): $(03_exec_OBJECTS) $(03_exec_DEPENDENCIES) @rm -f 03_exec$(EXEEXT) $(LINK) $(03_exec_OBJECTS) $(03_exec_LDADD) $(LIBS) +t/04-log.$(OBJEXT): t/$(am__dirstamp) t/$(DEPDIR)/$(am__dirstamp) +04_log$(EXEEXT): $(04_log_OBJECTS) $(04_log_DEPENDENCIES) + @rm -f 04_log$(EXEEXT) + $(LINK) $(04_log_OBJECTS) $(04_log_LDADD) $(LIBS) tools/$(am__dirstamp): @$(MKDIR_P) tools @: > tools/$(am__dirstamp) tools/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) tools/$(DEPDIR) @: > tools/$(DEPDIR)/$(am__dirstamp) -tools/tools_logger.$(OBJEXT): tools/$(am__dirstamp) \ - tools/$(DEPDIR)/$(am__dirstamp) tools/check_gearman.$(OBJEXT): tools/$(am__dirstamp) \ tools/$(DEPDIR)/$(am__dirstamp) check_gearman$(EXEEXT): $(check_gearman_OBJECTS) $(check_gearman_DEPENDENCIES) @@ -527,6 +518,12 @@ gearman_top$(EXEEXT): $(gearman_top_OBJECTS) $(gearman_top_DEPENDENCIES) @rm -f gearman_top$(EXEEXT) $(gearman_top_LINK) $(gearman_top_OBJECTS) $(gearman_top_LDADD) $(LIBS) +worker/$(am__dirstamp): + @$(MKDIR_P) worker + @: > worker/$(am__dirstamp) +worker/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) worker/$(DEPDIR) + @: > worker/$(DEPDIR)/$(am__dirstamp) worker/worker_client.$(OBJEXT): worker/$(am__dirstamp) \ worker/$(DEPDIR)/$(am__dirstamp) worker/worker.$(OBJEXT): worker/$(am__dirstamp) \ @@ -553,21 +550,19 @@ -rm -f common/gearman_utils.$(OBJEXT) -rm -f common/rijndael.$(OBJEXT) -rm -f common/utils.$(OBJEXT) - -rm -f neb_module/gm_log.$(OBJEXT) -rm -f neb_module/mod_gearman.$(OBJEXT) -rm -f neb_module/result_thread.$(OBJEXT) -rm -f t/01-utils.$(OBJEXT) -rm -f t/02-full.$(OBJEXT) -rm -f t/03-exec_checks.$(OBJEXT) + -rm -f t/04-log.$(OBJEXT) -rm -f t/tap.$(OBJEXT) -rm -f tools/check_gearman.$(OBJEXT) -rm -f tools/gearman_top.$(OBJEXT) -rm -f tools/send_gearman.$(OBJEXT) -rm -f tools/send_multi.$(OBJEXT) - -rm -f tools/tools_logger.$(OBJEXT) -rm -f worker/worker.$(OBJEXT) -rm -f worker/worker_client.$(OBJEXT) - -rm -f worker/worker_logger.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -578,21 +573,19 @@ @AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/gearman_utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/rijndael.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@neb_module/$(DEPDIR)/gm_log.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@neb_module/$(DEPDIR)/mod_gearman.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@neb_module/$(DEPDIR)/result_thread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@t/$(DEPDIR)/01-utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@t/$(DEPDIR)/02-full.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@t/$(DEPDIR)/03-exec_checks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@t/$(DEPDIR)/04-log.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@t/$(DEPDIR)/tap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/check_gearman.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/gearman_top.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/send_gearman.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/send_multi.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/tools_logger.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@worker/$(DEPDIR)/worker.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@worker/$(DEPDIR)/worker_client.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@worker/$(DEPDIR)/worker_logger.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -1188,6 +1181,9 @@ deb: dpkg-buildpackage -us -uc +mrproper: + git clean -xfd + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/README ^ |
@@ -21,9 +21,11 @@ Support & Questions ------------------- -* Mod-Gearman has been succesfully tested with Nagios 3.2.3 and Icinga 1.2.0 and there are no known bugs at the moment. +* Mod-Gearman has been succesfully tested with Nagios 3.2.3 and Icinga + 1.2.0 running on Gearman 0.14. There are no known bugs at the moment. Let me know if you find one. -* Please use the Mod-Gearman https://groups.google.com/group/mod_gearman[google groups mailinglist] for support, questions and bug reports. +* https://groups.google.com/group/mod_gearman[google groups mailinglist] +* http://labs.consol.de/lang/de/forum/#/categories/mod-gearman[support forum] * Debian users may be interested in the http://labs.consol.de/nagios/mod-gearman/mod-gearman-quickstart-guide/[quickstart guide]. @@ -154,6 +156,22 @@ setup with just adding more worker of the same config. +NSCA Replacement +~~~~~~~~~~~~~~~~ + +++++ +<a title="NSCA Replacement" rel="lightbox[mod_gm]" href="http://labs.consol.de/wp-content/uploads/2010/09/nsca_replacement.png"><img src="http://labs.consol.de/wp-content/uploads/2010/09/nsca_replacement.png" alt="NSCA Replacement" width="300" height="220" style="float:none" /></a> +++++ + +If you just want to replace a current NSCA solution, you could load +the Mod-Gearman NEB module and disable all distribution features. You +still can receive passive results by the core send via +send_gearman / send_multi. Make sure you use the same encryption +settings like the neb module or your core won't be able to process the +results. + + + Installation @@ -281,6 +299,37 @@ debug=1 ==== + +logmode:: + set way of logging. + Possible values are: ++ +-- + * `automatic` - logfile when a logfile is specified. stdout when + no logfile is given. + stdout for tools. + * `stdout` - just print all messages to stdout + * `syslog` - use syslog for all log events + * `file` - use logfile + * `core` - use nagios internal loging (not thread safe! Use + with care) +-- ++ +Default is automatic. ++ +==== + debug=1 +==== + + +logfile:: +Path to the logfile. ++ +==== + logfile=/path/to/log.file +==== + + server:: sets the address of your gearman job server. Can be specified more than once to add more server. Mod-Gearman uses @@ -471,14 +520,6 @@ ==== -logfile:: -Path to the logfile. -+ -==== - logfile=/path/to/log.file -==== - - min-worker:: Minimum number of worker processes which should run at any time. Default: 1 + @@ -729,7 +770,7 @@ Download -------- -* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.3.tar.gz[version 1.0.3 - March 23 2011] +* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.4.tar.gz[version 1.0.4 - April 17 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 @@ -737,6 +778,7 @@ Archive ~~~~~~~ +* http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.4.tar.gz[version 1.0.4 - April 17 2011] * http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.3.tar.gz[version 1.0.3 - March 23 2011] * http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.2.tar.gz[version 1.0.2 - March 13 2011] * http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.1.tar.gz[version 1.0.1 - March 05 2011] @@ -748,5 +790,3 @@ * http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-0.5.tar.gz[version 0.5 - October 01 2010] * http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-0.4.tar.gz[version 0.4 - September 25 2010] - - | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/common/utils.c ^ |
@@ -22,7 +22,6 @@ *****************************************************************************/ #include "utils.h" -#include "gm_log.h" #include "crypt.h" #include "base64.h" @@ -198,6 +197,7 @@ opt->result_queue = NULL; opt->keyfile = NULL; opt->logfile = NULL; + opt->logmode = GM_LOG_MODE_AUTO; opt->logfile_fp = NULL; opt->message = NULL; opt->return_code = 0; @@ -384,6 +384,29 @@ if(opt->debug_level < 0) { opt->debug_level = 0; } } + /* logmode */ + else if ( !strcmp( key, "logmode" ) ) { + opt->logmode = GM_LOG_MODE_AUTO; + if ( !strcmp( value, "automatic" ) ) { + opt->logmode = GM_LOG_MODE_AUTO; + } + else if ( !strcmp( value, "file" ) ) { + opt->logmode = GM_LOG_MODE_FILE; + } + else if ( !strcmp( value, "stdout" ) ) { + opt->logmode = GM_LOG_MODE_STDOUT; + } + else if ( !strcmp( value, "syslog" ) ) { + opt->logmode = GM_LOG_MODE_SYSLOG; + } + else if ( !strcmp( value, "core" ) ) { + opt->logmode = GM_LOG_MODE_CORE; + } + else { + gm_log( GM_LOG_ERROR, "unknown log mode '%s', use one of 'automatic', 'file', 'stdout', 'syslog' and 'core'\n", value ); + } + } + /* result worker */ else if ( !strcmp( key, "result_workers" ) ) { opt->result_workers = atoi( value ); @@ -710,6 +733,20 @@ gm_log( GM_LOG_DEBUG, "--------------------------------\n" ); gm_log( GM_LOG_DEBUG, "configuration:\n" ); gm_log( GM_LOG_DEBUG, "log level: %d\n", opt->debug_level); + + if(opt->logmode == GM_LOG_MODE_AUTO) + gm_log( GM_LOG_DEBUG, "log mode: auto (%d)\n", opt->logmode); + if(opt->logmode == GM_LOG_MODE_FILE) + gm_log( GM_LOG_DEBUG, "log mode: file (%d)\n", opt->logmode); + if(opt->logmode == GM_LOG_MODE_STDOUT) + gm_log( GM_LOG_DEBUG, "log mode: stdout (%d)\n", opt->logmode); + if(opt->logmode == GM_LOG_MODE_CORE) + gm_log( GM_LOG_DEBUG, "log mode: core (%d)\n", opt->logmode); + if(opt->logmode == GM_LOG_MODE_SYSLOG) + gm_log( GM_LOG_DEBUG, "log mode: syslog (%d)\n", opt->logmode); + if(opt->logmode == GM_LOG_MODE_TOOLS) + gm_log( GM_LOG_DEBUG, "log mode: tools (%d)\n", opt->logmode); + if(mode == GM_WORKER_MODE) { gm_log( GM_LOG_DEBUG, "identifier: %s\n", opt->identifier); gm_log( GM_LOG_DEBUG, "pidfile: %s\n", opt->pidfile == NULL ? "no" : opt->pidfile); @@ -835,7 +872,8 @@ free(opt->crypt_key); opt->crypt_key = malloc(GM_BUFFERSIZE); - fgets(opt->crypt_key, 33, fp); + if(!fgets(opt->crypt_key, 33, fp)) + return(GM_ERROR); fclose(fp); rtrim(opt->crypt_key); @@ -1218,7 +1256,7 @@ /* set empty default job */ -int set_default_job(gm_job_t *job, mod_gm_opt_t *mod_gm_opt) { +int set_default_job(gm_job_t *job, mod_gm_opt_t *opt) { job->type = NULL; job->host_name = NULL; @@ -1231,7 +1269,7 @@ job->reschedule_check = TRUE; job->return_code = STATE_OK; job->latency = 0.0; - job->timeout = mod_gm_opt->job_timeout; + job->timeout = opt->job_timeout; job->start_time.tv_sec = 0L; job->start_time.tv_usec = 0L; @@ -1645,3 +1683,103 @@ } return strdup("UNKNOWN"); } + +/* generic logger function */ +void gm_log( int lvl, const char *text, ... ) { + FILE * fp = NULL; + int debug_level = GM_LOG_ERROR; + int logmode = GM_LOG_MODE_STDOUT; + int slevel; + char * level; + char buffer1[GM_BUFFERSIZE]; + char buffer2[GM_BUFFERSIZE]; + char buffer3[GM_BUFFERSIZE]; + time_t t; + va_list ap; + struct tm now; + + if(mod_gm_opt != NULL) { + debug_level = mod_gm_opt->debug_level; + logmode = mod_gm_opt->logmode; + fp = mod_gm_opt->logfile_fp; + } + + if(logmode == GM_LOG_MODE_CORE) { + if ( debug_level < 0 ) + return; + if ( lvl != GM_LOG_ERROR && lvl > debug_level ) + return; + + if ( lvl == GM_LOG_ERROR ) { + snprintf( buffer1, 22, "mod_gearman: ERROR - " ); + } else { + snprintf( buffer1, 14, "mod_gearman: " ); + } + va_start( ap, text ); + vsnprintf( buffer1 + strlen( buffer1 ), sizeof( buffer1 ) - strlen( buffer1 ), text, ap ); + va_end( ap ); + + if ( debug_level >= GM_LOG_STDOUT ) { + printf( "%s", buffer1 ); + return; + } + write_core_log( buffer1 ); + return; + } + + /* check log level */ + if ( lvl != GM_LOG_ERROR && lvl > debug_level ) { + return; + } + if ( lvl == GM_LOG_ERROR ) { + level = "ERROR"; + slevel = LOG_ERR; + } + else if ( lvl == GM_LOG_INFO ) { + level = "INFO "; + slevel = LOG_INFO; + } + else if ( lvl == GM_LOG_DEBUG ) { + level = "DEBUG"; + slevel = LOG_DEBUG; + } + else if ( lvl == GM_LOG_TRACE ) { + level = "TRACE"; + slevel = LOG_DEBUG; + } + else { + level = "UNKNOWN"; + slevel = LOG_DEBUG; + } + + /* set timestring */ + t = time(NULL); + localtime_r(&t, &now); + strftime(buffer1, sizeof(buffer1), "[%Y-%m-%d %H:%M:%S]", &now ); + + /* set timestring */ + snprintf(buffer2, sizeof(buffer2), "[%i][%s]", getpid(), level ); + + va_start( ap, text ); + vsnprintf( buffer3, GM_BUFFERSIZE, text, ap ); + va_end( ap ); + + if ( debug_level >= GM_LOG_STDOUT || logmode == GM_LOG_MODE_TOOLS ) { + printf( "%s", buffer3 ); + return; + } + + if(logmode == GM_LOG_MODE_FILE && fp != NULL) { + fprintf( fp, "%s%s %s", buffer1, buffer2, buffer3 ); + fflush( fp ); + } + else if(logmode == GM_LOG_MODE_SYSLOG) { + syslog(slevel , "%s %s", buffer2, buffer3 ); + } + else { + /* stdout logging */ + printf( "%s%s %s", buffer1, buffer2, buffer3 ); + } + + return; +} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/config.h.in ^ |
@@ -12,6 +12,9 @@ /* Define to 1 if you have the <curses.h> header file. */ #undef HAVE_CURSES_H +/* Define to 1 if you have the `dup2' function. */ +#undef HAVE_DUP2 + /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H @@ -39,6 +42,9 @@ /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H +/* Define to 1 if you have the `localtime_r' function. */ +#undef HAVE_LOCALTIME_R + /* Define to 1 if you have the <ltdl.h> header file. */ #undef HAVE_LTDL_H @@ -46,6 +52,9 @@ to 0 otherwise. */ #undef HAVE_MALLOC +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H @@ -94,9 +103,18 @@ /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `strpbrk' function. */ +#undef HAVE_STRPBRK + +/* Define to 1 if you have the `strsep' function. */ +#undef HAVE_STRSEP + /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR +/* Define to 1 if you have the `strtok' function. */ +#undef HAVE_STRTOK + /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL | ||
[+] | Changed | mod_gearman-1.0.4.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.0.3. +# Generated by GNU Autoconf 2.67 for mod_gearman 1.0.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.0.3' -PACKAGE_STRING='mod_gearman 1.0.3' +PACKAGE_VERSION='1.0.4' +PACKAGE_STRING='mod_gearman 1.0.4' PACKAGE_BUGREPORT='sven.nierlein@consol.de' PACKAGE_URL='' @@ -1250,7 +1250,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.3 to adapt to many kinds of systems. +\`configure' configures mod_gearman 1.0.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1316,7 +1316,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mod_gearman 1.0.3:";; + short | recursive ) echo "Configuration of mod_gearman 1.0.4:";; esac cat <<\_ACEOF @@ -1413,7 +1413,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mod_gearman configure 1.0.3 +mod_gearman configure 1.0.4 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1874,7 +1874,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.3, which was +It was created by mod_gearman $as_me 1.0.4, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2689,7 +2689,7 @@ # Define the identity of the package. PACKAGE='mod_gearman' - VERSION='1.0.3' + VERSION='1.0.4' cat >>confdefs.h <<_ACEOF @@ -5292,7 +5292,7 @@ ############################################## # Check some functions -for ac_func in gettimeofday strdup strchr strstr strtoul alarm gethostname memset strcspn strerror atexit gethostbyname socket +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 : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -5925,7 +5925,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.3, which was +This file was extended by mod_gearman $as_me 1.0.4, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5991,7 +5991,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.3 +mod_gearman config.status 1.0.4 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/configure.ac ^ |
@@ -3,7 +3,7 @@ ############################################## AC_PREREQ([2.59]) -AC_INIT([mod_gearman], [1.0.3], [sven.nierlein@consol.de]) +AC_INIT([mod_gearman], [1.0.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]) @@ -58,7 +58,7 @@ ############################################## # Check some functions -AC_CHECK_FUNCS([gettimeofday strdup strchr strstr strtoul alarm gethostname memset strcspn strerror atexit gethostbyname socket]) +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.0.4.tar.bz2/docs/README.html ^ |
@@ -591,13 +591,19 @@ <div class="ulist"><ul> <li> <p> -Mod-Gearman has been succesfully tested with Nagios 3.2.3 and Icinga 1.2.0 and there are no known bugs at the moment. +Mod-Gearman has been succesfully tested with Nagios 3.2.3 and Icinga + 1.2.0 running on Gearman 0.14. There are no known bugs at the moment. Let me know if you find one. </p> </li> <li> <p> -Please use the Mod-Gearman <a href="https://groups.google.com/group/mod_gearman">google groups mailinglist</a> for support, questions and bug reports. +<a href="https://groups.google.com/group/mod_gearman">google groups mailinglist</a> +</p> +</li> +<li> +<p> +<a href="http://labs.consol.de/lang/de/forum/#/categories/mod-gearman">support forum</a> </p> </li> <li> @@ -721,6 +727,14 @@ <a title="Distributed Monitoring with Load Balancing" rel="lightbox[mod_gm]" href="http://labs.consol.de/wp-content/uploads/2010/09/sample_distributed_load_balanced.png"><img src="http://labs.consol.de/wp-content/uploads/2010/09/sample_distributed_load_balanced.png" alt="Distributed Monitoring with Load Balancing" width="350" height="225" style="float:none" /></a> <div class="paragraph"><p>Your distributed setup could easily be extended to a load balanced setup with just adding more worker of the same config.</p></div> +<h3 id="_nsca_replacement">NSCA Replacement</h3><div style="clear:left"></div> +<a title="NSCA Replacement" rel="lightbox[mod_gm]" href="http://labs.consol.de/wp-content/uploads/2010/09/nsca_replacement.png"><img src="http://labs.consol.de/wp-content/uploads/2010/09/nsca_replacement.png" alt="NSCA Replacement" width="300" height="220" style="float:none" /></a> +<div class="paragraph"><p>If you just want to replace a current NSCA solution, you could load +the Mod-Gearman NEB module and disable all distribution features. You +still can receive passive results by the core send via +send_gearman / send_multi. Make sure you use the same encryption +settings like the neb module or your core won’t be able to process the +results.</p></div> </div> <h2 id="_installation">Installation</h2> <div class="sectionbody"> @@ -879,6 +893,68 @@ </div></div> </dd> <dt class="hdlist1"> +logmode +</dt> +<dd> +<p> + set way of logging. + Possible values are: +</p> +<div class="ulist"><ul> +<li> +<p> +<tt>automatic</tt> - logfile when a logfile is specified. stdout when + no logfile is given. + stdout for tools. +</p> +</li> +<li> +<p> +<tt>stdout</tt> - just print all messages to stdout +</p> +</li> +<li> +<p> +<tt>syslog</tt> - use syslog for all log events +</p> +</li> +<li> +<p> +<tt>file</tt> - use logfile +</p> +</li> +<li> +<p> +<tt>core</tt> - use nagios internal loging (not thread safe! Use + with care) +</p> +</li> +</ul></div> +<div class="paragraph"><p>Default is automatic.</p></div> +<div class="exampleblock"> +<div class="exampleblock-content"> +<div class="literalblock"> +<div class="content"> +<pre><tt>debug=1</tt></pre> +</div></div> +</div></div> +</dd> +<dt class="hdlist1"> +logfile +</dt> +<dd> +<p> +Path to the logfile. +</p> +<div class="exampleblock"> +<div class="exampleblock-content"> +<div class="literalblock"> +<div class="content"> +<pre><tt>logfile=/path/to/log.file</tt></pre> +</div></div> +</div></div> +</dd> +<dt class="hdlist1"> server </dt> <dd> @@ -1201,21 +1277,6 @@ </div></div> </dd> <dt class="hdlist1"> -logfile -</dt> -<dd> -<p> -Path to the logfile. -</p> -<div class="exampleblock"> -<div class="exampleblock-content"> -<div class="literalblock"> -<div class="content"> -<pre><tt>logfile=/path/to/log.file</tt></pre> -</div></div> -</div></div> -</dd> -<dt class="hdlist1"> min-worker </dt> <dd> @@ -1559,7 +1620,7 @@ <div class="ulist"><ul> <li> <p> -<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.3.tar.gz">version 1.0.3 - March 23 2011</a> +<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.4.tar.gz">version 1.0.4 - April 17 2011</a> </p> </li> <li> @@ -1577,6 +1638,11 @@ <div class="ulist"><ul> <li> <p> +<a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.4.tar.gz">version 1.0.4 - April 17 2011</a> +</p> +</li> +<li> +<p> <a href="http://labs.consol.de/wp-content/uploads/2010/09/mod_gearman-1.0.3.tar.gz">version 1.0.3 - March 23 2011</a> </p> </li> @@ -1631,7 +1697,7 @@ <div id="footnotes"><hr /></div> <div id="footer"> <div id="footer-text"> -Last updated 2011-03-23 21:47:45 CEST +Last updated 2011-04-18 13:00:46 CEST </div> </div> </body> | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/extras/gearmand-init ^ |
@@ -18,7 +18,7 @@ LISTEN=0.0.0.0 PIDFILE=/opt/local/var/mod_gearman/gearmand.pid LOGFILE=/opt/local/var/mod_gearman/gearmand.log -USER=nagios +USER=sven GRACEFUL_SHUTDOWN_TIME=30 LIBEVENTMINVERSION=1.4 for f in $( which netcat nc 2>/dev/null ) ; do | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/extras/shared.conf ^ |
@@ -1,11 +1,11 @@ ############################################################################### -# +# # mod_gearman - distribute checks with gearman -# +# # Copyright (c) 2010 Sven Nierlein -# +# # Sample Shared Worker / NEB Module Config -# +# ############################################################################### # use debug to increase the verbosity of the module. @@ -18,6 +18,22 @@ debug=0 +# set the way of logging +# Possible values are: +# automatic +# -> logfile when a logfile is specified +# -> stdout for tools +# file +# -> use logfile +# stdout +# -> just print all messages to stdout +# core +# -> use nagios internal loging (not thread safe! Use with care) +# syslog +# -> use syslog for all log events +logmode=automatic + + # sets the addess of your gearman job server. Can be specified # more than once to add more server. server=localhost:4730 @@ -49,6 +65,15 @@ # 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. | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/extras/standalone_worker.conf ^ |
@@ -1,11 +1,11 @@ ############################################################################### -# +# # mod_gearman - distribute checks with gearman -# +# # Copyright (c) 2010 Sven Nierlein -# +# # Sample Standalone Worker Config -# +# ############################################################################### # use debug to increase the verbosity of the module. @@ -18,6 +18,20 @@ debug=0 +# set the way of logging +# Possible values are: +# automatic +# -> logfile when a logfile is specified +# -> stdout for tools +# file +# -> use logfile +# stdout +# -> just print all messages to stdout +# syslog +# -> use syslog for all log events +logmode=automatic + + # sets the addess of your gearman job server. Can be specified # more than once to add more server. server=localhost:4730 | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/include/check_gearman.h ^ |
@@ -40,9 +40,6 @@ #include <signal.h> #include "common.h" -mod_gm_opt_t *mod_gm_opt; /**< global options structure */ - - /** check_gearman * * main function of check_gearman @@ -105,4 +102,3 @@ /** * @} */ - | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/include/common.h ^ |
@@ -52,7 +52,7 @@ #define MOD_GM_COMMON_H /* constants */ -#define GM_VERSION "1.0.3" +#define GM_VERSION "1.0.4" #define GM_ENABLED 1 #define GM_DISABLED 0 #define GM_BUFFERSIZE 98304 @@ -73,6 +73,14 @@ #define GM_LOG_TRACE 2 #define GM_LOG_STDOUT 3 +/* log modes */ +#define GM_LOG_MODE_AUTO 0 +#define GM_LOG_MODE_FILE 1 +#define GM_LOG_MODE_STDOUT 2 +#define GM_LOG_MODE_CORE 3 +#define GM_LOG_MODE_SYSLOG 4 +#define GM_LOG_MODE_TOOLS 5 + /* job priorities */ #define GM_JOB_PRIO_LOW 1 #define GM_JOB_PRIO_NORMAL 2 @@ -165,6 +173,9 @@ int job_timeout; /**< override job timeout */ int encryption; /**< flag wheter messages are encrypted */ int transportmode; /**< flag for the transportmode, base64 only or base64 and encrypted */ + int logmode; /**< logmode: auto, syslog, file or nagios */ + char * logfile; /**< path for the logfile */ + FILE * logfile_fp; /**< filedescriptor for the logfile */ /* neb module */ char * result_queue; /**< name of the result queue used by the neb module */ int result_workers; /**< number of result worker threads started */ @@ -180,8 +191,6 @@ /* worker */ char * identifier; /**< identifier for this worker */ char * pidfile; /**< path to a pidfile */ - char * logfile; /**< path for the logfile */ - FILE * logfile_fp; /**< filedescriptor for the logfile */ int daemon_mode; /**< running as daemon ot not? */ int debug_result; /**< flag to write a debug file for each result */ int max_age; /**< max age in seconds for new jobs */ @@ -226,20 +235,8 @@ } gm_job_t; -/** - * general logger - * - * logger is then defined in worker_logger.c - * and the neb logger in logger.c - * tools logger is in the tools_logger.c - * - * @param[in] lvl - debug level for this message - * @param[in] text - text to log - * - * @return nothing - */ -void gm_log( int lvl, const char *text, ... ); - +/** options structure */ +mod_gm_opt_t *mod_gm_opt; /* * @} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/include/gearman_top.h ^ |
@@ -38,8 +38,6 @@ #include <time.h> #include "common.h" -mod_gm_opt_t *mod_gm_opt; /**< global options structure */ - /** gearman_top * * main function of gearman_top | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/include/mod_gearman.h ^ |
@@ -22,8 +22,10 @@ *****************************************************************************/ #define MOD_GM_NEB /**< set mod_gearman neb features */ +#define NSCORE /**< enable core features */ -#include <common.h> +#include "utils.h" +#include "common.h" #include <stdio.h> #include <stdlib.h> @@ -32,7 +34,6 @@ #include <pthread.h> #define GM_PERFDATA_QUEUE "perfdata" /**< default performance data queue */ -#define NSCORE /**< enable core features */ /** @file * @brief Mod-Gearman NEB Module @@ -91,9 +92,6 @@ */ void mod_gm_add_result_to_list(check_result * newcheckresult); -/** options structure */ -mod_gm_opt_t *mod_gm_opt; - /** * @} */ | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/include/send_gearman.h ^ |
@@ -42,9 +42,6 @@ #include <libgearman/gearman.h> #include "common.h" -mod_gm_opt_t *mod_gm_opt; /**< global options structure */ - - /** send_gearman * * main function of gearman_top @@ -115,4 +112,3 @@ /** * @} */ - | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/include/send_multi.h ^ |
@@ -43,8 +43,6 @@ #include <libgearman/gearman.h> #include "common.h" -mod_gm_opt_t *mod_gm_opt; /**< options structure */ - /** send_multi * * main function of send_multi @@ -155,4 +153,3 @@ /** * @} */ - | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/include/utils.h ^ |
@@ -27,6 +27,19 @@ * @{ */ +#include <stdio.h> +#include <string.h> +#include <time.h> +#include <stdarg.h> +#include <unistd.h> +#include <errno.h> +#include <stdlib.h> +#include <ctype.h> +#include <syslog.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <sys/stat.h> + #include "common.h" /** @@ -431,8 +444,26 @@ */ char * eventtype2str(int i); +/** + * gm_log + * + * general logger + * + * @param[in] lvl - debug level for this message + * @param[in] text - text to log + * + * @return nothing + */ +void gm_log( int lvl, const char *text, ... ); + +/** write log line with core logger + * + * @param[in] data - log message + * + * @return nothing + */ +void write_core_log(char *data); /** * @} */ - | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/include/worker.h ^ |
@@ -44,7 +44,6 @@ */ int mod_gm_shm_key; /**< key for the shared memory segment */ -mod_gm_opt_t *mod_gm_opt; /**< global options structure */ /** Mod-Gearman Worker * @@ -193,4 +192,3 @@ /** * @} */ - | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/neb_module/mod_gearman.c ^ |
@@ -22,10 +22,8 @@ *****************************************************************************/ /* include header */ -#include "utils.h" #include "result_thread.h" #include "mod_gearman.h" -#include "gm_log.h" #include "gearman.h" /* specify event broker API version (required) */ @@ -79,19 +77,19 @@ gearman_module_handle=handle; /* set some module info */ - neb_set_module_info( gearman_module_handle, NEBMODULE_MODINFO_TITLE, "mod_gearman" ); + neb_set_module_info( gearman_module_handle, NEBMODULE_MODINFO_TITLE, "Mod-Gearman" ); neb_set_module_info( gearman_module_handle, NEBMODULE_MODINFO_AUTHOR, "Sven Nierlein" ); - neb_set_module_info( gearman_module_handle, NEBMODULE_MODINFO_TITLE, "Copyright (c) 2010 Sven Nierlein" ); + neb_set_module_info( gearman_module_handle, NEBMODULE_MODINFO_TITLE, "Copyright (c) 2010-2011 Sven Nierlein" ); neb_set_module_info( gearman_module_handle, NEBMODULE_MODINFO_VERSION, GM_VERSION ); neb_set_module_info( gearman_module_handle, NEBMODULE_MODINFO_LICENSE, "GPL v3" ); neb_set_module_info( gearman_module_handle, NEBMODULE_MODINFO_DESC, "distribute host/service checks and eventhandler via gearman" ); mod_gm_opt = malloc(sizeof(mod_gm_opt_t)); set_default_options(mod_gm_opt); - gm_log( GM_LOG_INFO, "Version %s\n", GM_VERSION ); /* parse arguments */ read_arguments( args ); + gm_log( GM_LOG_INFO, "Version %s\n", GM_VERSION ); gm_log( GM_LOG_TRACE, "args: %s\n", args ); gm_log( GM_LOG_TRACE, "nebmodule_init(%i, %i)\n", flags ); gm_log( GM_LOG_DEBUG, "running on libgearman %s\n", gearman_version() ); @@ -419,7 +417,6 @@ nebstruct_host_check_data * hostdata; char *raw_command=NULL; char *processed_command=NULL; - struct timeval start_time; host * hst; gm_log( GM_LOG_TRACE, "handle_host_check(%i)\n", event_type ); @@ -446,7 +443,10 @@ } /* get objects and set target function */ - hst = find_host( hostdata->host_name ); + if((hst=hostdata->object_ptr)==NULL) { + gm_log( GM_LOG_ERROR, "Host handler received NULL host object pointer.\n" ); + return NEBERROR_CALLBACKCANCEL; + } set_target_queue( hst, NULL ); /* local check? */ @@ -486,9 +486,6 @@ return NEBERROR_CALLBACKCANCEL; } - /* get the command start time */ - gettimeofday(&start_time,NULL); - /* increment number of host checks that are currently running */ currently_running_host_checks++; @@ -498,11 +495,10 @@ gm_log( GM_LOG_TRACE, "cmd_line: %s\n", processed_command ); temp_buffer[0]='\x0'; - snprintf( temp_buffer,sizeof( temp_buffer )-1,"type=host\nresult_queue=%s\nhost_name=%s\nstart_time=%i.%i\ntimeout=%d\ncommand_line=%s\n\n\n", + snprintf( temp_buffer,sizeof( temp_buffer )-1,"type=host\nresult_queue=%s\nhost_name=%s\nstart_time=%i.0\ntimeout=%d\ncommand_line=%s\n\n\n", mod_gm_opt->result_queue, hst->name, - ( int )start_time.tv_sec, - ( int )start_time.tv_usec, + ( int )hst->next_check, host_check_timeout, processed_command ); @@ -549,7 +545,6 @@ service * svc = NULL; char *raw_command=NULL; char *processed_command=NULL; - struct timeval start_time; nebstruct_service_check_data * svcdata; int prio = GM_JOB_PRIO_LOW; @@ -570,11 +565,16 @@ } /* get objects and set target function */ - svc = find_service( svcdata->host_name, svcdata->service_description ); + if((svc=svcdata->object_ptr)==NULL) { + gm_log( GM_LOG_ERROR, "Service handler received NULL service object pointer.\n" ); + return NEBERROR_CALLBACKCANCEL; + } /* find the host associated with this service */ - if((hst=svc->host_ptr)==NULL) + if((hst=svc->host_ptr)==NULL) { + gm_log( GM_LOG_ERROR, "Service handler received NULL host object pointer.\n" ); return NEBERROR_CALLBACKCANCEL; + } set_target_queue( hst, svc ); /* local check? */ @@ -611,9 +611,6 @@ return NEBERROR_CALLBACKCANCEL; } - /* get the command start time */ - gettimeofday(&start_time,NULL); - /* increment number of service checks that are currently running... */ currently_running_service_checks++; @@ -624,12 +621,11 @@ gm_log( GM_LOG_TRACE, "cmd_line: %s\n", processed_command ); temp_buffer[0]='\x0'; - snprintf( temp_buffer,sizeof( temp_buffer )-1,"type=service\nresult_queue=%s\nhost_name=%s\nservice_description=%s\nstart_time=%i.%i\ntimeout=%d\ncommand_line=%s\n\n\n", + snprintf( temp_buffer,sizeof( temp_buffer )-1,"type=service\nresult_queue=%s\nhost_name=%s\nservice_description=%s\nstart_time=%i.0\ntimeout=%d\ncommand_line=%s\n\n\n", mod_gm_opt->result_queue, svcdata->host_name, svcdata->service_description, - ( int )start_time.tv_sec, - ( int )start_time.tv_usec, + ( int )svc->next_check, service_check_timeout, processed_command ); @@ -714,14 +710,29 @@ /* verify our option */ static int verify_options(mod_gm_opt_t *opt) { + + /* open new logfile */ + if ( opt->logmode == GM_LOG_MODE_AUTO && opt->logfile ) { + opt->logmode = GM_LOG_MODE_FILE; + } + if(opt->logmode == GM_LOG_MODE_FILE && opt->logfile && opt->debug_level < GM_LOG_STDOUT) { + opt->logfile_fp = fopen(opt->logfile, "a+"); + if(opt->logfile_fp == NULL) { + gm_log( GM_LOG_ERROR, "error opening logfile: %s\n", opt->logfile ); + } + } + if ( opt->logmode == GM_LOG_MODE_AUTO ) { + opt->logmode = GM_LOG_MODE_CORE; + } + /* did we get any server? */ if(opt->server_num == 0) { gm_log( GM_LOG_ERROR, "please specify at least one server\n" ); return(GM_ERROR); } - if ( mod_gm_opt->result_queue == NULL ) - mod_gm_opt->result_queue = GM_DEFAULT_RESULT_QUEUE; + if ( opt->result_queue == NULL ) + opt->result_queue = GM_DEFAULT_RESULT_QUEUE; /* nothing set by hand -> defaults */ if( opt->set_queues_by_hand == 0 ) { @@ -1113,3 +1124,10 @@ mod_gm_opt->debug_level = debug_level_orig; return return_code; } + + +/* core log wrapper */ +void write_core_log(char *data) { + write_to_all_logs( data, NSLOG_INFO_MESSAGE ); + return; +} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/neb_module/result_thread.c ^ |
@@ -26,7 +26,6 @@ #include "result_thread.h" #include "utils.h" #include "mod_gearman.h" -#include "gm_log.h" #include "gearman.h" /* cleanup and exit this thread */ | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/support/mod_gearman.spec ^ |
@@ -1,5 +1,5 @@ Name: mod_gearman -Version: 1.0.3 +Version: 1.0.4 Release: 3 License: GNU Public License version 2 Packager: Olivier Raginel <babar@cern.ch> | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/t/01-utils.c ^ |
@@ -4,7 +4,6 @@ #include <unistd.h> #include <t/tap.h> -#include <worker_logger.h> #include <common.h> #include <utils.h> @@ -153,3 +152,9 @@ return exit_status(); } + +/* core log wrapper */ +void write_core_log(char *data) { + printf("core logger is not available for tests: %s", data); + return; +} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/t/02-full.c ^ |
@@ -7,7 +7,6 @@ #include <sys/time.h> #include <t/tap.h> -#include <worker_logger.h> #include <common.h> #include <utils.h> #include <gearman.h> @@ -249,3 +248,9 @@ endskip; return exit_status(); } + +/* core log wrapper */ +void write_core_log(char *data) { + printf("core logger is not available for tests: %s", data); + return; +} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/t/03-exec_checks.c ^ |
@@ -4,7 +4,6 @@ #include <unistd.h> #include <t/tap.h> -#include <worker_logger.h> #include <common.h> #include <utils.h> @@ -223,3 +222,9 @@ return exit_status(); } + +/* core log wrapper */ +void write_core_log(char *data) { + printf("core logger is not available for tests: %s", data); + return; +} | ||
[+] | Added | mod_gearman-1.0.4.tar.bz2/t/04-log.c ^ |
@@ -0,0 +1,43 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <signal.h> +#include <sys/wait.h> +#include <sys/time.h> + +#include <t/tap.h> +#include <common.h> +#include <utils.h> + + +mod_gm_opt_t *mod_gm_opt; + +/* main tests */ +int main(void) { + int tests = 4; + plan(tests); + + mod_gm_opt = malloc(sizeof(mod_gm_opt_t)); + set_default_options(mod_gm_opt); + + mod_gm_opt->logmode = GM_LOG_MODE_AUTO; + lives_ok({gm_log(GM_LOG_INFO, "info message auto\n");}, "info message in auto mode"); + + mod_gm_opt->logmode = GM_LOG_MODE_STDOUT; + lives_ok({gm_log(GM_LOG_INFO, "info message stdout\n");}, "info message in stdout mode"); + + mod_gm_opt->logmode = GM_LOG_MODE_SYSLOG; + lives_ok({gm_log(GM_LOG_INFO, "info message syslog\n");}, "info message in syslog mode"); + + mod_gm_opt->logmode = GM_LOG_MODE_CORE; + lives_ok({gm_log(GM_LOG_INFO, "info message core\n");}, "info message in core mode"); + + return exit_status(); +} + +/* core log wrapper */ +void write_core_log(char *data) { + printf("core logger is not available for tests: %s", data); + return; +} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/tools/check_gearman.c ^ |
@@ -88,6 +88,7 @@ } } 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) { @@ -132,10 +133,10 @@ printf("\n"); printf("check_gearman [ -H=<hostname> ]\n"); printf(" [ -t=<timeout> ]\n"); - printf(" [ -w=<jobs warning level> ] default: 10\n"); - printf(" [ -c=<jobs critical level> ] default: 100\n"); - printf(" [ -W=<worker warning level> ] default: 25\n"); - printf(" [ -C=<worker critical level> ] default: 50\n"); + printf(" [ -w=<jobs warning level> ] default: %i\n", opt_job_warning); + printf(" [ -c=<jobs critical level> ] default: %i\n", opt_job_critical); + printf(" [ -W=<worker warning level> ] default: %i\n", opt_worker_warning); + printf(" [ -C=<worker critical level> ] default: %i\n", opt_worker_critical); printf(" [ -q=<queue> ]\n"); printf("\n"); printf("\n"); @@ -355,3 +356,10 @@ printf("%s OK - %s\n", PLUGIN_NAME, result ); return( STATE_OK ); } + + +/* core log wrapper */ +void write_core_log(char *data) { + printf("core logger is not available for tools: %s", data); + return; +} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/tools/gearman_top.c ^ |
@@ -42,6 +42,7 @@ mod_gm_opt = malloc(sizeof(mod_gm_opt_t)); set_default_options(mod_gm_opt); + /* * and parse command line */ @@ -66,6 +67,7 @@ } } mod_gm_opt->debug_level = opt_verbose; + mod_gm_opt->logmode = GM_LOG_MODE_TOOLS; if(server_list_num == 0) server_list[server_list_num++] = "localhost"; server_list[server_list_num] = NULL; @@ -211,3 +213,10 @@ free_mod_gm_status_server(stats); return; } + + +/* core log wrapper */ +void write_core_log(char *data) { + printf("core logger is not available for tools: %s", data); + return; +} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/tools/send_gearman.c ^ |
@@ -24,7 +24,6 @@ /* include header */ #include "send_gearman.h" #include "utils.h" -#include "worker_logger.h" #include "gearman.h" gearman_client_st client; @@ -42,6 +41,10 @@ exit( EXIT_FAILURE ); } + /* set logging */ + mod_gm_opt->debug_level = GM_LOG_INFO; + mod_gm_opt->logmode = GM_LOG_MODE_TOOLS; + /* init crypto functions */ if(mod_gm_opt->encryption == GM_ENABLED) { mod_gm_crypt_init(mod_gm_opt->crypt_key); @@ -125,6 +128,8 @@ if ( mod_gm_opt->result_queue == NULL ) mod_gm_opt->result_queue = GM_DEFAULT_RESULT_QUEUE; + mod_gm_opt->logmode = GM_LOG_MODE_STDOUT; + return(GM_OK); } @@ -280,3 +285,10 @@ printf("\n"); exit( STATE_UNKNOWN ); } + + +/* core log wrapper */ +void write_core_log(char *data) { + printf("core logger is not available for tools: %s", data); + return; +} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/tools/send_multi.c ^ |
@@ -25,7 +25,6 @@ /* include header */ #include "send_multi.h" #include "utils.h" -#include "worker_logger.h" #include "gearman.h" gearman_client_st client; @@ -43,6 +42,10 @@ exit( 3 ); } + /* set logging */ + mod_gm_opt->debug_level = GM_LOG_INFO; + mod_gm_opt->logmode = GM_LOG_MODE_TOOLS; + /* init crypto functions */ if(mod_gm_opt->encryption == GM_ENABLED) { mod_gm_crypt_init(mod_gm_opt->crypt_key); @@ -463,3 +466,10 @@ } return string; } + + +/* core log wrapper */ +void write_core_log(char *data) { + printf("core logger is not available for tools: %s", data); + return; +} | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/worker/worker.c ^ |
@@ -24,7 +24,6 @@ /* include header */ #include "worker.h" #include "utils.h" -#include "worker_logger.h" #include "worker_client.h" int current_number_of_workers = 0; @@ -95,6 +94,11 @@ gm_log( GM_LOG_INFO, "mod_gearman worker started with pid %d\n", getpid()); } + /* print some version information */ + gm_log( GM_LOG_DEBUG, "Version %s\n", GM_VERSION ); + gm_log( GM_LOG_DEBUG, "running on libgearman %s\n", gearman_version() ); + + /* set signal handlers for a clean exit */ signal(SIGINT, clean_exit); signal(SIGTERM,clean_exit); @@ -342,7 +346,10 @@ } /* open new logfile */ - if(mod_gm_opt->logfile && mod_gm_opt->debug_level < GM_LOG_STDOUT) { + if ( mod_gm_new_opt->logmode == GM_LOG_MODE_AUTO && mod_gm_new_opt->logfile ) { + mod_gm_opt->logmode = GM_LOG_MODE_FILE; + } + if(mod_gm_new_opt->logmode == GM_LOG_MODE_FILE && mod_gm_opt->logfile && mod_gm_opt->debug_level < GM_LOG_STDOUT) { mod_gm_opt->logfile_fp = fopen(mod_gm_opt->logfile, "a+"); if(mod_gm_opt->logfile_fp == NULL) { perror(mod_gm_opt->logfile); @@ -750,6 +757,12 @@ } +/* core log wrapper */ +void write_core_log(char *data) { + printf("core logger is not available for worker: %s", data); + return; +} + /* print version */ void print_version() { printf("mod_gearman_worker: version %s running on libgearman %s\n", GM_VERSION, gearman_version()); | ||
[+] | Changed | mod_gearman-1.0.4.tar.bz2/worker/worker_client.c ^ |
@@ -26,7 +26,6 @@ #include "common.h" #include "worker_client.h" #include "utils.h" -#include "worker_logger.h" #include "gearman.h" char temp_buffer1[GM_BUFFERSIZE]; | ||
Deleted | mod_gearman-1.0.tar.bz2 ^ |