Page 1 of 4
How to config plugin check_newest_file_age
Posted: Fri May 03, 2019 7:40 am
by welbp00
Hi,
How to config check_newest_file_age? I have got the command working from the command line:
./check_nrpe -H linux-server -c check_newest_file_age -a' -d "/waslog/cp_init /gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/" -w 7 -c 8 -t days'
nrpe.cfg looks like this:
command[check_newest_file_age]=/usr/lib64/nagios/plugins/check_newest_file_age -d $ARG1$ -w 7 -c 8 -t days
cfg file:
define command{
command_name check_newest_file_age
command_line /usr/lib64/nagios/plugins/check_newest_file_age -H '$HOSTADDRESS$' -c check_newest_file_age -d '$ARG1$'
define service {
use generic-service
host_name linux-server
check_interval 300
service_description Controle herstart- en backup-log
check_command check_newest_file_age!/waslog/cp_init/!/gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/
Output in Nagios:
(No output on stdout) stderr: execvp(/usr/lib64/nagios/plugins/check_newest_file_age, ...) failed. errno is 2: No such file or directory
What am i doing wrong in the cfg-files?
Please help.
Best regards, Paul
Re: How to config plugin check_newest_file_age
Posted: Fri May 03, 2019 10:18 am
by jkinning
Do you get the same message if you remove the trailing / after cp_init? The command line version you say is working is different than what you are placing in the config.
check_nrpe -H linux-server -c check_newest_file_age -a' -d "/waslog/cp_init /gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/" -w 7 -c 8 -t days'
define service {
use generic-service
host_name linux-server
check_interval 300
service_description Controle herstart- en backup-log
check_command check_newest_file_age!/waslog/cp_init!/gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/
instead of
define service {
use generic-service
host_name linux-server
check_interval 300
service_description Controle herstart- en backup-log
check_command check_newest_file_age!/waslog/cp_init/!/gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/
Re: How to config plugin check_newest_file_age
Posted: Fri May 03, 2019 1:41 pm
by npolovenko
Hi,
@welbp00. You said this command is working?
Code: Select all
./check_nrpe -H linux-server -c check_newest_file_age -a' -d "/waslog/cp_init /gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/" -w 7 -c 8 -t days'
Combined with the definition you have in the nrpe.cfg file:
Code: Select all
command[check_newest_file_age]=/usr/lib64/nagios/plugins/check_newest_file_age -d $ARG1$ -w 7 -c 8 -t days
The final command that actually runs on the nrpe server looks like this:
Code: Select all
/usr/lib64/nagios/plugins/check_newest_file_age -d /waslog/cp_init /gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/" -w 7 -c 8 -t days -w 7 -c 8 -t days
This is incorrect because some arguments are repeating.
Here's the easier way to define everything.
On the nrpe server change the command to:
Code: Select all
command[check_newest_file_age]=/usr/lib64/nagios/plugins/check_newest_file_age $ARG1$
And on the nagios server your command will be:
Code: Select all
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
Your service will be:
Code: Select all
define service {
use generic-service
host_name linux-server
check_interval 300
service_description Controle herstart- en backup-log
check_command check_nrpe!check_newest_file_age! -a '-d "/waslog/cp_init /gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/" -w 7 -c 8 -t days'
}
Re: How to config plugin check_newest_file_age
Posted: Sun May 05, 2019 11:01 am
by welbp00
Hi npolovenko,
i have used your settings, and it seems to be working just fine, I have to do some more tests.
I will let you know.
Thanks!!
Regards, Paul.
Re: How to config plugin check_newest_file_age
Posted: Mon May 06, 2019 7:26 am
by welbp00
Hi,
i am still testing, but i need some more info....
This check should only run on monday morning. I have found some info how to configure but i am not sure about some settings..
Now i have one basic_host.cfg with several different checks. They all should run every 5 minutes, 24x7.
Like this:
define host {
name system-host-basis
max_check_attempts 3
check_period 24x7
check_command check-host-alive
contacts nagiosadmin
notification_interval 60
notification_period 24x7
}
But this plugin (check_newest_file_age) should only run on monday morning.
Do i have to make an additional basic.cfg file, with different time-period settings or is there another way?
Also do i have to make an entry in timeperiods.cfg? And how should it look like?
Thx, regards,
Paul.
Re: How to config plugin check_newest_file_age
Posted: Mon May 06, 2019 7:33 am
by welbp00
Could be something like this:
timeperiods.cfg:
define timeperiod{
timeperiod_name onlymondays
alias onlymondays
monday 00:00-09:00 ; Every Monday of every week
}
basic.cfg, section host config:
define host {
name linux-host-basis
max_check_attempts 3
check_period onlymondays
check_command ....
contacts nagiosadmin
notification_interval 60
notification_period onlymondays
}
What do i enter at check_command; check_newest_file_age?
Re: How to config plugin check_newest_file_age
Posted: Mon May 06, 2019 2:31 pm
by npolovenko
@welbp00, Do you want the host check to only run on Monday as well? Or the host check needs to run every day, 24x7 with a 5-minute interval? You can use this config.
Code: Select all
define host {
host_name linux-host-basis
alias linux-host-basis
address replace_with_host_ip_address
max_check_attempts 3
check_interval 5
retry_interval 1
check_period 24x7
check_command check-host-alive
contacts nagiosadmin
notification_interval 60
notification_period 24x7
}
define service {
use generic-service
host_name linux-host-basis
check_interval 5
check_period onlymondays
otification_period onlymondays
service_description Controle herstart- en backup-log
check_command check_nrpe!check_newest_file_age! -a '-d "/waslog/cp_init /gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/" -w 7 -c 8 -t days'
}
Re: How to config plugin check_newest_file_age
Posted: Mon May 06, 2019 2:42 pm
by welbp00
The other checks run every day, including the host-check.
Online the check_newest_file_age should run on monday morning.
Re: How to config plugin check_newest_file_age
Posted: Tue May 07, 2019 4:10 pm
by scottwilkerson
If you only want the service to run on Mondays you would add the following to the service definition
Re: How to config plugin check_newest_file_age
Posted: Wed May 08, 2019 3:29 am
by welbp00
Hello, thnx for the help.
I have tried this:
define service {
use generic-service
host_name linux-server
check_interval 300
service_description Controle herstart- en backup-log
check_period onlymondays
notification_period onlymondays
check_command check_newest_file_age! -a '-d "/waslog/cp_init /gpfs/fileSystemConnections55ONT/filesystemconnections6data/Search-bck/latest/" -w 7 -c 8 -t days'
}
I have added this in the /etc/nagios/objects/timeperiods.cfg:
define timeperiod{
timeperiod_name onlymondays
alias onlymondays
monday 00:00-09:00 ; Every Monday of every week
}
Don't know if it was needed?
Nagios monitor report this: Next Scheduled Check: 05-13-2019 00:00:40
Next week monday, so that seems to be OKay.
I will do some more test, but it looks fine.
Thnx for the help people!
Regards,
Paul.