This support forum board is for support questions relating to
Nagios XI , our flagship commercial network monitoring solution.
morabanc
Posts: 199 Joined: Tue Jul 10, 2012 8:14 am
Post
by morabanc » Tue Jan 08, 2013 6:53 am
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
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Tue Jan 08, 2013 9:42 am
yo are likely seeing parent and child processes.
Nagios will fork itself to execute the checks...
morabanc
Posts: 199 Joined: Tue Jul 10, 2012 8:14 am
Post
by morabanc » Tue Jan 08, 2013 11:42 am
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
mguthrie
Posts: 4380 Joined: Mon Jun 14, 2010 10:21 am
Post
by mguthrie » Tue Jan 08, 2013 11:50 am
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.
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Tue Jan 08, 2013 11:53 am
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
morabanc
Posts: 199 Joined: Tue Jul 10, 2012 8:14 am
Post
by morabanc » Thu Jan 10, 2013 6:14 am
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 !!!!
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:
Post
by scottwilkerson » Thu Jan 10, 2013 8:02 am
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.
morabanc
Posts: 199 Joined: Tue Jul 10, 2012 8:14 am
Post
by morabanc » Thu Jan 10, 2013 8:08 am
Yes, I know this is the solution of the problem, but what's the solution to avoid this problem ??
mguthrie
Posts: 4380 Joined: Mon Jun 14, 2010 10:21 am
Post
by mguthrie » Thu Jan 10, 2013 10:39 am
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.