mickem / nscp

NSClient++
http://nsclient.org
GNU General Public License v2.0
233 stars 91 forks source link

check_files filter help #806

Open vague666 opened 10 months ago

vague666 commented 10 months ago

This is more a question than issue. We are using NSClient++ 0.5.2.35 2018-01-28 and I was asked to create a check for files in a folder that HAVEN'T been created with warning at 30h, ie no new files have been created during the last 30 hours, and critical at 72h, ie if no new files have been created in the last 72 hours I can't for the life of me figure out how to do it with 0.5.2.35. Earlier there was filter=in/out which I think might've been easier for me to figure out the right syntax for

With the following,

-a "path=D:/Infor/CentralFilePRD/archive/backup" "pattern=MEC_Archive_Backup_*" "filter=creation<=1m" "warn=creation <= 30s" "perf-config=*(ignored:true)" "detail-syntax=%(filename): %(creation)"
WARNING: 326/326 files (MEC_Archive_Backup_1561240803369.zip: 2019-06-22 22:08:20, MEC_Archive_Backup_1561845603628.zip: 2019-06-29 22:10:13, MEC_Archive_Backup_1562450403380.zip: 2019-07-06 22:08:10, MEC_Archive_Backup_1563055203717.zip: 2019-07-13 22:08:05, MEC_Archive_Backup_1563660003640.zip: 2019-07-20 22:09:19, 

I get files with dates from 2019

vague666 commented 10 months ago

This is better but why does it set the status to UNKNOWN?

[root@server ~]# /opt/plugins/check_nrpe -2 -H remote-server -p port -c check_files -a "path=D:/Infor/CentralFilePRD/archive/backup" "pattern=MEC_Archive_Backup_*" "filter=creation > -14h" "warn=count = 0" "perf-config=*(ignored:true)" "detail-syntax=%(filename): %(creation)" "top-syntax=%(status): %(problem_count) files (%(problem_list))" max-depth=1
OK: All 1 files are ok|'count'=1;0;0
[root@server ~]# /opt/plugins/check_nrpe -2 -H remote-server -p port -c check_files -a "path=D:/Infor/CentralFilePRD/archive/backup" "pattern=MEC_Archive_Backup_*" "filter=creation > -7h" "warn=count = 0" "perf-config=*(ignored:true)" "detail-syntax=%(filename): %(creation)" "top-syntax=%(status): %(problem_count) files (%(problem_list))" max-depth=1
No files found|'count'=0;0;0
[root@server ~]# echo $?
3

I would expect the warn= to set the exitcode to 1

jbeaujour commented 9 months ago

Hello Use https://nsclient.org/docs/reference/windows/CheckDisk/#check_files_empty-state when there is no file

alexoalexo commented 4 months ago

Hello Use https://nsclient.org/docs/reference/windows/CheckDisk/#check_files_empty-state when there is no file

It looks like this(empty-state) is no longer available #823 ?

jbeaujour commented 3 months ago

Hello It works fine in (0.5.2.39 2018-02-04)