Host Directory
Host directory collector is used to collect directory files, such as the number of files, all file sizes, etc.
Configuration¶
Go to the conf.d/samples directory under the DataKit installation directory, copy hostdir.conf.sample and name it hostdir.conf. Examples are as follows:
[[inputs.hostdir]]
interval = "10s"
# directory to collect
# Windows example: C:\\Users
# UNIX-like example: /usr/local/
dir = "" # required
# optional, i.e., "*.exe", "*.so"
exclude_patterns = []
[inputs.hostdir.tags]
# some_tag = "some_value"
# more_tag = "some_other_value"
Once configured, restart DataKit.
The collector can now be turned on by ConfigMap injection collector configuration.
Metric¶
For all of the following metric sets, a global tag named host is appended by default (the tag value is the host name of the DataKit), or other tags can be specified in the configuration by [inputs.hostdir.tags]:
hostdir¶
| Tags & Fields | Description |
|---|---|
| file_mode ( tag) |
Permission mode of the monitored directory. |
| file_ownership ( tag) |
Ownership mode of files counted under the monitored directory. |
| file_system ( tag) |
Filesystem type of the mount that contains the monitored directory. |
| host_directory ( tag) |
The root directory path being scanned by the collector. |
| mount_point ( tag) |
Mount point that contains the monitored directory. |
| dir_count | Current number of subdirectories under the monitored directory. Type: int | (gauge) Unit: count |
| file_count | Current number of files and subdirectories under the monitored directory. Type: int | (gauge) Unit: count |
| file_size | Total size in bytes of files currently stored under the monitored directory. Type: int | (gauge) Unit: digital,B |
| free | Free filesystem capacity in bytes for the mount that contains the monitored directory. Type: int | (gauge) Unit: digital,B |
| inodes_free | Number of free inodes available on the filesystem that contains the monitored directory. Type: int | (gauge) Unit: count |
| inodes_total | Total number of inodes available on the filesystem that contains the monitored directory. Type: int | (gauge) Unit: count |
| inodes_used | Number of inodes currently used by files and subdirectories under the monitored directory. Type: int | (gauge) Unit: count |
| inodes_used_percent | Percentage of filesystem inodes used by files and subdirectories under the monitored directory relative to the containing filesystem. Type: float | (gauge) Unit: percent,percent |
| total | Total filesystem capacity in bytes for the mount that contains the monitored directory. Type: int | (gauge) Unit: digital,B |
| used_percent | Percentage of filesystem capacity used by files under the monitored directory relative to the containing filesystem. Type: float | (gauge) Unit: percent,percent |