Check file age problems

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
kaiserclaw
Posts: 15
Joined: Thu Dec 10, 2015 5:30 am

Check file age problems

Post 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!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check file age problems

Post by rkennedy »

$ARG1$ is pulled from the service definition when you define the command. See the screenshot below for reference.
command-service-relationship.png
Can you provide your whole service definition for us to look at?
Former Nagios Employee
kaiserclaw
Posts: 15
Joined: Thu Dec 10, 2015 5:30 am

Re: Check file age problems

Post 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!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check file age problems

Post 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.
Former Nagios Employee.
me.
kaiserclaw
Posts: 15
Joined: Thu Dec 10, 2015 5:30 am

Re: Check file age problems

Post 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.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check file age problems

Post by hsmith »

Do you have this check working from the command line?
Former Nagios Employee.
me.
kaiserclaw
Posts: 15
Joined: Thu Dec 10, 2015 5:30 am

Re: Check file age problems

Post by kaiserclaw »

No, same error..
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Check file age problems

Post 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.
Former Nagios Employee.
me.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Check file age problems

Post by Box293 »

What is the result of executing this at the command line:

Code: Select all

check_nrpe -H 192.168.1.11
Can you please provide your nsclient.ini file
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
kaiserclaw
Posts: 15
Joined: Thu Dec 10, 2015 5:30 am

Re: Check file age problems

Post 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....
Locked