Files and directories collector
This module monitors files and directories.
File metrics:
- existence
- time since the last modification
- size
Directory metrics:
- existence
- time since the last modification
- number of files
- size
Permissions
netdata
user needs the following permissions on all the directories in pathname that lead to the file/dir:
- files monitoring:
execute
. - directories monitoring:
read
andexecute
.
If you need to modify the permissions we suggest to use file access control lists:
setfacl -m u:netdata:rx file ...
Warning: For security reasons, this should not be applied recursively, but only to the exact set of directories that lead to the file/dir you want to monitor.
Metrics
All metrics have "filecheck." prefix.
Metric | Scope | Dimensions | Units |
---|---|---|---|
file_existence | global | a dimension per file | boolean |
file_mtime_ago | global | a dimension per file | seconds |
file_size | global | a dimension per file | bytes |
dir_existence | global | a dimension per directory | boolean |
dir_mtime_ago | global | a dimension per directory | seconds |
dir_num_of_files | global | a dimension per directory | files |
dir_size | global | a dimension per directory | bytes |
Configuration
Edit the go.d/filecheck.conf
configuration file using edit-config
from the
Netdata config directory, which is typically at /etc/netdata
.
cd /etc/netdata # Replace this path with your Netdata config directory
sudo ./edit-config go.d/filecheck.conf
Needs only a path to a file or a directory. The path supports *
wildcard.
Here is an example:
jobs:
- name: files_dirs_example
discovery_every: 30s
files:
include:
- '/path/to/file1'
- '/path/to/file2'
- '/path/to/*.log'
dirs:
collect_dir_size: no
include:
- '/path/to/dir1'
- '/path/to/dir2'
- '/path/to/dir3*'
- name: files_example
discovery_every: 30s
files:
include:
- '/path/to/file1'
- '/path/to/file2'
- '/path/to/*.log'
- name: dirs_example
discovery_every: 30s
dirs:
collect_dir_size: yes
include:
- '/path/to/dir1'
- '/path/to/dir2'
- '/path/to/dir3*'
For all available options, see the Filecheck collector's configuration file.
Limitations
- filecheck uses
stat
call to collect metrics, which is not very efficient.
Troubleshooting
To troubleshoot issues with the filecheck
collector, run the go.d.plugin
with the debug option enabled. The output
should give you clues as to why the collector isn't working.
Navigate to the
plugins.d
directory, usually at/usr/libexec/netdata/plugins.d/
. If that's not the case on your system, opennetdata.conf
and look for theplugins
setting under[directories]
.cd /usr/libexec/netdata/plugins.d/
Switch to the
netdata
user.sudo -u netdata -s
Run the
go.d.plugin
to debug the collector:./go.d.plugin -d -m filecheck
Do you have any feedback for this page? If so, you can open a new issue on our netdata/learn repository.