Cannot open log file '/usr/local/nagios/var/archives/nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Philix
Posts: 10
Joined: Mon Aug 12, 2019 11:23 am

Cannot open log file '/usr/local/nagios/var/archives/nagios

Post by Philix »

Hi everyone!

ON console, when I try to see Service Alert History for whatever service, I can see only events for present log file

When I try to browse on console view for previous log history, Notification, Eventlogs the following error appears!

Error: Cannot open log file '/usr/local/nagios/var/archives/nagios-08-29-2019-00.log' for reading!

root@debian:/usr/local/nagios/share# ls -l /usr/local/nagios/var
total 412
drwxrwxr-x 2 nagios nagios 4096 Aug 24 23:59 archives
-rwxr--r-- 1 nagios nagios 260319 Aug 29 15:40 nagios.log
-rw-r--r-- 1 nagios nagios 4 Aug 29 09:08 nrpe.pid
-rw-r--r-- 1 nagios nagios 36748 Aug 29 14:56 objects.cache
-rw------- 1 nagios nagios 48580 Aug 29 14:56 retention.dat
drwxrwsr-x 2 nagios nagcmd 4096 Aug 29 14:56 rw
drwxr-xr-x 3 root root 4096 Aug 23 14:04 spool
-rw-rw-r-- 1 nagios nagios 49676 Aug 29 15:50 status.dat
Any help really aprreciated
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Cannot open log file '/usr/local/nagios/var/archives/nag

Post by scottwilkerson »

What are the permissions of the files in this directory?

Code: Select all

ls -al /usr/local/nagios/var/archives/
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Philix
Posts: 10
Joined: Mon Aug 12, 2019 11:23 am

Re: Cannot open log file '/usr/local/nagios/var/archives/nag

Post by Philix »

scottwilkerson wrote:What are the permissions of the files in this directory?

Code: Select all

ls -al /usr/local/nagios/var/archives/
root@debian:~# ls -al /usr/local/nagios/var/archives/
total 16
drwxrwxr-x 2 nagios nagios 4096 Aug 24 23:59 .
drwxr-xr-x 5 nagios nagios 4096 Sep 3 08:08 ..
-rw-r--r-- 1 nagios nagios 2939 Aug 23 23:35 nagios-08-24-2019-00.log
-rw-r--r-- 1 nagios nagios 2642 Aug 24 23:35 nagios-08-25-2019-00.log
root@debian:~#
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Cannot open log file '/usr/local/nagios/var/archives/nag

Post by scottwilkerson »

That is weird, you don't have a nagios-08-29-2019-00.log file...

Did someone change the log rotation settings in the nagios.cfg? Has Nagios been running as I don't see any newer than nagios-08-25-2019-00.log
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Philix
Posts: 10
Joined: Mon Aug 12, 2019 11:23 am

Re: Cannot open log file '/usr/local/nagios/var/archives/nag

Post by Philix »

scottwilkerson wrote:That is weird, you don't have a nagios-08-29-2019-00.log file...

Did someone change the log rotation settings in the nagios.cfg? Has Nagios been running as I don't see any newer than nagios-08-25-2019-00.log
when i was not getting the desired results, i was playing with the nagios.cfg file and i am not sure whether i changed or not
##############################################################################
#
# NAGIOS.CFG - Sample Main Config File for Nagios 4.4.5
#
# Read the documentation for more information on this configuration
# file. I've provided some comments here, but things may not be so
# clear without further explanation.
#
#
##############################################################################


# LOG FILE
# This is the main log file where service and host events are logged
# for historical purposes. This should be the first option specified
# in the config file!!!

log_file=/usr/local/nagios/var/nagios.log



# LOG ARCHIVE PATH
# This is the directory where archived (rotated) log files should be
# placed (assuming you've chosen to do log rotation).

log_archive_path=/usr/local/nagios/var/archives



# LOGGING OPTIONS
# If you want messages logged to the syslog facility, as well as the
# Nagios log file set this option to 1. If not, set it to 0.

use_syslog=1
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Cannot open log file '/usr/local/nagios/var/archives/nag

Post by scottwilkerson »

what is the log_rotation_method set to?

Code: Select all

grep log_rotation_method /usr/local/nagios/etc/nagios.cfg
I would expect

Code: Select all

log_rotation_method=d
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Philix
Posts: 10
Joined: Mon Aug 12, 2019 11:23 am

Re: Cannot open log file '/usr/local/nagios/var/archives/nag

Post by Philix »

scottwilkerson wrote:what is the log_rotation_method set to?

Code: Select all

grep log_rotation_method /usr/local/nagios/etc/nagios.cfg
I would expect

Code: Select all

log_rotation_method=d
root@debian:~# grep log_rotation_method /usr/local/nagios/etc/nagios.cfg
log_rotation_method=d
root@debian:~#
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Cannot open log file '/usr/local/nagios/var/archives/nag

Post by scottwilkerson »

So this seems to have stopped working on 8/26/2019, does this correspond to an upgrade to 4.4.5?

what do you get with the following?

Code: Select all

grep ROT -4 /usr/local/nagios/var/nagios.log
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Philix
Posts: 10
Joined: Mon Aug 12, 2019 11:23 am

Re: Cannot open log file '/usr/local/nagios/var/archives/nag

Post by Philix »

scottwilkerson wrote:So this seems to have stopped working on 8/26/2019, does this correspond to an upgrade to 4.4.5?

what do you get with the following?

Code: Select all

grep ROT -4 /usr/local/nagios/var/nagios.log
it is a fresh installation

root@debian:~# grep ROT -4 /usr/local/nagios/var/nagios.log
[1566712800] LOG ROTATION: DAILY
[1566712800] LOG VERSION: 2.0
[1566712800] CURRENT HOST STATE: localhost;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.13 ms
[1566712800] CURRENT SERVICE STATE: localhost;Current Load;OK;HARD;1;OK - load average: 1.01, 0.82, 0.79
[1566712800] CURRENT SERVICE STATE: localhost;Current Users;OK;HARD;1;USERS OK - 1 users currently logged in
root@debian:~#
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Cannot open log file '/usr/local/nagios/var/archives/nag

Post by scottwilkerson »

That is strange, it doesn't even seem to have attempted the rotation since 8/25

what is the output of the following

Code: Select all

ps -ef|grep nagios.cfg
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked