Page 1 of 1
Multiple instances of Nagios
Posted: Tue Jan 08, 2013 6:53 am
by morabanc
Hi !!!
We've a problem, when we restart nagios after a minutes if we put:
- # ps aux | grep nagios
We can appreciate some instances of nagios, and this makes strange behavior
- /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
Why it appear some instances and not only 1 ??? We run ndoutils (v1.4) and nagios
Thanks and happy new year

Re: Multiple instances of Nagios
Posted: Tue Jan 08, 2013 9:42 am
by scottwilkerson
yo are likely seeing parent and child processes.
Nagios will fork itself to execute the checks...
Re: Multiple instances of Nagios
Posted: Tue Jan 08, 2013 11:42 am
by morabanc
So, it's normal to fork processes ??
Because sometimes when the nagios proces forks, the controls of nagios doesn't execute or change the state and after a moment change another time

Re: Multiple instances of Nagios
Posted: Tue Jan 08, 2013 11:50 am
by mguthrie
So, it's normal to fork processes ??
Yes, this is how all parent->child processes work in Unix. Nagios forks itself to run the check, event handler, or notification command, and when it's complete the child process is closed off and control is returned to the parent.
Because sometimes when the nagios proces forks, the controls of nagios doesn't execute or change the state and after a moment change another time
I'm not sure I understand what you mean. Can you explain a bit more or give an example of what you see happening on your system? There may be an issue on your system, but I don't think it has anything to do with the forks unless you somehow have
multiple parent processes.
Re: Multiple instances of Nagios
Posted: Tue Jan 08, 2013 11:53 am
by scottwilkerson
morabanc wrote:So, it's normal to fork processes ??
yes, but if you run a
you should see that that all are children of a parent.
nagios 16122 1 0 Jan07 ? 00:05:36 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 32122 16122 0 Jan07 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 32123 16122 0 Jan07 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 32124 16122 0 Jan07 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
Re: Multiple instances of Nagios
Posted: Thu Jan 10, 2013 6:14 am
by morabanc
Now i execute the command "ps -ef | grep nagios" and this is the result
nagios 6539 1 0 Jan08 ? 00:00:00 ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 6854 6539 0 Jan08 ? 00:03:30 ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 6855 1 0 Jan08 ? 00:10:01 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 29176 1 0 12:00 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
As you can see there are 2 parent process of nagios.
After a moment i execute another time and then it appear OK
nagios 6539 1 0 Jan08 ? 00:00:00 ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 6854 6539 0 Jan08 ? 00:03:30 ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 6855 1 0 Jan08 ? 00:10:01 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 29894 6855 0 12:03 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
The last time I execute the command ....
nagios 6539 1 0 Jan08 ? 00:00:00 ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 6854 6539 0 Jan08 ? 00:03:30 ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 6855 1 0 Jan08 ? 00:10:03 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
Until now Nagios kill the processes but the first time i execute I don't know why execute 2 independent processes.
I think this is a problem and when we feel anomal work in Nagios is because this last process doesn't kill it and always run 2 process and for that Nagios doesn't work OK. The solution is kill (kill -9 ...nagios...) every nagios process and start it another time (/etc/init.d/nagios start).
Thanks !!!!
Re: Multiple instances of Nagios
Posted: Thu Jan 10, 2013 8:02 am
by scottwilkerson
morabanc wrote:nagios 6539 1 0 Jan08 ? 00:00:00 ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 6854 6539 0 Jan08 ? 00:03:30 ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
nagios 6855 1 0 Jan08 ? 00:10:01 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 29894 6855 0 12:03 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
you are correct, this isn't normal
morabanc wrote:The solution is kill (kill -9 ...nagios...) every nagios process and start it another time (/etc/init.d/nagios start).
This is what I would have recommended.
Re: Multiple instances of Nagios
Posted: Thu Jan 10, 2013 8:08 am
by morabanc
Yes, I know this is the solution of the problem, but what's the solution to avoid this problem ??
Re: Multiple instances of Nagios
Posted: Thu Jan 10, 2013 10:39 am
by mguthrie
What version of Nagios XI and Nagios Core are you on? This was a bug older versions of XI, but has since been resolved.
The only other thing that I know can reproduce this regularly is if you have a user outside of the nagios group try to restart the Nagios process.