Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gucks dir mal an... #6

Merged
3 commits merged into from
Nov 6, 2010
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
This file documents the revision history for mod_gearman.

0.8
- added send_multi
- fixed checks with popen/exec

0.7 Wed Nov 3 14:01:23 CET 2010
Expand Down
16 changes: 11 additions & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mod_gearman_so_SOURCES = $(common_SOURCES) \

bin_PROGRAMS = mod_gearman_worker \
send_gearman \
send_multi \
check_gearman \
gearman_top

Expand All @@ -44,6 +45,10 @@ 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
Expand Down Expand Up @@ -146,13 +151,14 @@ install-data-local: install-local-state-dir
@echo "################################################################"
@echo ""
@echo " Installation completed:"
@echo " neb module: $(DESTDIR)$(pkglibdir)/mod_gearman.o"
@echo " neb module: $(DESTDIR)$(pkglibdir)/mod_gearman.o"
@echo ""
@echo " worker: $(DESTDIR)$(bindir)/mod_gearman_worker"
@echo " init script: $(DESTDIR)$(initrddir)/mod_gearman_worker"
@echo " worker: $(DESTDIR)$(bindir)/mod_gearman_worker"
@echo " init script: $(DESTDIR)$(initrddir)/mod_gearman_worker"
@echo ""
@echo " check bin: $(DESTDIR)$(bindir)/check_gearman"
@echo " send bin: $(DESTDIR)$(bindir)/send_gearman"
@echo " check bin: $(DESTDIR)$(bindir)/check_gearman"
@echo " send bin: $(DESTDIR)$(bindir)/send_gearman"
@echo " send multi bin: $(DESTDIR)$(bindir)/send_multi"
@echo ""
@echo "just add the broker line to your nagios.cfg:"
@echo "broker_module=$(DESTDIR)$(pkglibdir)/mod_gearman.o config=$(DESTDIR)$(sysconfdir)/mod_gearman.conf"
Expand Down
25 changes: 24 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ NEB Module
A sample broker in your nagios.cfg could look like:

======
broker=/usr/local/share/nagios/mod_gearman.o keyfile=/usr/local/share/nagios/secret.txt server=localhost eventhandler=yes hosts=yes services=yes
broker_module=/usr/local/share/nagios/mod_gearman.o keyfile=/usr/local/share/nagios/secret.txt server=localhost eventhandler=yes hosts=yes services=yes
======

See the following list for a detailed explaination of available
Expand Down Expand Up @@ -476,6 +476,29 @@ check would do.



How to Submit check_multi Results
---------------------------------

check_multi is a plugin which executes multiple child checks.
See more details about the feed_passive mode at:
http://www.my-plugin.de/wiki/projects/check_multi/feed_passive

You can pass such child checks to Nagios via the mod_gearman
neb module:

.......
%> check_multi -f multi.cmd -r 256 | ./send_multi --server=<job server> --encryption=no --host="<hostname>" --service="<service>"
.......

If you want to use only check_multi and no other workers, you can
achieve this with the following neb module settings:

broker_module=/usr/local/share/nagios/mod_gearman.o server=localhost encryption=no eventhandler=no hosts=no services=no hostgroups=does_not_exist

Note: encryption is not necessary if you both run the check_multi checks
and the nagios check_results queue on the same server.


What About Notifications
------------------------
Notifications are very difficult to distribute. And i think its not
Expand Down
26 changes: 26 additions & 0 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,32 @@ <h2 id="_how_to_submit_passive_checks">How to Submit Passive Checks</h2>
<pre><tt> %&gt; ./send_gearman --server=&lt;job server&gt; --encryption=no --host="&lt;hostname&gt;" --service="&lt;service&gt;" --message="message"</tt></pre>
</div></div>
</div>
<h2 id="_how_to_submit_check_multi_results">How to Submit check_multi Results</h2>
<div class="sectionbody">
<div class="para"><p>
check_multi is a plugin which executes multiple child checks.
See more details about the feed_passive mode at:
<a href="http://www.my-plugin.de/wiki/projects/check_multi/feed_passive">http://www.my-plugin.de/wiki/projects/check_multi/feed_passive</a>
You can pass such child checks to Nagios via the mod_gearman
neb module:
</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>
%&gt; check_multi -f multi.cmd -r 256 | ./send_multi --server=&lt;job server&gt; --encryption=no --host="&lt;hostname&gt;" --service="&lt;service&gt;"
</tt></pre>
</div></div>
<div class="para"><p>
If you want to use only check_multi and no other workers, you can achieve this with the following neb module settings:
<div class="literalblock">
<div class="content">
<pre><tt>
broker_module=/usr/local/share/nagios/mod_gearman.o server=localhost encryption=no eventhandler=no hosts=no services=no hostgroups=does_not_exist
</tt></pre>
</div></div>
<div class="para"><p>
Note: encryption is not necessary if you both run the check_multi checks on one host.
</p></div>
<h2 id="_what_about_notifications">What About Notifications</h2>
<div class="sectionbody">
<div class="paragraph"><p>Notifications are very difficult to distribute. And i think its not
Expand Down
6 changes: 6 additions & 0 deletions common/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,12 @@ int parse_args_line(mod_gm_opt_t *opt, char * arg, int recursion_level) {
}

/* timeout */
else if ( !strcmp( key, "timeout" ) ) {
opt->timeout = atoi( value );
if(opt->timeout < 0) { opt->timeout = 10; }
}

/* job_timeout */
else if ( !strcmp( key, "job_timeout" ) ) {
opt->job_timeout = atoi( value );
if(opt->job_timeout < 1) { opt->job_timeout = 1; }
Expand Down
52 changes: 52 additions & 0 deletions include/send_multi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/******************************************************************************
*
* mod_gearman - distribute checks with gearman
*
* Copyright (c) 2010 Sven Nierlein - sven.nierlein@consol.de
* Copyright (c) 2010 Matthias Flacke - matthias.flacke@gmx.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/>.
*
*****************************************************************************/

#define MOD_GM_SEND_MULTI

#define _GNU_SOURCE
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <libgearman/gearman.h>
#include "common.h"

mod_gm_opt_t *mod_gm_opt;

int main (int argc, char **argv);
int parse_arguments(int argc, char **argv);
void print_usage(void);
void print_version(void);
int verify_options(mod_gm_opt_t *opt);
int send_result(void);
void alarm_sighandler(int sig);
int read_multi_stream(FILE *stream);
int read_child_check(char *bufstart, char *bufend);
char *read_multi_attribute(char *bufstart, char *bufend, char *attname);
char *decode_xml(char *);


Loading