Page 1 of 3

check_file_age error

Posted: Wed Sep 09, 2020 3:07 am
hi Team,

i am facing below error.

/usr/local/nagios/libexec/check_nrpe -H nagios-client ip -c check_file_age -a "-w 180 -c 300 -f /dir/dir/dir/logs/log.log"
FILE_AGE CRITICAL: File not found - /dir/dir/dir/logs/log.log
|

Re: check_file_age error

Posted: Wed Sep 09, 2020 4:17 pm
by scottwilkerson
Looks like the nagios user cannot see the file

On the server nagios-client ip

Can you show the output of the following

Code: Select all

su nagios
ls -l /dir/dir/dir/logs/log.log

Re: check_file_age error

Posted: Thu Sep 10, 2020 7:18 am
hi Team,

for nagios user there is no login shell, i am unable to switch to nagios user.

Please find the output below.
-rw-rw---- 1 appuser appuser 678K Sep 10 17:47 /dir/sir/dir/logs/access.log

Re: check_file_age error

Posted: Thu Sep 10, 2020 7:27 am
by scottwilkerson
[email protected] wrote:hi Team,

for nagios user there is no login shell, i am unable to switch to nagios user.

Please find the output below.
-rw-rw---- 1 appuser appuser 678K Sep 10 17:47 /dir/sir/dir/logs/access.log
Ok this means that the nagios user doesn't have access to see the file

Code: Select all

-rw-rw---- 1 appuser appuser 
You need to change the permissions somehow to allow access, either by adding access directly or adding the nagios user to the appuser group

Re: check_file_age error

Posted: Tue Sep 15, 2020 6:37 am
Hi team,
i have added nagios user to service account group.

i am facing below error wen i am checking from nagios server.
Log file permission :- -rwxrwx--- 1 appuser appuser 157K Sep 15 17:54 /dir/dir/dir/logs/


access.log

Output from Nagios Client.

sudo -H -u nagios /usr/lib/nagios/plugins/check_file_age /dir/dir/dir/logs/access.log
FILE_AGE OK: /dir/dir/dir/logs/access.log is 3 seconds old and 125304 bytes | age=3s;240;600 size=125304B;0;0;0

and

su - nagios -s /usr/lib/nagios/plugins/check_file_age /dir/dir/dir/logs/access.log


Output from Nagios Server

/usr/local/nagios/libexec/check_nrpe -H 192.168.105.93 -c check_file_age -a "-w 180 -c 300 -f /dir/dir/dir/logs/access.log"
FILE_AGE CRITICAL: File not found - /dir/dir/dir/logs/access.log
|



when i changed permission to 777 for it is working, but as per security reasons we can not change to 777 permission

Re: check_file_age error

Posted: Tue Sep 15, 2020 12:44 pm
by scottwilkerson
We are going to make sure the nagios user has access to look in the directories

Can you show the results of the following

Code: Select all

ls -ld /dir/dir/dir/logs
ls -ld /dir/dir/dir
ls -ld /dir/dir
ls -ld /dir
Also, can we verify that nrpe is running as the nagios user

Code: Select all

ps -ef|grep nrpe

Re: check_file_age error

Posted: Tue Sep 15, 2020 11:47 pm
Please find the directory details.

drwxrwx--- 2 appuser appuser /dir/dir/dir/logs
drwxrwx--- 5 appuser appuser /dir/dir/dir
drwxrwxrwx 25 appuser appuser /dir/dir
drwxrwxrwx 12 appuser appuser /dir

NRPE is running in xinetd.

netstat -anltp |grep 5666
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 21221/xinetd

Re: check_file_age error

Posted: Wed Sep 16, 2020 6:52 am
by scottwilkerson
[email protected] wrote:NRPE is running in xinetd.

netstat -anltp |grep 5666
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 21221/xinetd
then we will need to see the user from xinetd config

Code: Select all

grep user /etc/xinetd.d/nrpe

Re: check_file_age error

Posted: Thu Sep 17, 2020 11:16 pm
grep user /etc/xinetd.d/nrpe
user = nagios

Re: check_file_age error

Posted: Fri Sep 18, 2020 7:03 am
by scottwilkerson
[email protected] wrote:grep user /etc/xinetd.d/nrpe
user = nagios
Ok, one more check

Code: Select all

grep nagios /etc/group