NSClient++ Help (#1) - Counting a large number of files with CheckFile (#445) - Message List

Counting a large number of files with CheckFile

I need to track the number of files being created in a Windows file system (> 3 million). When I use the CheckFile command it seems to check all the folders (~1,000) but then displays an error at the very end. I am running NSClient++ Win32/Test and enter the following command:

checkfile file=H:\Data\Volume1\* filter-size=>0 MinWarn=0 MinCrit=0 truncate=128

The outputNSClient++.cpp(600) NSCLient++ - 0.3.6.818 2009-06-14 Started! ...
d \NSCHelper.cpp(73) String (14121998) to long to fit inside buffer(4096) : 'A10 00.1,
e NSClient++.cpp(1062) UNKNOWN: Return buffer to small to handle this command. BAD_CODE:

  • Message #1386

    What is the scenario?

    The problkem is the payload length (1024) so question is what would you expect?

    Michael Medin

    • Message #1387

      Thanks for the prompt response Michael! Scenario - We need to track the number of files created in a file system to ensure that it doesn't exceed a threshold. I used the truncate option and set it to a low figure as I don't care about the filenames, I just need to know the number of files. I understood that using the truncate option would keep me below the payload length of 1024. The error message however details a return buffersize of 4096 that is exceeded.

      As to what I expect.... I expect it to work first time ! (haha!)

      Regards... Fred

      • Message #1390

        humm, not 100% sure truncate is supportd here, know it was not before but think i added it (but might have planned to add it will check tonight).

        Anyways, the "size" is the internal one so it is "the same error". it works like this:

        nagios -> check_nrpe -> {1024} -> NRPEListener -> {4096} -> CheckDisk (they can be changed) but I shall look into to truncate and also see if I can do some "unique" thingy to make the output better.

        Michael medin

        • Message #1490

          Hi Michael - any update on this?
          I have tried the latest 3.7 version and the CheckFile2 command but still not working for folders with a large amount of files

          check_nrpe -H ih00001257 -c CheckFile2 -a path=C:
          Downloads
          SysLog? filter+size=gt:0 truncate=10

          Loglog...|'Loglogic_Installer_4.0.5.exe, ...'=2;0;0;

          check_nrpe -H ih00001257 -c CheckFile2 -t 5000 -a path=C:
          Downloads filter+size=gt:0 truncate=10

          UNKNOWN: Return buffer to small to handle this command.

          • Message #1517

            This works for me (in the up-coming 0.3.8 so might have been accidental fixed):

            CheckFile2 MinWarn=10 MinCrit=10 path=D:\WINDOWS\system32 filter+size=gt:0 truncate=10 ignore-errors
            OK:$winnt...|'found files'=7177;10;10;
            

            The ignore-errors flag is just since a lot of the files are "unreadable" in the sys32 folder.

            Michael Medin

        • Message #1396

          Fantastic - thanks Michael[[BR]]

          I guess all I'm looking for is a way to return the result (count) rather than all 3 million entries. This would be a lot faster as well.

          BTW - the application is a document management system , so this check will allow us to also measure growth and then later on I can do some trend analysis.

          Thanks & regards.. Fred

Subscriptions