Page 1 of 2
Check file age problems
Posted: Thu Dec 10, 2015 7:16 am
by kaiserclaw
I've searched on many forums but I can't get this to work!

I have a log file on my Windows machine that I want to monitor - if not written anything to the file in an hour I'll get a warning.
First tried command:
$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ but I do not know how ARG1 should look like.
I tried to write out the entire command in two ways for testing:
$USER1$/check_nrpe -H 192.168.1.11 -c CheckFiles -a path='C:\\Logs\\' pattern='test.log' 'filter=written < -10m' MaxCrit=1
Result code: 3
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
$USER1$/check_file -t "C:\Logs\test.log" --filter "age lt -1 hours" --rootonly --critical 0
failed. errno is 2: No such file or directory
How should I proceed?
Should I use $ARG1$ or I'll print out the entire command?
Thanks in advance!
Re: Check file age problems
Posted: Thu Dec 10, 2015 10:35 am
by rkennedy
$ARG1$ is pulled from the service definition when you define the command. See the screenshot below for reference.
Can you provide your whole service definition for us to look at?
Re: Check file age problems
Posted: Fri Dec 11, 2015 2:05 am
by kaiserclaw
Thanks for your reply,
I know, but I don't know how to formulate the ARG1 would it be OK to set ARG1 to:
check_nrpe -t C:\Logs\test.log --filter "age gt -1 hours" --rootonly --critical 0 --compare eq
I have never added a new service/command, I always use the built in like CPU, Memory and disk.
Thank you!
Re: Check file age problems
Posted: Fri Dec 11, 2015 10:21 am
by hsmith
You can have $ARG1$ be anything you want. For instance:
Your command could be:
Code: Select all
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 $ARG1$
And then your service could be:
Code: Select all
-c CheckFiles -a path='C:\\Logs\\' pattern='test.log' 'filter=written < -10m' MaxCrit=1
Assuming the code above works for the command line.
Re: Check file age problems
Posted: Mon Dec 14, 2015 3:55 am
by kaiserclaw
Thank you!
I tried the command and got:
_USER1_/check_nrpe -H 192.168.1.11 -t 30 -c CheckFiles -a path='C:\\Logs\\' pattern='test.log' 'filter=written < -10m' MaxCrit=1
Result code: UNKNOWN
CHECK_NRPE: Received 0 bytes from daemon. Check remote server logs for error messages.
Re: Check file age problems
Posted: Mon Dec 14, 2015 10:27 am
by hsmith
Do you have this check working from the command line?
Re: Check file age problems
Posted: Tue Dec 15, 2015 1:42 am
by kaiserclaw
No, same error..
Re: Check file age problems
Posted: Tue Dec 15, 2015 10:39 am
by hsmith
Have you tried checking the NRPE logs as suggested in the error?
Also, it may be best to post the command you are running, along with the output returned here for us to take a look at. It's hard to troubleshoot without seeing the actual output.
Re: Check file age problems
Posted: Tue Dec 15, 2015 7:12 pm
by Box293
What is the result of executing this at the command line:
Can you please provide your nsclient.ini file
Re: Check file age problems
Posted: Wed Dec 16, 2015 2:11 am
by kaiserclaw
Thanks for reply.
Where can I find the NRPE logs? I can't find any logs on C:\ drive or under client folder on the host.
The command looks like this:
Command:
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 $ARG1$
Service:
-c CheckFiles -a path='C:\\Logs\\' pattern='test.log' 'filter=written < -10m' MaxCrit=1
When I run "$USER1$/check_nrpe -H 192.168.1.11" it says:
_USER1_/check_nrpe -H 192.168.1.11
Result code: 0
I seem to be doing fine....