[Pkg-nagios-changes] [SCM] Debian packaging for mod gearman. branch, upstream, updated. e9a5a6997d9dd8b31b433b5bcbad495448db0131
Sven Nierlein
sven at nierlein.org
Thu Apr 7 08:06:32 UTC 2011
The following commit has been merged in the upstream branch:
commit 9cd2d750d3e56e0a2beffa481f9e347199cd8bca
Author: Sven Nierlein <sven at nierlein.org>
Date: Fri Mar 11 12:05:09 2011 +0100
added new option do_hostchecks to completly disable hostchecks
diff --git a/Changes b/Changes
index 98bfa3e..13c8b09 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
This file documents the revision history for mod_gearman.
1.0.2 Fri Mar 11 10:30:21 CET 2011
+ - added new option do_hostchecks to completly disable hostchecks
- fixed reading keyfiles
1.0.1 Sat Mar 5 15:47:22 CET 2011
diff --git a/README.asciidoc b/README.asciidoc
index d8f47f0..7908451 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -384,6 +384,20 @@ just passed through.
====
+do_hostchecks::
+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: `yes`
++
+====
+ do_hostchecks=yes
+====
+
+
result_workers::
Number of result worker threads. Usually one is enough. You may increase the
value if your result queue is not processed fast enough.
diff --git a/common/utils.c b/common/utils.c
index 42a8d9e..a6966a0 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -205,6 +205,7 @@ int set_default_options(mod_gm_opt_t *opt) {
opt->debug_level = GM_LOG_INFO;
opt->perfdata = GM_DISABLED;
opt->perfdata_mode = GM_PERFDATA_OVERWRITE;
+ opt->do_hostchecks = GM_ENABLED;
opt->hosts = GM_DISABLED;
opt->services = GM_DISABLED;
opt->events = GM_DISABLED;
@@ -352,6 +353,12 @@ int parse_args_line(mod_gm_opt_t *opt, char * arg, int recursion_level) {
return(GM_OK);
}
+ /* do_hostchecks */
+ else if ( !strcmp( key, "do_hostchecks" ) ) {
+ opt->do_hostchecks = parse_yes_or_no(value, GM_ENABLED);
+ return(GM_OK);
+ }
+
/* active */
else if ( !strcmp( key, "active" ) ) {
opt->active = parse_yes_or_no(value, GM_ENABLED);
@@ -673,6 +680,7 @@ void dumpconfig(mod_gm_opt_t *opt, int mode) {
if(mode == GM_NEB_MODE) {
gm_log( GM_LOG_DEBUG, "debug result: %s\n", opt->debug_result == GM_ENABLED ? "yes" : "no");
gm_log( GM_LOG_DEBUG, "result_worker: %d\n", opt->result_workers);
+ gm_log( GM_LOG_DEBUG, "do_hostchecks: %s\n", opt->do_hostchecks == GM_ENABLED ? "yes" : "no");
}
if(mode == GM_NEB_MODE || mode == GM_SEND_GEARMAN_MODE) {
gm_log( GM_LOG_DEBUG, "result_queue: %s\n", opt->result_queue);
diff --git a/docs/README.html b/docs/README.html
index 55cc10a..543c045 100644
--- a/docs/README.html
+++ b/docs/README.html
@@ -1011,8 +1011,9 @@ keyfile
</dt>
<dd>
<p>
-The shared password will be read from this file. Use either key or keyfile.
-Only the first 32 characters will be used.
+The shared password will be read from this file. Use either key or keyfile.
+Only the first 32 characters from the first line will be used.
+Whitespace to the right will be trimmed.
</p>
<div class="exampleblock">
<div class="exampleblock-content">
@@ -1059,6 +1060,27 @@ just passed through.
</div></div>
</dd>
<dt class="hdlist1">
+do_hostchecks
+</dt>
+<dd>
+<p>
+Set this to <em>no</em> 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 <em>hosts</em> or the <em>hostgroups</em> option.
+Default: <tt>yes</tt>
+</p>
+<div class="exampleblock">
+<div class="exampleblock-content">
+<div class="literalblock">
+<div class="content">
+<pre><tt>do_hostchecks=yes</tt></pre>
+</div></div>
+</div></div>
+</dd>
+<dt class="hdlist1">
result_workers
</dt>
<dd>
@@ -1599,7 +1621,7 @@ The source is available at GitHub: <a href="http://github.com/sni/mod_gearman">h
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2011-03-11 08:40:50 CEST
+Last updated 2011-03-11 10:50:25 CEST
</div>
</div>
</body>
diff --git a/include/common.h b/include/common.h
index 097cbb3..bb1f580 100644
--- a/include/common.h
+++ b/include/common.h
@@ -162,6 +162,7 @@ typedef struct mod_gm_opt_struct {
int local_hostgroups_num; /**< number of elements in local_hostgroups_list */
char * local_servicegroups_list[GM_LISTSIZE]; /**< list of group which will not be distributed */
int local_servicegroups_num; /**< number of elements in local_servicegroups_list */
+ int do_hostchecks; /**< flag whether mod-gearman will process hostchecks at all */
/* worker */
char * identifier; /**< identifier for this worker */
char * pidfile; /**< path to a pidfile */
diff --git a/neb_module/mod_gearman.c b/neb_module/mod_gearman.c
index c5c81fc..53b9236 100644
--- a/neb_module/mod_gearman.c
+++ b/neb_module/mod_gearman.c
@@ -162,7 +162,7 @@ int nebmodule_init( int flags, char *args, nebmodule *handle ) {
static void register_neb_callbacks(void) {
/* only if we have hostgroups defined or general hosts enabled */
- if ( mod_gm_opt->hostgroups_num > 0 || mod_gm_opt->hosts == GM_ENABLED )
+ if ( mod_gm_opt->do_hostchecks == GM_ENABLED && ( mod_gm_opt->hostgroups_num > 0 || mod_gm_opt->hosts == GM_ENABLED ))
neb_register_callback( NEBCALLBACK_HOST_CHECK_DATA, gearman_module_handle, 0, handle_host_check );
/* only if we have groups defined or general services enabled */
@@ -194,7 +194,7 @@ int nebmodule_deinit( int flags, int reason ) {
neb_deregister_callback( NEBCALLBACK_TIMED_EVENT_DATA, gearman_module_handle );
/* only if we have hostgroups defined or general hosts enabled */
- if ( mod_gm_opt->hostgroups_num > 0 || mod_gm_opt->hosts == GM_ENABLED )
+ if ( mod_gm_opt->do_hostchecks == GM_ENABLED && ( mod_gm_opt->hostgroups_num > 0 || mod_gm_opt->hosts == GM_ENABLED ))
neb_deregister_callback( NEBCALLBACK_HOST_CHECK_DATA, gearman_module_handle );
/* only if we have groups defined or general services enabled */
@@ -406,6 +406,9 @@ static int handle_host_check( int event_type, void *data ) {
gm_log( GM_LOG_TRACE, "handle_host_check(%i)\n", event_type );
+ if ( mod_gm_opt->do_hostchecks != GM_ENABLED )
+ return NEB_OK;
+
hostdata = ( nebstruct_host_check_data * )data;
gm_log( GM_LOG_TRACE, "---------------\nhost Job -> %i, %i\n", event_type, hostdata->type );
--
Debian packaging for mod gearman.
More information about the Pkg-nagios-changes
mailing list