NSClient++ Help (#1) - CheckFiles not work (#802) - Message List
Hi, I want to check the file(d:\backup\test.rar if create less than 5 min. I use the follwing command but it only can filter test.rar file couldn't estimate it if create less than 5 min. check_file=CheckFiles "filter=written < -5m" "path=D:\backup" "pattern=test.rar" "syntax=%filename%: %size%: %write%" MaxWarn=1 MaxCrit=1 How can I fix this problem?
-
Message #2179
New RC out in a bit (say next few hours) let me know if that works better (rc2)
Michael Medin
mickem06/13/11 16:55:41 (2 years ago)-
Message #2197
I used the 0.39rc3 to check but the same result to me. Is it something wrong in the check command for check a file create less than 5 min?
check_file=CheckFiles "filter=written < -5m" "path=D:\backup" "pattern=test.rar" "syntax=%filename%: %size%: %write%" MaxWarn=1 MaxCrit=1
Another thing,I found the result about time argument(eg.%wrtie%) in slow 8h.
fuinei06/15/11 07:47:17 (2 years ago)-
Message #2198
Humm... by "less then 5 minutes ago" do you mean maximum age 5 minutes?
If so you want the opposite: "written > -5m". I know this was going to bite me the dates are a bit strange (being my idea).
-5m translates to "the time 5 minutes ago". the two times are compared ie: is {{{' file written time' > 'time 5 minutes ago'}}} which translates to "more recent then 5 minutes ago"
Michael Medin
mickem06/15/11 08:00:18 (2 years ago)-
Message #2199
I used 0.3.9 rc3 and here is output for CheckFiles and CheckFile2 (I want to get list of files updated in last 20 min):
[plugins]# ./check_nrpe -H <myIP> -c CheckFiles -a path=C:/Logs/SMPPWatcher pattern=*.log "filter=written lt 20m" "syntax=%filename%:" MaxCrit=0 6-1-2011-smppwatcher.log:, 6-10-2011-smppwatcher.log:, 6-11-2011-smppwatcher.log:, 6-12-2011-smppwatcher.log:, 6-13-2011-smppwatcher.log:, 6-14-2011-smppwatcher.log:, 6-15-2011-smppwatcher.log:, 6-16-2011-smppwatcher.log:, 6-2-2011-smppwatcher.log:, 6-3-2011-smppwatcher.log:, 6-4-2011-smppwatcher.log:, 6-5-2011-smppwatcher.log:, 6-6-2011-smppwatcher.log:, 6-7-2011-smppwatcher.log:, 6-8-2011-smppwatcher.log:, 6-9-2011-smppwatcher.log:, found files: 16 > critical|'found files'=16;0;0
[plugins]# ./check_nrpe -H <myIP> -c CheckFile2 -a path=C:/Logs/SMPPWatcher pattern=*.log "filter+written=lt:20m" "syntax=%filename%:" MaxCrit=0 6-16-2011-smppwatcher.log:|'found files'=1;0;0
CheckFile2 returns correct results, CheckFiles looks like still have some problems. Alex
AlexGTA06/16/11 17:48:40 (2 years ago)-
Message #2200
In the "last 20 minutes" would be: ...filter=written gt -20m...
What you had ...filter=written lt 20m... means files "older then 20 minutes in the future". in essence read it like this: "<date file was written> less then <now + 20 minutes>" versus (the correct) "<date file was written> greater then <now - 20 minutes>"
In short:
- written lt 20m = "<date file was written> less then <now + 20 minutes>"
- written gt -20m = "<date file was written> greater then <now - 20 minutes>"
Michael Medin
mickem06/16/11 18:23:18 (2 years ago)-
Message #2202
Hi Michael,
In my case, I want to check the file if create in 5 minutes(maximum age 5 minutes) otherwise return the warnning information.
Test environment:
path=D:\backup file=test1.txt create over 5 minutes file=test2.txt create in 5 minutes
Test Command and result:
Command: check_file=CheckFiles "filter=written > -5m" "path=l:\test" "pattern=*.txt" "syntax=%filename%: %size%: %write%" MaxWarn=1 MaxCrit=1
Result: CheckFile ok|'found files'=0;1;1
I think the correct result is result 1 file the problematic file is test1.txt.
Command:
check_file=CheckFiles "filter=written < -5m" "path=l:\test" "pattern=*.txt" "syntax=%filename%: %size%: %write%" MaxWarn=1 MaxCrit=1
Result: test1.txt: 0B: Friday, June 17, 2011 09:46:32, test2.txt: 0B: Friday, June 17, 2011 10:01:00, found files: 2 > critical|'found files'=2;1;1
I think the correct result is result 1 file the problematic file is test2.txt.
I want to hnow is the a bug or the command definition has something wrong.
Another thing: Why the time is different from my computer time?(My computer time is Asia/Chongqing? GMT+8)
fuinei06/17/11 12:10:10 (2 years ago)-
Message #2203
Uhmm...
what do you mean by "over 5 minutes" ?
If "written age older then 5 minutes" then it is: "written lt -5m" which is read as: "<time of file> less then <now - 5 minutes>" in other words "time of file is less then 5 minutes ago" (older).
The time is in UTC which is not using timezones (but this should not affect anything)
Michael Medin
mickem06/17/11 22:35:53 (2 years ago)-
Message #2205
Sorry I made a mistake.Over 5 minutes is written age older then 5 minutes.
In my case I need to find the file is written older then 5 minutes.
I need to set the the command as check_file=CheckFiles "filter=written < -5m" "path=l:\test" "pattern=*.txt" "syntax=%filename%: %size%: %write%" MaxWarn=1 MaxCrit
For example: test1.txt written at 8:55,test2.txt written at 9:14,I execute the check command in 9:15.
I think the result is found 1 file(test1.txt) and return the critical state.
In fact the command return it can found 2 file. I means that I use the coommand can't find the file if it older than 5 minutes.
Another thing, The return time can it change with the computer settings? In may case I want it add 8 hours.
fuinei06/18/11 08:32:49 (2 years ago)
-
-
-
-
-
-








