# Nagios 1.2 not logging?

## Crymson

I did the Nagios 1.2 ebuild, and it works mostly.  I followed the instructions to set up cgi authorization, and set all the paths to the config files, etc, and it starts ok, but nothing is being added to the status.log or status.sav files.

The nagios.log file is filling up with lots of crap, mostly that it can't send mail (because sendmail isn't installed).

When I open the web Interface, I log in, and I get the following on Service Detail (etc)

There doesn't appear to be any service status information in the status log...

Make sure that Nagios is running and that you have specified the location of you status log correctly in the configuration files.

In the upper left, it says:  

Logged in as admin

Warning: Monitoring process may not be running!

Click here for more info.

- Notifications are disabled

- Service checks are disabled

So I click "HERE"  

Program Start Time:	12-31-1969 17:00:00

Total Running Time:	12726d 1h 26m 13s

Last External Command Check:	N/A

Last Log File Rotation:	N/A

Nagios PID	0

Notifications Enabled?	

  NO  

Service Checks Being Executed?	

  NO  

Passive Service Checks Being Accepted?	

  NO  

Event Handlers Enabled?	No

Obsessing Over Services?	No

Flap Detection Enabled?	No

Performance Data Being Processed?	No

On the bottom, it says:

Process Status Information

Process Status:	

  WARNING  

Check Command Output: 	Nagios problem: located 2 processes, status log updated 1099531573 seconds ago  

Any ideas on WTF is going on?  I ran nagios -v /etc/nagios.cfg and it gave me 4 warnings about some hosts not belonging to a group, which I ignored.  For the record, I modified some config files that came off a Debian system running nagios 1.2 which WORKED (except that it never found the nagios running process, so we moved it to gentoo, because it had an ebuild) yet it still doesn't work.  This time, it can find the process, but no status is being logged, nor do the hosts show up in the web interface.

Please say which config files I need to post, and I will, gladly.

Thanks.

----------

## rex123

Not sure, but maybe Debian keeps its log files in a different place to Gentoo. And maybe you have permissions problems.

Do something like this:

```
grep log_file /etc/nagios/*
```

Then look into /etc/init.d/nagios. You will see that it does something like this:

```
    touch /var/nagios/nagios.log /var/nagios/status.sav

    chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav

```

Clearly if the init command is creating a log file, the nagios config should be using the same one.

The number of seconds you are being shown is the number of seconds since the start of UNIX (try date +%s), which probably means that the log file it's looking for doesn't exist.

----------

## Crymson

I know the permissions are set correctly, I've gone over that a zillion times now.  What's interesting, is that /var/nagios contains *some* log files, but not all.  I thought maybe it was logging there, instead of /var/log/nagios, but when I touch the status.log in /var/nagios, and restart the daemon, the file is removed... go fig.

When I get back to the office, I'll take a look at grep output, and the init script.

As for the date, I think the reason it's giving me that, is because there's nothing IN the log file- at least, nothing in the format it's expecting.  As I said, there is stuff being added to the nagios.log file (in /var/log/nagios I might add) and if I run check_nagios on that file, I get

```
 nagios warning: Located x processes, status file last updated 5 seconds ago
```

I know the nagios.log doesn't contain the correct info, hence the warning, and since status.log is empty (and never having anything added to it) it gives me the really old date.

What I do find interesting though, is that after some time, status.sav ends up with some data in it.  As I understand this, status.sav is filled with the data from status.log when the daemon (re)starts so that it doesn't have to check everything again right off the bat.  Yet, if status.log is empty, where is it logging?  I tried doing a locate status.log and came up with ONLY the file in /var/log/nagios.

Do you think the answer might be in the init script, or grep output?  Weird, and frustrating.

Thanks again for the reply.  I'll post an update in a few hours when I get to work.  If you or anyone has any other ideas, please post!!

----------

## Crymson

Ok, I fixed the init script to point to the right log directory.  That's all done and good.

Yet, Nagios is STILL not creating the status.log file.  I think it's the lack of that file that is causing all my problems.  Nagios is supposed to be sending stuff to this status.log file, but I don't know WHICH config file governs that.

nagios.log contains stuff about being unable to send messages to the admin, (because sendmail isn't installed).  Is there a way to turn host checking back on?  It should be able to ping and such, I've run the script from the command line, and it works just fine.

Ideas??  Thanks!!

----------

## rex123

Sorry, out of ideas. If the user nagios has permission to create files in /var/log/nagios, which is where your status.log should be, then you should be OK.

The init script removes status.log 

```

stop() {

        ebegin "Stopping nagios"

        start-stop-daemon -o --quiet --stop --pidfile /var/nagios/nagios.lock

        rm -f /var/nagios/status.log /var/nagios/nagios.tmp /var/nagios/nagios.lock /var/nagios/rw/nagios.cmd

        eend $?

}

```

when nagios is stopped, which explains why it disappears after you create it manually. But again, you should probably fix the paths in the init script to match your (Debian) ones, or maybe make a symlink from /var/nagios to /var/log/nagios (that might solve all your problems!)

----------

## Crymson

I saw that it deletes the log file for whatever strange reason.

Anyway, as it turns out, the permissions weren't set on /var/log/nagios - which was the root of all my problems.  Damn annoying if you ask me, since I was busy checking permissions on every OTHER directory and file.

*sigh*

Thanks again all for your help in narrowing down my stupid and ignorant mistake.  The other suggestions were very helpful!!

----------

## ewtrowbr

when you get the error message "Warning: Monitoring process may not be running! " in nagios, the application is definitely not running. 

We have a gentoo nagios implementation monitoring 250 services across 60 servers and it is running great. It can and will work. 

erich

----------

## Crymson

You misunderstand - on the old Debian machine, things WERE working just fine.  In fact, I can start the service, and it comes right up, but the check_nagios plugin isn't returning the proper value for some reason.  In fact, a ps ax shows nagios as a running process.

It was this problem that caused my boss to decide to use a "clean" install of nagios, and told me I could put it on whatever platform I wanted.  So I went Gentoo.  Anyway, it's mostly up, just a few minor things to work out now.

----------

## rex123

 *Crymson wrote:*   

> ...the permissions weren't set on ...
> 
> *sigh*
> 
> 

 

I've lost count of the number of times an annoying problem turns out to be permissions-related, even when I've checked all the permissions already. On Windows it's so easy - you just give full permissions to the world, and everyone's happy :)

----------

