check_nrpe Checkfile syntax question

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.
Locked
steve_boohoo
Posts: 3
Joined: Thu Oct 08, 2015 12:07 pm

check_nrpe Checkfile syntax question

Post by steve_boohoo »

Hi I have the check below which checks a certain folder for an absence of a particular file in a timeframe ( to report when we aren't receiving sales orders from our website )

-H $HOSTADDRESS$ -c CheckFiles -a path='C:\\VendaIntegration\\Download\\Processed' pattern=*UK-SalesOrders* 'filter=written > -20m' 'master-syntax={%total% Files Found}' MinCrit=0

The problem is that for example it found a file called UK-SalesOrders-20170805121700.psv created in the last 20 mins it would report ok but we also have files that are slightly different in that they have R1/R2/R3 at the end of them so basically

UK-SalesOrders-timestamp.psv is ok to be included in check
but
UK-SalesOrders-timestampR1.psv not to be included

Can I do a regex or something to exclude from the check.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_nrpe Checkfile syntax question

Post by mcapra »

Which version of NSClient++ are you using? There are major differences between 0.3, 0.4, and 0.5.
https://docs.nsclient.org/reference/win ... heck_files

I don't think you can use regular expressions in the pattern argument, though you're certainly welcome to try. Assuming the timestamp is in the format mentioned in the OP, this at least matches correctly:

Code: Select all

(UK-SalesOrders-)[0-9]{14}\.psv
Here are some good examples of CheckFiles usages:
http://sites.box293.com/nagios/guides/c ... es-folders
Former Nagios employee
https://www.mcapra.com/
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_nrpe Checkfile syntax question

Post by tmcdonald »

Thanks for the assist, @mcapra! OP, let us know if you need further assistance.
Former Nagios employee
Locked