Page 2 of 2
Re: Check file age
Posted: Tue Feb 26, 2013 11:21 am
by slansing
So what happens when you run this check to a standard directory?
Code: Select all
directory of plugin/check_file_age -w value -c value -f /usr/local/nagios/etc/commands.cfg
Re: Check file age
Posted: Tue Feb 26, 2013 12:30 pm
by linuxnewbie
So what happens when you run this check to a standard directory?
Here is what I got for this:
Code: Select all
tmc@mybox:/usr/local/nagios/libexec$ ./check_file_age -w 600 -c 1200 -f /usr/local/nagios/etc/objects/commands.cfg
FILE_AGE CRITICAL: /usr/local/nagios/etc/objects/commands.cfg is 23 hours (1 days) old and 20448 bytes
Now that I know I have the correct command I ran it on the file nagios says it cannot find:
Code: Select all
tmc@mybox:/usr/local/nagios/libexec$ ./check_file_age -w 600 -c 1200 -f /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db
FILE_AGE CRITICAL: /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db is 13 hours (1 days) old and 687390720 bytes
So nagios can see it and see that the file is OK, so the syntax must be wrong in my config's.
The command I'm using:
Code: Select all
define command {
command_name check_file_age_Hopkins
command_line $USER1$/check_file_age -w 432000 -c 518400 -f /media/tmc/Data/OffSite_BU/Hopkins_Server/EagleSoft/Data/PattersonPM.db
}
The service I'm using:
Code: Select all
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
}
If you need anything else from me please let me know.
Thanks for all of your help!
Re: Check file age
Posted: Tue Feb 26, 2013 1:35 pm
by slansing
I am having trouble finding anything wrong with your definition, what happens when you change the command definition to check for the commands.cfg as I mentioned above and you force the check through the web UI. I'm wondering if it will tell you it cant find that file too..
Re: Check file age
Posted: Tue Feb 26, 2013 2:51 pm
by linuxnewbie
slansing wrote:I am having trouble finding anything wrong with your definition, what happens when you change the command definition to check for the commands.cfg as I mentioned above and you force the check through the web UI. I'm wondering if it will tell you it cant find that file too..
Ran a test:
Code: Select all
# check file age for Test
define command {
command_name check_file_age_Test
command_line $USER1$/check_file_age -w 432000 -c 518000 -f /usr/local/nagios/etc/objects/commands.cfg
}
It shows the file as being OK!
Im going to run a few more tests to see how deep into the media directory nagios can see files.
Re: Check file age
Posted: Tue Feb 26, 2013 2:57 pm
by sreinhardt
That sounds like a good idea! Another thought might be to add the nagios user to tmc group so that it will have access.
Re: Check file age
Posted: Tue Feb 26, 2013 5:01 pm
by linuxnewbie
sreinhardt wrote:That sounds like a good idea! Another thought might be to add the nagios user to tmc group so that it will have access.
I added nagios to the tmc group and tmc to the nagios group a few days ago and that did not help.
I found the reason why it was not working... /media and /media/tmc are owned by root:root. The reason Nagios did not have access is /media/tmc was lacking 'other' read rights. As soon as I gave the /media/tmc folder nagios can see everything just fine!
Thank you everyone! Still very new to Linux and it feels like I'm trying to swim before learning how to dog paddle... But its fun!
Thanks again!