We tried a similar setup in house, and everything seems to be working as expected. Here's what I did:
1. I had two CSV files in C:\TEMP directory
example01.PNG
2. Here's the output of the command I ran from the CLI:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_files -a path="C:\\TEMP\\" 'filter= written > -24h' 'warn= count = 0' 'empty-state=warning' 'empty-syntax=${status}: My CSV File is older then 24Hrs'
WARNING: My CSV File is older then 24Hrs|'count'=0;0;0
I got a WARNING as both files were older than 24 hours.
3. I modified one of the files, and made sure the timestamp changed.
example02.PNG
4. I reran my command:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_files -a path="C:\\TEMP\\" 'filter= written > -24h' 'warn= count = 0' 'empty-state=warning' 'empty-syntax=${status}: My CSV File is older then 24Hrs'
OK: All 1 files are ok|'count'=1;0;0
I got an OK as one for the files were newer than 24 hours.
5. I copied a few new files to the C:\TEMP folder, and ran the check again:
example03.PNG
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_files -a path="C:\\TEMP\\" 'filter= written > -24h' 'warn= count = 0' 'empty-state=warning' 'empty-syntax=${status}: My CSV File is older then 24Hrs'
OK: All 4 files are ok|'count'=4;0;0
The output was OK as there were files in the TEMP folder, newer than 24 hours. It said: "4 files" as there was one "modified" file, and 3 "new" files in the folder.
6. I removed the 4 "new" files, and the output changed to WARNING again (as the only file that was left was older than 24 hours).
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_files -a path="C:\\TEMP\\" 'filter= written > -24h' 'warn= count = 0' 'empty-state=warning' 'empty-syntax=${status}: My CSV File is older then 24Hrs'
WARNING: My CSV File is older then 24Hrs|'count'=0;0;0
I am not sure if you are doing something else. It would help us if you actually showed screenshots of the timestamps of your files at the time you test your command from the CLI.
can you specify a file name or regex in the filter?
You could use something like this:
https://docs.nsclient.org/0.5.0/referen ... heck_files
You do not have the required permissions to view the files attached to this post.