check_file_age error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
[email protected]
Posts: 66
Joined: Tue Aug 07, 2018 2:24 am

check_file_age error

Post by [email protected] »

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
|
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_file_age error

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
[email protected]
Posts: 66
Joined: Tue Aug 07, 2018 2:24 am

Re: check_file_age error

Post by [email protected] »

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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_file_age error

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
[email protected]
Posts: 66
Joined: Tue Aug 07, 2018 2:24 am

Re: check_file_age error

Post by [email protected] »

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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_file_age error

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
[email protected]
Posts: 66
Joined: Tue Aug 07, 2018 2:24 am

Re: check_file_age error

Post by [email protected] »

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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_file_age error

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
[email protected]
Posts: 66
Joined: Tue Aug 07, 2018 2:24 am

Re: check_file_age error

Post by [email protected] »

grep user /etc/xinetd.d/nrpe
user = nagios
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_file_age error

Post by scottwilkerson »

[email protected] wrote:grep user /etc/xinetd.d/nrpe
user = nagios
Ok, one more check

Code: Select all

grep nagios /etc/group
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked