Page 1 of 1

check_nrpe Checkfile syntax question

Posted: Sat Aug 05, 2017 6:22 am
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.

Re: check_nrpe Checkfile syntax question

Posted: Mon Aug 07, 2017 8:34 am
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

Re: check_nrpe Checkfile syntax question

Posted: Mon Aug 07, 2017 2:37 pm
by tmcdonald
Thanks for the assist, @mcapra! OP, let us know if you need further assistance.