Page 1 of 1

2 Nagios processes found

Posted: Wed Mar 23, 2016 2:38 am
by WillemDH
Hello,

Since I started scheduling a Reactor chain which uses the REST API to apply configuration, I've seen multiple times hat the Nagios process seems to bhe forked all of a sudden. This has happened at least three times. I know the solution is to execute 'killall -9 nagios && service nagios restart', but I was hoping for a more robust solution stead of a workaround. I've seen it happen with a 'normal' manual apply configuration, but I can't help think that the apply configuration done by the Reactor chain has a higher rate of failure.

The config of the chain is a n action 'submit an http request',
type POST
options apikey=%nagiosxiapikey%&pretty=1
URL https://%nagiosxiserver%/nagiosxi/api/v1/system/applyconfig

And is executed two times a day at 07:00 and 19:00 as a workaround for the memory leak caused by Mod Gearman.
It is also used as part of several superchains.

Any tip to prevent the multiple Nagios instances issue from happening is welcome.

Grtz

Willem

Re: 2 Nagios processes found

Posted: Wed Mar 23, 2016 1:48 pm
by tmcdonald
I can tell you it's likely from the 15448 services you have on that machine (according to your signature). The nagios process can take some time to stop/start during an Apply when you have that many, so one possible solution is to modify the init script for nagios. In /etc/init.d/nagios you can change this line:

for i in 1 2 3 4 5 6 7 8 9 10 ; do

to the more compact and inclusive:

for i in {1 .. 20} ; do

This will give it twice as long to stop before it tries to restart itself again. Try that and see if the issue persists.

Re: 2 Nagios processes found

Posted: Wed Mar 23, 2016 1:50 pm
by WillemDH
Thanks Trevor, I will try that solution. It might take some before I know if it really helps, so please leave this thread open for some time. I will not respond to your answer.. ;)

Re: 2 Nagios processes found

Posted: Wed Mar 23, 2016 1:55 pm
by tmcdonald
WillemDH wrote:I will not respond to your answer.. ;)
You have no idea how much that means to us :)

But even still, I expect @eloyd to hop in at any moment...

Re: 2 Nagios processes found

Posted: Thu Apr 14, 2016 3:16 am
by WillemDH
Trevor,

I'll be damned your solution worked! :) I haven't seen any duplicate Nagios processes for a few weeks now. Close this up please.

Grtz

Willem

Re: 2 Nagios processes found

Posted: Thu Apr 14, 2016 9:26 am
by tmcdonald
People are always so surprised when I fix things D:

Glad it's working though, I'll lock this up!