Page 1 of 2

Check file age

Posted: Tue Feb 19, 2013 7:08 pm
by linuxnewbie
Hello everyone!

I'm installing nagios for the first time and I have an error my limited knowlage of ubuntu/nagios comes into play.

The check I'm attempting to use is: check_file_age
Here is the string I'm currently using in the commands.cfg:
define command{
command_name check_file_age
command_line $USER1$/check_file_age -w 432000 -c 518000 -f /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db
}

Here is the service:
define service{
use local-service
host_name TMC-Offsite-Backup-Server
service_description Hopkins_BU
check_command check_file_age_Hopkins
contact_groups admins, Hopkins
}

On the nagios web interface I get:
FILE_AGE CRITICAL: File not found - /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db

Of course when I look into the file location the file in question is infact there.

Using Ubuntu 12.10, nagios 3.1.0

Re: Check file age

Posted: Tue Feb 19, 2013 7:40 pm
by scottwilkerson
Can you run

Code: Select all

ls -l /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db
ls -ld /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data
we need to see if the nagios user has rights to look in the directory

Re: Check file age

Posted: Wed Feb 20, 2013 3:42 pm
by linuxnewbie
Ok so both ls -l and ls -ld gave me this:
-rwxrw---- 1 tmc tmc (a bunch of numbers) feb 18 19:55 /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db

So what I gather from this info is this:
1. the folder isnt being seen as a directory
2. user has read/write/execute, group has read/write, and other has nothing.
3. I'm not entirely sure where to go from here... lol.

Re: Check file age

Posted: Wed Feb 20, 2013 4:04 pm
by scottwilkerson
Ok, the user and group are both tmc and there are no rights for other.

When Nagios runs the check, it runs as the nagios user, so at the very least we need to add permissions on the directory so nagios user can see the files.

like

Code: Select all

chmod o+r /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data

Re: Check file age

Posted: Thu Feb 21, 2013 4:34 pm
by linuxnewbie
Thank you for the continued help scottwilkerson!

So I changed the entire directory for hopkins server to:
-rwxrw-r-- 1 tmc tmc (a bunch of numbers) feb 18 19:55 /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db
drwxrw-r-- 1 tmc tmc (a bunch of numbers) feb 18 19:55 /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/

Still no joy, also tried this:
-rwxrwxrwx 1 tmc tmc (a bunch of numbers) feb 18 19:55 /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db
drwxrwxrwx 1 tmc tmc (a bunch of numbers) feb 18 19:55 /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/

Nagios still cannot see the files :(

I also added the nagios user to the tmc group, and still no joy.

Re: Check file age

Posted: Thu Feb 21, 2013 7:39 pm
by scottwilkerson
hmmm, lets run

Code: Select all

su nagios -c "ls -l /media"
su nagios -c "ls -l /media/tmc"
su nagios -c "ls -l /media/tmc/Data"
su nagios -c "ls -l /media/tmc/Data/OffSite_BU"
su nagios -c "ls -l /media/tmc/Data/OffSite_BU/Hopkins_Server
su nagios -c "ls -l /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft
su nagios -c "ls -l /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data
su nagios -c "ls -l /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db"

Re: Check file age

Posted: Mon Feb 25, 2013 12:21 pm
by linuxnewbie
Sorry its taken me a few days to get back to this.

I ran:

Code: Select all

su nagios -c "ls -l /media"
su nagios -c "ls -l /media/tmc"
su nagios -c "ls -l /media/tmc/Data"
su nagios -c "ls -l /media/tmc/Data/OffSite_BU"
su nagios -c "ls -l /media/tmc/Data/OffSite_BU/Hopkins_Server
su nagios -c "ls -l /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft
su nagios -c "ls -l /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data
su nagios -c "ls -l /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db"
Nagios is still having issues seeing the file.

Re: Check file age

Posted: Mon Feb 25, 2013 12:57 pm
by slansing
What did the command line output after you ran these individually?

Re: Check file age

Posted: Mon Feb 25, 2013 1:27 pm
by linuxnewbie
To fasilitate my own learning and testing I've been playing with things on my end.

I feel as if I've found the bottle neck:
/media/tmc/Data/ -is apart of a secondary partition
To test if this might be the issue I created a new command for check file age to point at a directory on the same partition:
/home/tmc/Documents/Test -nagios is able to find this file and get the data it needs.

Still very new with linux so if this is something I should have pointed out earlier I didnt realize >.<

Re: Check file age

Posted: Mon Feb 25, 2013 1:46 pm
by linuxnewbie
slansing wrote:What did the command line output after you ran these individually?
Originally it asked for my sudo password but after that it didnt return anything.

As an update, I just created a test folder on a flash drive to see if nagios could see it. It cannot, I'm getting the same error msg as I'm getting for my data partition.