[Check_mk (english)] Check_MK and mod_gearman (Patch)
michael.friedrich at univie.ac.at
Tue Jun 7 23:20:31 CEST 2011
On 03.06.2011 12:21, Daniel Tuecks wrote:
> Hello List,
> I tried to integrate a mod_gearman worker to check_mk. At our site we
> want to use mod_gearman to a create a distributed nagios setup.
> Check_MK of course is one of the key components. Unfortunately these
> two addons do not play well together. Check_MK writes its result
> directly to the nagios pipe. On remote (distributed gearman worker)
> systems, no pipe is available. So check_mk can be triggered but no
> results will come back to the central nagios server. Our first
> approach was to call send_gearman from check_my_base.py instead of
> writing to the pipe. A college of mine posted this two weeks ago at
> the german 'nagios-portal', I think.
> Yesterday, I had a day off and tried to integrate a 'gearman_worker'
> into check_mk. With the attached patch one can choose to write results
> to the nagios pipe (this is the default behaviour) or to write the
> output to a mod_gearman queue. This way check_mk can be used in a
> distributed setup with mod_gearman. The patch supports multiple
> gearman servers, dup servers and optional aes encrytion.
> With the attached patch, the following additional options can be
> placed into main.mk:
> ## Enable gearman output (this disabled check_mk's "write-to-pipe")
> # gearman_use = True
> ## Gearman server(s). Defaults to [ 'localhost:4730' ]. First
> available server is used.
> # gearman_server = [ 'gearman-server-a1:4730', 'gearman-server-a2:4730' ]
> ## Gearman DUP server. List of servers where duplicate results will be
> sent to. Defaults to "False". (Optional)
> # gearman_dup_server = [ ( ['dupserver-a1:4730', 'dupserver-a2:4730']
> ) , ( ['dupserver-b1:4730', 'dupserver-b2:4730'] ) ]
> ## Enable mod_gearman encryption. Defaults to "True".
> # gearman_encryption = True
> ## Gearman AES encryption key (gearman_secret OR gearman_secret_file
> must be defined)
> #gearman_secret = 'Y8aui7rq5a4NfijK3SgkXjcoMLLwn0gM'
> ## Gearman AES encryption key file (gearman_secret take precedence
> over gearman_secret_file)
> #gearman_secret_file = '/opt/omd/sites/devsite01/etc/mod-gearman/secret.key'
> ## Gearman queue - this is the queue 'gearman_server' sends its
> messages to. Defaults to 'check_results'
> #gearman_queue = 'check_results'
> ## Gearman DUP queue - this is the queue 'gearman_dup_server' sends
> its messages to. Defaults to gearman_queue
> #gearman_dup_queue = 'check_results_test'
> A minimal config could look like this:
> gearman_use = True
> gearman_server = [ 'gearman-server:4730' ]
> gearman_secret = 'Y8aui7rq5a4NfijK3SgkXjcoMLLwn0gM'
> (Remember to compile your config after changing gearman_* parameters in main.mk)
> Since I'm not a programmer, the patch is likely far from being perfect
> and definitely not fully tested. Actually this are my first steps in
> python, so this patch evolved around some python sample code I found
> :). Maybe a more talented coder takes this as an idea and/or supports
> me to bring this to production quality. At least some feedback would
> be nice.
> There are some glitches. For example: If the key is wrong you won't
> get any error message. It's the safest to use the
> 'gearman_secret_file' parameter and point to the same file that the
> gearman workers are using...
> Install Howto:
> You need the python gearman (http://pypi.python.org/pypi/gearman/) and
> pycrypto (https://www.dlitz.net/software/pycrypto/) and base64
> aptitude install gcc make libgmp3-dev python-setuptools python-dev
> tar -zxvf gearman-2.0.2.tar.gz
> tar -zxvf pycrypto-2.3.tar.gz
> easy_install gearman-2.0.2
> easy_install pycrypto-2.3
> cd /opt/omd/versions/0.48/share/check_mk/modules
> patch -p1< ~/check_mk-gearman.patch
> What this patch exactly does is:
> - adding some new gearman_* Variables to check_mk.py. These are the
> variables used in main.mk.
> - adding a helper to encode the check_mk output so that it fits into
> mod_gearman: gearman_strencode() (this needs pycrypto and base64)
> - Extends the functions submit_aggregated_results(),
> submit_check_mk_aggregation() and submit_check_result() to write to a
> gearman_queue or the nagios pipe (This needs gearman)
that looks really nice. i will try that on one of my gearman sites where
i currently can't use checkmk :-)
> checkmk-en mailing list
> checkmk-en at lists.mathias-kettner.de
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the checkmk-en