Add size to filecount input (#4778)

This commit is contained in:
Samuel-BF
2018-12-13 21:25:49 +01:00
committed by Daniel Nelson
parent 0485119716
commit 8906e2796b
7 changed files with 219 additions and 131 deletions

View File

@@ -8,8 +8,17 @@ Counts files in directories that match certain criteria.
# Count files in a directory
[[inputs.filecount]]
## Directory to gather stats about.
## deprecated in 1.9; use the directories option
directory = "/var/cache/apt/archives"
## Directories to gather stats about.
## This accept standard unit glob matching rules, but with the addition of
## ** as a "super asterisk". ie:
## /var/log/** -> recursively find all directories in /var/log and count files in each directories
## /var/log/*/* -> find all directories with a parent dir in /var/log and count files in each directories
## /var/log -> count all files in /var/log and all of its subdirectories
directories = ["/var/cache/apt/archives"]
## Only count files that match the name pattern. Defaults to "*".
name = "*.deb"
@@ -35,16 +44,17 @@ Counts files in directories that match certain criteria.
- filecount
- count (int)
- size_bytes (int)
### Tags:
- All measurements have the following tags:
- directory (the directory path, as specified in the config)
- directory (the directory path)
### Example Output:
```
$ telegraf --config /etc/telegraf/telegraf.conf --input-filter filecount --test
> filecount,directory=/var/cache/apt,host=czernobog count=7i 1530034445000000000
> filecount,directory=/tmp,host=czernobog count=17i 1530034445000000000
> filecount,directory=/var/cache/apt,host=czernobog count=7i,size=7438336i 1530034445000000000
> filecount,directory=/tmp,host=czernobog count=17i,size=28934786i 1530034445000000000
```