Nagios log file is not rotating in daily basis

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.
breddydu
Posts: 9
Joined: Thu Dec 12, 2019 2:34 am

Nagios log file is not rotating in daily basis

Post by breddydu »

Hello,

We can see that the nagios.log is not rotationg dailuy basis, could you please help us.
Nagios version : 4.1.1
Please find the nagios.cfg log retention details .

# LOG ROTATION METHOD
# This is the log rotation method that Nagios should use to rotate
# the main log file. Values are as follows..
# n = None - don't rotate the log
# h = Hourly rotation (top of the hour)
# d = Daily rotation (midnight every day)
# w = Weekly rotation (midnight on Saturday evening)
# m = Monthly rotation (midnight last day of month)

log_rotation_method=d



# 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
#log_archive_path=/var/log/nagios/archives

We could see two below process running continuously .
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg.

22223 nagios 20 0 32000 8992 1168 S 1.3 0.2 0:07.44 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
1844 nagios 20 0 32000 7882 1168 S 2.3 0.2 200:0.44 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

Please help us in resolving this, let us know for more info .
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios log file is not rotating in daily basis

Post by lmiltchev »

Run the following command and show the output:

Code: Select all

ls -lad /usr/local /usr/local/nagios /usr/local/nagios/var /usr/local/nagios/var/archives/
Also, post the entire nagios.cfg file on the forum.
Be sure to check out our Knowledgebase for helpful articles and solutions!
breddydu
Posts: 9
Joined: Thu Dec 12, 2019 2:34 am

Re: Nagios log file is not rotating in daily basis

Post by breddydu »

Hello ,

Thanks for your reply.

Below is the output of the command you have given .

[root@HT-Nagios-Tools1 var]# ls -lad /usr/local /usr/local/nagios /usr/local/nagios/var /usr/local/nagios/var/archives/
drwxr-xr-x. 15 root root 4096 Dec 8 2016 /usr/local
drwxr-xr-x. 12 root root 4096 Sep 26 16:13 /usr/local/nagios
drwxrwxr-x 4 nagios nagios 4096 Dec 13 10:40 /usr/local/nagios/var
drwxr-xr-x 2 nagios nagios 49152 Dec 12 23:59 /usr/local/nagios/var/archives/
[root@HT-Nagios-Tools1 var]#
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios log file is not rotating in daily basis

Post by lmiltchev »

The permissions look fine. On my "stock" Nagios Core machine though, the archives folder is group-writable. I am not sure if this is going to make a difference, but you could run:

Code: Select all

chmod g+w /usr/local/nagios/var/archives/
to see if this is going to help.

Did you forget to upload the nagios.cfg file?
Be sure to check out our Knowledgebase for helpful articles and solutions!
breddydu
Posts: 9
Joined: Thu Dec 12, 2019 2:34 am

Re: Nagios log file is not rotating in daily basis

Post by breddydu »

Hello,

Thanks for your reply.

Permissions are same earlier as well when it was working fine, Suddenly it stopped working .

Could you please let us know the solution for this .
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios log file is not rotating in daily basis

Post by lmiltchev »

Can you upload your main conifg file on the forum (nagios.cfg)?
Be sure to check out our Knowledgebase for helpful articles and solutions!
breddydu
Posts: 9
Joined: Thu Dec 12, 2019 2:34 am

Re: Nagios log file is not rotating in daily basis

Post by breddydu »

Hello Team,

Please refer the attached nagios cfg file.

Nagios process is running in thre numbers.

19531 nagios 20 0 31988 8840 996 R 100.0 0.2 4765:34 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
31667 nagios 20 0 36236 9196 1288 R 100.0 0.2 3349:04 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
24165 nagios 20 0 32048 116 16 R 100.0 0.0 6195:41 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
12251 nagios 20 0 32020 9100 1180 R 93.9 0.2 503:12.77 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

Also untill we restart the nagios service , Log file is not rotating ever day.
Attachments
nagioscfg.txt
(46.52 KiB) Downloaded 162 times
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios log file is not rotating in daily basis

Post by lmiltchev »

What is the command that you ran to obtain the output below?
19531 nagios 20 0 31988 8840 996 R 100.0 0.2 4765:34 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
31667 nagios 20 0 36236 9196 1288 R 100.0 0.2 3349:04 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
24165 nagios 20 0 32048 116 16 R 100.0 0.0 6195:41 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
12251 nagios 20 0 32020 9100 1180 R 93.9 0.2 503:12.77 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
Do you have multiple instances of nagios running on this machine?

What is the output of the command below?

Code: Select all

ps -ef | grep nagios.cfg | grep -v grep
Are you using check_mk? What is in the "check_mk.d" directory?
# added by setup.sh of check_mk
cfg_dir=/usr/local/nagios/etc/check_mk.d
Be sure to check out our Knowledgebase for helpful articles and solutions!
breddydu
Posts: 9
Joined: Thu Dec 12, 2019 2:34 am

Re: Nagios log file is not rotating in daily basis

Post by breddydu »

Hello,

Thank you for your reply.

Yes we have multiple instance running on the server.

Output of the command given by you.

[root@HT-Nagios-Tools1 var]# ps -ef | grep nagios.cfg | grep -v grep
nagios 3610 1 0 07:57 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 3618 3610 0 07:57 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 4458 1 31 Dec17 ? 06:21:23 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 4466 4458 0 Dec17 ? 00:00:03 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 12251 1 69 Dec16 ? 1-04:17:46 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 12259 12251 0 Dec16 ? 00:00:04 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19531 1 85 Dec13 ? 4-03:18:41 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19539 19531 0 Dec13 ? 00:00:08 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 24165 1 86 Dec12 ? 5-03:08:39 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 24173 24165 0 Dec12 ? 00:00:26 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 31667 1 77 Dec14 ? 3-03:40:50 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 31675 31667 0 Dec14 ? 00:00:08 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
[root@HT-Nagios-Tools1 var]#


Yes we are using check_mk
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios log file is not rotating in daily basis

Post by lmiltchev »

You should not have multiple instances of nagios running on the same machine... Normally, the output should look like something like this:
ps -ef | grep nagios.cfg | grep -v grep
nagios 45828 1 0 Dec17 ? 00:03:23 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 45842 45828 0 Dec17 ? 00:00:03 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
You will need to run:

Code: Select all

service nagios stop
killall -9 nagios
service nagios start
and check again how many nagios processes are running.

Also, you can temporarily stop using check_mk to see if this is going to fix the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked