NSClient++ Help (#1) - CheckFile age filter ? (#251) - Message List

CheckFile age filter ?

Hi,

I have in FOLDER01 next files:

File20080916.txt created 2008/09/16 20:00

File20080917.txt created 2008/09/17 20:00

File20080918.txt created 2008/09/18 20:00

Need to check at least one file of File*.txt NOT older than 24 hours.

I confuse with filters: CheckFile: file=X:\FOLDER01\File*.txt, filter=in, filter-creation=>24h, syntax=%filename% was created %creation%, MaxWarn=1, MaxCrit=3

Thanks

  • Message #758

    the filter filter-creation=>24h means you throw away all files older then so the "rest" are the ones you want.

    Then you just set MinWarn=1 MaxWarn=1 to make it warn on less then 1 file (am a bit unsure here might be you want MinWarn=0)

    MickeM

    • Message #759

      Thanks for answer.

      NSC.log 1:

      2008-09-19 13:53:33: debug:.\NSClient++.cpp:910: Injecting: CheckFile: file=X:\FOLDER01\File*.txt, filter=in, filter-creation=>24h, syntax=%filename% was created %creation%, MinWarn=1, MaxWarn=1
      2008-09-19 13:53:33: debug:../../include\checkHelpers.hpp:727: Missing bounds for maxmin-bounds check: File20080916.txt, ...
      2008-09-19 13:53:33: debug:.\NSClient++.cpp:946: Injected Result: WARNING 'File20080916.txt was created Tuesday, September 16, 2008 19:00:00, File20080917.txt was created Wednesday, September 17, 2008 19:00:00, File20080916.txt, ...: 2 > warning'
      

      NSC.log 2:

      2008-09-19 13:58:45: debug:.\NSClient++.cpp:910: Injecting: CheckFile: file=X:\FOLDER01\File*.txt, filter=in, filter-creation=>24h, syntax=%filename% was created %creation%, MinWarn=0, MaxWarn=1
      2008-09-19 13:58:45: debug:../../include\checkHelpers.hpp:727: Missing bounds for maxmin-bounds check: File20080916.txt, ...
      2008-09-19 13:58:45: debug:.\NSClient++.cpp:946: Injected Result: WARNING 'File20080916.txt was created Tuesday, September 16, 2008 19:00:00, File20080917.txt was created Wednesday, September 17, 2008 19:00:00, File20080916.txt, ...: 2 > warning'
      
      • Message #760

        thr "missing bounds" error is probably bad, I shall look into this if I have time when I get home...

        MickeM

        • Message #761

          Thanks

          Filter last redaction: send WARNING if ALL files File*.txt are older than 24 hours.

          • Message #771

            Any ideas?

            • Message #772

              sorry, the whole Service issue sort of caught me off guard so forgot your issue :)

              I shall try to check in tomorrow or possibly tonight!

              MickeM

              • Message #800

                Hello,

                I did some checking on this and managed to not get it to work... so instead I quickly wrote a new command that works...

                download 0.3.5 and try the following:

                CheckFile2 file=c:\test\*.txt filter=in filter+creation=<24h "syntax=%filename% was created %creation%" MinWarn=0 MinCrit=0
                
                • Message #801

                  ((BTW))

                  (this uses the same syntax as the "new" eventlog filtering so you can use filter=in (all files match by default) and filter=out (all files dont match by default), and then use filter+<keyword> and filter-<keyword> to add/remove hits to the subset...)

                  MickeM

                  • Message #806

                    Big thanks for excellent support and update.

                    I tested. The solution works. My configuration is next.

                    Nagios server command.cfg file:

                    define command{ command_name check_nrpe_file_new command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckFile2 -a file="$ARG1$" filter=in filter+creation=\<"$ARG2$" syntax="%filename% was created %creation%" MinWarn=0 #MinCrit=0 }

                    Nagios server somename.cfg file:

                    define service{ ... check_command check_nrpe_file_new!X:
                    FOLDER
                    *.bak!26h normal_check_interval 60 }

                    NSClient++ NSC.ini file:

                    [modules] NRPEListener.dll [NRPE] allow_arguments=1 allow_nasty_meta_chars=1

                    Full explanation: http://vadimszenins.blogspot.com/2008/09/check-on-nagios-latest-files-in-folder.html

                    • Message #807

                      Hi,

                      1. Questions: Does command "CheckFile2 file=c:\folder01\*.bak filter=in filter+creation=<24h" check files in sub folders?

                      I have >60 SQL backup files *.bak in folder01 and >761 SQL transaction log files *.trn in folder02 sub folder.

                      Debug log:

                      2008-09-29 11:54:50: debug:.\CheckDisk.cpp:556: result: 1 -- 1 2008-09-29 11:54:50: debug:../../include\checkHelpers.hpp:725: Missing bounds for maxmin-bounds check: BESMgmt_backup_200809282100.bak, ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ..., ... 2008-09-29 11:54:50: debug:..\..\include\NSCHelper.cpp:73: String (5176) to long to fit inside buffer(4096) : BESMgmt_ba 2008-09-29 11:54:50: error:.\NSClient++.cpp:938: UNKNOWN: Return buffer to small to handle this command. 2008-09-29 11:54:50: error:..\..\include\NSCHelper.cpp:241: Inject buffer to small, increase the value of: string_length

                      1. Filter work, but on Nagios web page in Status Information I have incorrect time (compare file name and time):

                      200809291215.dmp was created Monday, September 29, 2008 11:15:01, 200809291230.dmp was created Monday, September 29, 2008 11:30:02

                      Debug Log:

                      2008-09-29 12:51:26: debug:.\CheckDisk.cpp:546: Matched (missed): + creation: for: 200809291200.dmp was created Monday, September 29, 2008 11:00:01 2008-09-29 12:51:26: debug:.\CheckDisk.cpp:556: result: 1 -- 0 2008-09-29 12:51:26: debug:.\CheckDisk.cpp:546: Matched (missed): + creation: for: 200809291215.dmp was created Monday, September 29, 2008 11:15:01 2008-09-29 12:51:26: debug:.\CheckDisk.cpp:556: result: 1 -- 0 2008-09-29 12:51:26: debug:.\CheckDisk.cpp:556: result: 1 -- 1 2008-09-29 12:51:26: debug:.\CheckDisk.cpp:556: result: 1 -- 1 2008-09-29 12:51:26: debug:../../include\checkHelpers.hpp:725: Missing bounds for maxmin-bounds check: 200809291230.dmp, ... 2008-09-29 12:51:26: debug:.\NSClient++.cpp:946: Injected Result: OK '200809291230.dmp was created Monday, September 29, 2008 11:30:02, 200809291245.dmp was created Monday, September 29, 2008 11:45:01'

                      Thanks

                      • Message #862

                        Hi, good solution, was searching for it, and works great for local files.

                        But how can i check with an UNC path? like
                        Computername\Share1..... or
                        IP.Adress\Share1.....

                        Thanks for your time

Subscriptions