Fix-check-files-pattern-argument-perfdata #320
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix the sum of file sizes metric by inserting it as 'total_size' instead of 'size'. This fixes the problem where that condition collides with the file attribute 'size'. Three 5mb files would in total take up 15mb space, triggering a critical='size > 10mb' condition
fix checkData if a pattern is used. we use the standard library walkDir function is used to add every directory, but files are checked and skipped if a pattern is present and file does not match it. this can lead to directories that dont have any matching files under them. add a function to trim them, and call it if a pattern is specified.
add argument 'calculate-subdirectory-sizes'. the traversal functions add directories with size "0", and only adds the files with their true size. this argument enables calculating the subdirectory function sizes and adding them as an attibute. implements the addSubdirectorySizes function
add attribute "check_path". if user specified multiple search paths, each one of them add files/directories to the same listData. It is unclear which search paths traversal led to the entry being added. add that as an attribute.
add search path metrics. by default, total_size is calculated from all files added to listData. add a new metric for each search path, it calculates the size sum of file sizes found for that search path. uses the "check_path" attribute.
add subdir metrics. this will add metrics with the name "fullname size" , just like it does for the files "filename size" . currently it is toggled only if subdirectory sizes are calculated and a pattern is specified.