Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_files filter help #806

Open
vague666 opened this issue Sep 7, 2023 · 4 comments
Open

check_files filter help #806

vague666 opened this issue Sep 7, 2023 · 4 comments

Comments

@vague666
Copy link

vague666 commented Sep 7, 2023

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
Copy link
Author

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
Copy link

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

@alexoalexo
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants