Check file age
-
linuxnewbie
- Posts: 21
- Joined: Tue Feb 19, 2013 6:54 pm
Check file age
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
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
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check file age
Can you run
we need to see if the nagios user has rights to look in the directory
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-
linuxnewbie
- Posts: 21
- Joined: Tue Feb 19, 2013 6:54 pm
Re: Check file age
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.
-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.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check file age
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
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-
linuxnewbie
- Posts: 21
- Joined: Tue Feb 19, 2013 6:54 pm
Re: Check file age
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.
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.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check file age
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"-
linuxnewbie
- Posts: 21
- Joined: Tue Feb 19, 2013 6:54 pm
Re: Check file age
Sorry its taken me a few days to get back to this.
I ran:
Nagios is still having issues seeing the file.
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"
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Check file age
What did the command line output after you ran these individually?
-
linuxnewbie
- Posts: 21
- Joined: Tue Feb 19, 2013 6:54 pm
Re: Check file age
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 >.<
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 >.<
-
linuxnewbie
- Posts: 21
- Joined: Tue Feb 19, 2013 6:54 pm
Re: Check file age
Originally it asked for my sudo password but after that it didnt return anything.slansing wrote:What did the command line output after you ran these individually?
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.