No lok file found

Hello,
I tried restarting the nagios service and it gave me lockfile not found

[root@cgl-fdum-1a etc]# service nagios status
No lock file found in /usr/local/nagios/var/nagios.lock

everything seems to be running properly with No errors or Warnings but the lock file seems to be missing. This is very weird.
Any help would be appreciated. Thanks

The fact that the nagios.lock file is missing usually just indicates that nagios isn’t running, as that file is created when Nagios starts and deleted when it stops, to prevent multiple instances of Nagios being run, methinks. This is why, if Nagios is stopped and you try to restart it with the startup script provided, it will give you that error, but it should then go on to start Nagios for you.

Now that Nagios is running, go to your nagios/var/ directory, where the lock file is by default installed, and confirm whether or not it is there. If it’s not, check your config files to see where Nagios is configured to create that lock file, and then go there. Let us know what you find out.

The nagios.cfg file indicates that the lock file is located in lock_file=/var/run/nagios.pid
I can see the nagios.pid file in that folder.
But when i try and restart the process it does not.

Nagios.pid? How did you install Nagios? Doesn’t seem you installed it from source, which is what I would recommend. By default, the lock file is set to /usr/local/nagios/var/nagios.lock. You got something funky going on there.

[quote=“himohit”]…
[root@cgl-fdum-1a etc]# service nagios status
No lock file found in /usr/local/nagios/var/nagios.lock
…[/quote]

This indicates that the init script, wherever it came from, thinks the lock file should be in /usr/local/nagios/var
and your last reply states that nagios.cfg thinks it’s in /var/run/ or something.
So, get your stuff together. Where is it supposed to be? Did you install the init scripts from source (which is what it looks like) but then your nagios.cfg looks like a rpm install. So, you tell us. Where/what/why is it broke? You have a mixed bag for an install by the looks of it.

I’d suggest to remove the rpm install, and start over with a source install.

[quote=“himohit”]…
[root@cgl-fdum-1a etc]# service nagios status
No lock file found in /usr/local/nagios/var/nagios.lock
…[/quote]

This indicates that the init script, wherever it came from, thinks the lock file should be in /usr/local/nagios/var
and your last reply states that nagios.cfg thinks it’s in /var/run/ or something.
So, get your stuff together. Where is it supposed to be? Did you install the init scripts from source (which is what it looks like) but then your nagios.cfg looks like a rpm install. So, you tell us. Where/what/why is it broke? You have a mixed bag for an install by the looks of it.

I’d suggest to remove the rpm install, and start over with a source install.

Thank you all for your advice. That is exactly what i thought when i saw this funky nagios box. someone else did this installation and left without updating anyone. But the funny thing is that nagios has been running and giving all the alerts and notifications perfectly. Anyways, i am getting all set to install this box again. Thanks once again :slight_smile:

I just loaded a system with Fedora Core 4 and used KYum to install Nagios and the plugins.

I get the exact same error “No lock file found in /var/run/nagios.pid” when trying to start Nagios and it DOES NOT START. Also, it does not create this file at all.

I’ve had this running on an earlier load so it is something with the rpm that Yum picked up. I’ve even removed Nagios and tried another download with the exact same results.

Hey rvicker, now that makes me think about my nagios box again. A similar thing is happening here, nagios does not seem to create a lock file and its still running giving all the alerts. I even tried to add some more services to an already existing system but the updates did not happen. Well, i may redo the box again if it doesnt work out.

You guys have nagios in 2 different places or something like that.
Try this:
slocate nagios | more
if you have a source install of nagios you might have:
/etc/rc.d/rc2.d/K01nagios
/etc/rc.d/rc0.d/K01nagios
/etc/rc.d/rc5.d/S99nagios
/etc/rc.d/rc6.d/K01nagios
/etc/rc.d/rc1.d/K01nagios
/etc/rc.d/rc4.d/S99nagios
/etc/rc.d/init.d/nagios ###Please VIEW this file and see what is in it. It should have prefix=/usr/local/nagios NagiosRun=${prefix}/var/nagios.lock for a source install
/etc/rc.d/rc3.d/S99nagios
/var/lock/subsys/nagios
/var/spool/cron/nagios
/var/spool/mail/nagios
/usr/local/nagios

And that is about it.
Edited Sun Jan 15 2006, 01:48AM ]

slocate shows nagios in:

/etc/
/usr/lib/
/usr/share/
/usr/bin/ ---- only a single file of nagios
/usr/log/

and the various yum http and doc directories.

/etc/rc.d/init.d/nagios has:

prefix=/usr
exec_prefix=/usr
NagiosBin=/usr/bin/nagios
NagiosCfg=/etc/nagios/nagios.cfg
NagiosLog=/var/log/nagios/status.log
NagiosTmp=/var/log/nagios/nagios.tmp
NagiosSav=/var/log/nagios/status.sav
NagiosCmd=/var/log/nagios/rw/nagios.cmd
NagiosVar=/var/log/nagios
NagiosRun=/var/run/nagios.pid
NagiosLckDir=/var/lock/subsys
NagiosLckFile=nagios
NagiosCGI=/usr/lib/nagios/cgi
Nagios=nagios

I will try having KYum uninstall nagios and make sure slocate can not find any nagios directories before reinstalling.

Just flushed everything that said nagios (even the yum cache)

Used KYum to install nagios, ncsa(?) and plugins from the Dries repositories.

Added nagios user to the apache group.

Tried to start nagios service and same error about no lock in the pid file.

And this is why we recommend to only install from source. Seriously, do yourself a favor, remove your current Nagios install, go download from one of the servers on the nagios website, and install it. That way, all of your nagios info is pretty much all under one directory: /usr/local/nagios. It’ll be a lot easier on you, trust me…and the most helpful people around here (such as luca and jakkedup), are more familiar with the recommended install.

This is my /etc/rc.d/init.d/nagios :

prefix=/usr/local/nagios
exec_prefix=${prefix}
NagiosBin=${exec_prefix}/bin/nagios
NagiosCfg=${prefix}/etc/nagios.cfg
NagiosLog=${prefix}/var/status.log
NagiosTmp=${prefix}/var/nagios.tmp
NagiosSav=${prefix}/var/status.sav
NagiosCmd=${prefix}/var/rw/nagios.cmd
NagiosVar=${prefix}/var
NagiosRun=${prefix}/var/nagios.lock
NagiosLckDir=/var/lock/subsys
NagiosLckFile=nagios
NagiosCGI=${exec_prefix}/sbin
Nagios=nagios

[quote=“rvicker”]
Added nagios user to the apache group.
.[/quote]

Where in the docs does it say to do that? Please provide a url.

[quote=“jakkedup”]

Yeah, while that [probably] didn’t do any harm, I doubt it did any good, either. Nagios does not execute Apache, so adding the Nagios user to that group won’t get you any closer to solving your problem.

That should have been apache as a member of the nagios group.

Per itgroundwork’s install README for Monarch. Which is what I have been using to configure nagios.

monarch.sourceforge.net/monarch/doc/README.TXT

I don’t know why that doc says to make apache user part of nagios group. But, according to your slocate, it looks like you have only the rpm install on your system. Make sure that nagios is not running, ps -ef|grep nagios. Then make sure that the file /var/run/nagios.pid and /var/lock/subsys/nagios does not exist.
Now that you have done that, make sure that there is nothing wrong with your config files by using the -v and then try to start nagios. If you get the same error, then this is not a lock file problem, but it’s due to nagios not starting for some reason. Bad config, syntax, selinux enabled??