[omd-users] mod_gearman Setup and Problems

Thomas Wollner tw at wollner-net.de
Wed May 25 14:48:26 CEST 2011


Hi,

as a temporary workaround you can try this:

go to /opt/omd/versions/default/share/check_mk/modules
edit check_mk_base.py

change the submit_check_result to not write to nagios command file but  
to send the results via send_gearman to your job-server. the  
encryption keys have to be the same on all machines:

like this:
<     #    open_command_pipe()
<     #    if nagios_command_pipe:
<     #        nagios_command_pipe.write("[%d]  
PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n" %
<     #                               (int(time.time()), host,  
servicedesc, result[0], result[1] + perftext)  )
<     #        # Important: Nagios needs the complete command in one  
single write() block!
<     #        # Python buffers and sends chunks of 4096 bytes, if we  
do not flush.
<     #        nagios_command_pipe.flush()
<       os.system("/omd/sites/YOURSITE/bin/send_gearman  
--config=/omd/sites/YOURSITE/etc/mod-gearman/worker.cfg --host='%s'  
--service='%s' --result_queue=check_results --message='%s'  
--returncode=%d" % ( host, servicedesc, result[1] + perftext,  
result[0]))
<


after that take care on:
- have main.mk in sync
- inventory on all systems (even worker only) should be the same
- cmk -O to re-precompile host-checks

I hope that one day Mathias will include the gearman compatibility for  
omd ....
I use this method since one week and it seems to work quite well.
Of course you have to take care on check_mk_base.py each time you update, etc

hope it helps,

Tom




Zitat von Sven Nierlein <sven at nierlein.de>:

> Hi Timo,
>
> Please do not use gearman in combination with check_mk. Check_mk   
> needs direct access to Nagios.
>
>  Sven
>
> On 25.05.2011, at 13:38, Timo Scheller   
> <t.scheller at its.uni-saarland.de> wrote:
>
>> Hi Sven,
>>
>> Am 25.05.2011 12:44, schrieb Sven Nierlein:
>>> On 5/25/11 12:18, Timo Scheller wrote:
>>>> failed to connect to localhost:4730 - Connection refused
>>>>
>>>> and I haven`t found a cmd option or argument....
>>>
>>> Have you tried "gearman_top -h" :-)
>> ok,ok, not to see the woods for the trees. My apology.
>>
>>> If it works with ip addresses, then something is wrong with either  
>>>  your hostname or your dns.
>> Nope, seems like it`s a problem with the config.
>>
>> If I have this one configured, as mentioned in the context,
>> ":port" if it should running on all interfaces:
>>
>> OMD-Site1: (Job-Server)
>> port.conf for gearmand-server (Job-Server)
>> # sets the addess of your gearman job server. Please
>> # change only by using the "omd config" command.
>> server=:4730
>>
>> I got the errors, as written in the mails before.
>>
>> If I did this one instead:
>> OMD-Site1: (Job-Server)
>> port.conf for gearmand-server (Job-Server)
>> # sets the addess of your gearman job server. Please
>> # change only by using the "omd config" command.
>> server=fqdn-gearmand-server:4730
>>
>> (and use gearman_top -H fqdn-gearmand-server ;-) )
>> It works. In the way, that jobs are really gone to the worker.
>> So thanks a lot for your help. I am now a lot further.
>>
>> But, here comes my next problem...
>>
>> This is what I now got in the OMD Site1 (Job-Server):
>> nagios.log:
>> [1306322665] SERVICE ALERT:   
>> fqdn-host1;Check_MK;CRITICAL;HARD;1;python: can't open file   
>> '/omd/sites/site1_048/var/check_mk/precompiled/fqdn-host1': [Errno   
>> 2] No such file or directory
>>
>> It`s for all hosts with Check_MK...
>>
>> And on OMD Site2 (Worker), I can see this
>> nagios.log:
>> [1306323070] Warning: Check result queue contained results for   
>> service 'Check_MK' on host 'fqdn-host1', but the service could not   
>> be found! Perhaps you forgot to define the service in your config   
>> files?
>>
>> Any ideas?
>>
>>
>> --
>> Viele Grüße
>>
>> Timo
>>
>> _______________________________________________
>> omd-users mailing list
>> omd-users at lists.mathias-kettner.de
>> http://lists.mathias-kettner.de/mailman/listinfo/omd-users
> _______________________________________________
> omd-users mailing list
> omd-users at lists.mathias-kettner.de
> http://lists.mathias-kettner.de/mailman/listinfo/omd-users
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the omd-users mailing list