Opened 14 months ago

Last modified 14 months ago

#518 assigned defect

CheckFileSize Failing to work on subdirectories

Reported by: marty_one Owned by: mickem
Priority: 1 Milestone: 0.4.2
Component: CheckDisk Version: 0.3.9
Severity: Bugs Keywords: CheckFileSize
Cc:

Description

I have been trying to setup checking for the current size of a directory and found a bug with the command.

If I do this:

$ ./check_nrpe -H 10.0.0.1 -p 5666 -c CheckFileSize -a ShowAll MinWarn=10G MinCrit=20G File:WIN=d:/scripts/*.*
CRITICAL: WIN: 0B < critical|'WIN'=0B;10737418240;21474836480

So I switched on the logging option for the nsclient service and found this in the log:

2012-04-19 10:29:09: error:D:\source\nscp\branches\stable\include\parsers/filter/where_filter_impl.hpp:85: Invalid file specified: d:/scripts/*.*

but if I do this

$ ./check_nrpe -H 10.0.0.1 -p 5666 -c CheckFileSize -a ShowAll MaxWarn=1M MaxCrit=2M File:_list=d:/*.*
CRITICAL: _list: 67M > critical|'_list'=66.96M;1;2;

or this

$ ./check_nrpe -H 10.0.0.1 -p 5666 -c CheckFileSize -a ShowAll MinWarn=10G MinCrit=20G File:WIN=d:/scripts/*.sql
CRITICAL: WIN: 2.43K < critical|'WIN'=2.43KB;10485760;20971520

It works as expected.

Change History (6)

comment:1 Changed 14 months ago by marty_one

The bug that I am reporting is that the "*.*" in a directory (IE: D:\scripts\*.*) fails to return a correct value. It always seems to return 0 bytes when there are files in a directory to report on. Where if it is a base drive (IE: D:\, C:\, etc...) it will return a correct value.

comment:2 Changed 14 months ago by mickem

  • Milestone changed from 0.4.0 to 0.4.2
  • Status changed from new to assigned

CheckFileSize will be eradicated (and fixed) in a up-coming version. I replaced the various CheckFile* with CheckFiles a few versions ago and that is a much better platform. CheckFileSize is more of an arcane thing...
SO this will most likely not make it for 0.4.0 but possible 0.4.2 (0.4.1 is a maintenance release). Also CheckFile will come "back" similar to CheckFiles but for a single file...

Michael Medin

comment:3 Changed 14 months ago by marty_one

I started testing with CheckFiles, even with the examples provided here I am still getting errors. The command I tried is this:

./check_nrpe -H 10.0.0.1 -p 5666 -c CheckFiles -a path=d:\stuff pattern=*.txt

and got this in the log file of the 0.3.9 client:

2012-04-27 10:43:55: error:include\parsers/filter/where_filter_impl.hpp:85: Parsing failed of '' at: 

it looks like the error was cut off but this is all that there was in the log file. Would switching on debug provide any more messages that would be helpful?

comment:4 Changed 14 months ago by mickem

Problem with CheckFiles (currently) is that it requires a filter which means it will not work as well as it cannot work on the aggregated result currently it will not work.
What I meant was that in the future I will make it work based on the CheckFIles command and thus not CheckFileSize...

comment:5 Changed 14 months ago by marty_one

After a bit more tweaking to the command line I managed to get the CheckFiles to work without error.

./check_nrpe -H 10.0.0.1 -p 5666 -c CheckFiles -a "path=d:\stuff" "pattern=*.txt" "filter=size gt 0b" MaxWarn=1 "syntax=%size%"

However as you mentioned the result is not aggregated, which is the type of output I require.

Will CheckFiles support an aggregated output result in the future for checking the size of directories?

Last edited 14 months ago by marty_one (previous) (diff)

comment:6 Changed 14 months ago by mickem

That's the idea right now you can only check "number of files" matched.
But the plan is to allow checking on size, dates and such as well...

But again "the idea": hence not now :)

Michael Medin

Note: See TracTickets for help on using tickets.