Skip to content

Feature parity between Python disk check and Go disk check #33116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 198 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from 181 commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
5321bc8
add test when 'include_all_devices' is not present (default value=True)
jose-manuel-almaza Jan 20, 2025
2cebed1
add release notes
jose-manuel-almaza Jan 20, 2025
df8d05b
add test when 'include_all_devices' is True
jose-manuel-almaza Jan 20, 2025
5ed612e
add test when 'include_all_devices' is False
jose-manuel-almaza Jan 20, 2025
48b78e0
refactor mocks
jose-manuel-almaza Jan 20, 2025
2a2142d
add test when disk.Partitions returns an error
jose-manuel-almaza Jan 20, 2025
f145f53
add debug logs present in python check
jose-manuel-almaza Jan 20, 2025
447c523
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Jan 21, 2025
8fb789f
add 'all_partitions' tests
jose-manuel-almaza Jan 22, 2025
1e6b88c
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Jan 22, 2025
cc5c03c
process 'device_exclude' config key
jose-manuel-almaza Jan 22, 2025
59e568c
process 'device_blacklist' config key
jose-manuel-almaza Jan 22, 2025
8c98e0f
process 'excluded_disks' config key
jose-manuel-almaza Jan 22, 2025
56b2fc5
process 'excluded_disk_re' config key
jose-manuel-almaza Jan 22, 2025
e2abd45
move 'mountpoint' variable closer to its use
jose-manuel-almaza Jan 22, 2025
b514223
small refactor
jose-manuel-almaza Jan 23, 2025
479c31b
process 'device_include' and 'device_whitelist' config keys
jose-manuel-almaza Jan 23, 2025
ddd7058
process 'file_system_exclude', 'file_system_blacklist' and 'excluded_…
jose-manuel-almaza Jan 23, 2025
8b1d5fb
process 'file_system_include' and 'file_system_whitelist' config keys
jose-manuel-almaza Jan 23, 2025
7e7112f
process 'excluded_mountpoint_re' config key
jose-manuel-almaza Jan 23, 2025
931e6c1
process 'include_all_devices' config key
jose-manuel-almaza Jan 23, 2025
28588f1
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Jan 23, 2025
54b6415
add regular expressions support when excluding devices
jose-manuel-almaza Jan 23, 2025
1220c2d
add regular expressions support when including devices
jose-manuel-almaza Jan 23, 2025
d83947b
add regular expressions support when including/excluding file systems
jose-manuel-almaza Jan 23, 2025
2b17c42
add regular expressions support when excluding mount points
jose-manuel-almaza Jan 23, 2025
5773ad9
process 'mount_point_include' and 'mount_point_whitelist' config keys
jose-manuel-almaza Jan 24, 2025
e458c39
add new asserts for all usage metrics reported
jose-manuel-almaza Jan 24, 2025
fda63ce
add new asserts for 'include_all_devices' config key tests
jose-manuel-almaza Jan 24, 2025
e0f1c42
meaningful test names and new asserts
jose-manuel-almaza Jan 24, 2025
60ce0ff
improve test names and add missing asserts
jose-manuel-almaza Jan 24, 2025
30ab96b
add test when 'diskUsage' system call returns error
jose-manuel-almaza Jan 24, 2025
17ea573
process 'device_global_exclude' and 'device_global_blacklist' config …
jose-manuel-almaza Jan 24, 2025
47b8407
add 'file_system_global_blacklist' deprecation message
jose-manuel-almaza Jan 24, 2025
d0fb680
remove comments
jose-manuel-almaza Jan 27, 2025
e655942
add 'device_global_blacklist' and 'mount_point_global_blacklist' depr…
jose-manuel-almaza Jan 27, 2025
096c7a5
process 'device_global_exclude' error in config
jose-manuel-almaza Jan 27, 2025
835a461
rename tests
jose-manuel-almaza Jan 27, 2025
cedcb2b
add 'file_system_whitelist' deprecation message
jose-manuel-almaza Jan 27, 2025
a53f049
add 'file_system_blacklist' deprecation message
jose-manuel-almaza Jan 27, 2025
6e95e4c
add 'device_whitelist' deprecation message
jose-manuel-almaza Jan 27, 2025
280d939
add 'device_blacklist' deprecation message
jose-manuel-almaza Jan 27, 2025
93d4b35
add 'mount_point_whitelist' deprecation message
jose-manuel-almaza Jan 27, 2025
ec812d4
add 'mount_point_blacklist' deprecation message
jose-manuel-almaza Jan 27, 2025
fc326c9
add 'excluded_filesystems' deprecation message
jose-manuel-almaza Jan 27, 2025
d2cc47d
add 'excluded_disks' and 'excluded_disk_re' deprecation message
jose-manuel-almaza Jan 27, 2025
a18c176
add 'excluded_mountpoint_re' deprecation message
jose-manuel-almaza Jan 27, 2025
c3678ee
process 'min_disk_size' config key
jose-manuel-almaza Jan 27, 2025
430f09d
assert log message when 'diskUsage' system call fails
jose-manuel-almaza Jan 27, 2025
cd36d33
assert log message when partition is excluded because of size check
jose-manuel-almaza Jan 27, 2025
56e3250
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Jan 27, 2025
47328a1
process 'tag_by_filesystem' config key
jose-manuel-almaza Jan 27, 2025
789ebd9
process 'use_mount' config key
jose-manuel-almaza Jan 27, 2025
5b7d280
process 'device_tag_re' config key
jose-manuel-almaza Jan 28, 2025
eaae963
prevent using the 'use_lsblk' and 'blkid_cache_file' config keys at t…
jose-manuel-almaza Jan 28, 2025
c0efc48
small refactor
jose-manuel-almaza Jan 28, 2025
22fa311
process 'tag_by_label' config key
jose-manuel-almaza Jan 29, 2025
f5c2cd2
add test where 'tag_by_filesystem' configkey is false
jose-manuel-almaza Jan 29, 2025
7358e41
small refactor
jose-manuel-almaza Jan 29, 2025
6f9757e
process 'service_check_rw' config key
jose-manuel-almaza Jan 29, 2025
a103522
add tests for 'disk.IOCounters' use cases
jose-manuel-almaza Jan 29, 2025
e91c367
added logs
jose-manuel-almaza Jan 29, 2025
406ee23
update 'blkid' system call management
jose-manuel-almaza Jan 30, 2025
a1db57e
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Jan 30, 2025
cf53230
add missing asserts
jose-manuel-almaza Jan 30, 2025
1a297ae
add labels to iocounters metrics
jose-manuel-almaza Jan 30, 2025
36bdaf4
remove some comments
jose-manuel-almaza Jan 30, 2025
2226c50
change warning log message to align with python version
jose-manuel-almaza Jan 31, 2025
82cf824
fix test name error
jose-manuel-almaza Jan 31, 2025
6625b63
fix test
jose-manuel-almaza Jan 31, 2025
46f5713
remove some default exclude values that should be set by config
jose-manuel-almaza Jan 31, 2025
1cc2d0d
use either device name or mount point to get device tags
jose-manuel-almaza Jan 31, 2025
d0da6b8
process 'create_mounts' config key and refactor code
jose-manuel-almaza Feb 10, 2025
94c143c
fix build tags
jose-manuel-almaza Feb 10, 2025
591e5dd
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Feb 10, 2025
fec08f1
remove previous windows stub
jose-manuel-almaza Feb 10, 2025
102681f
add 'blkid' command call for non-windows
jose-manuel-almaza Feb 11, 2025
3129ef8
update config file
jose-manuel-almaza Feb 11, 2025
6a8653b
process 'use_lsblk' and 'blkid_cache_file'
jose-manuel-almaza Feb 12, 2025
635c68d
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Feb 12, 2025
a3ab0fd
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Feb 14, 2025
efddc0d
remove unnecessary comments and build tags
jose-manuel-almaza Feb 17, 2025
8054c4e
fix revive errors
jose-manuel-almaza Feb 17, 2025
33469ed
rename 'diskConfigure' to 'configureDiskCheck'
jose-manuel-almaza Feb 17, 2025
5f4fcf3
remove unneeded conversion
jose-manuel-almaza Feb 17, 2025
e1f5484
remove unneeded conversion
jose-manuel-almaza Feb 17, 2025
b600c2e
Merge branch 'jose/disk_feature_parity' of github.com:DataDog/datadog…
jose-manuel-almaza Feb 17, 2025
63ded7e
add labelRegExpression as const value
jose-manuel-almaza Feb 17, 2025
f8441b5
move a type declaration and method to private
jose-manuel-almaza Feb 17, 2025
4c0c1be
add default values
jose-manuel-almaza Feb 17, 2025
e8f30a4
regex as var
jose-manuel-almaza Feb 17, 2025
ca2e61c
fixed linter error
jose-manuel-almaza Feb 17, 2025
e964ab4
fixed linter error
jose-manuel-almaza Feb 17, 2025
9deeb1a
make device type private
jose-manuel-almaza Feb 18, 2025
38b985e
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Mar 27, 2025
61f85fa
fixed error
jose-manuel-almaza Mar 27, 2025
8eb5fc0
run unit tests in all platforms
jose-manuel-almaza Mar 27, 2025
cb1d7ca
moved create mounts config read to a method
jose-manuel-almaza Mar 27, 2025
ba6568b
add tests for 'file_system_global_exclude' default values
jose-manuel-almaza Mar 27, 2025
3ea5f79
add tests for 'mount_point_global_exclude' default values
jose-manuel-almaza Mar 27, 2025
314a7e9
moved tag tests to not windows build
jose-manuel-almaza Mar 27, 2025
b1cef97
moved tests to linux or windows
jose-manuel-almaza Mar 28, 2025
bf88dc1
moved some consts to the correct file
jose-manuel-almaza Mar 28, 2025
8f65909
moved 'create_mounts' code to windows
jose-manuel-almaza Mar 28, 2025
1649760
added python comments pointing to issues
jose-manuel-almaza Mar 28, 2025
a3877e0
rename unused variable
jose-manuel-almaza Mar 28, 2025
45ee528
fixed error with some 'min_disk_size' use cases
jose-manuel-almaza Mar 28, 2025
8808c79
add marshall yaml into config
jose-manuel-almaza Apr 1, 2025
edbcd62
small refactor
jose-manuel-almaza Apr 1, 2025
1da5481
add ignore case in windows config regular expressions
jose-manuel-almaza Apr 1, 2025
dbfd9bf
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 1, 2025
01d20bc
fixed windows test
jose-manuel-almaza Apr 1, 2025
ca42641
removed windows test
jose-manuel-almaza Apr 1, 2025
168bc20
small refactor
jose-manuel-almaza Apr 2, 2025
31b349f
move new implementation from disk to diskv2 folder
jose-manuel-almaza Apr 2, 2025
3e75264
restore disk original version as the new one is now in diskv2 folder
jose-manuel-almaza Apr 2, 2025
375c4cc
set diskv2 as package for diskv2 folder
jose-manuel-almaza Apr 2, 2025
3324ba8
Update pkg/collector/corechecks/system/disk/diskv2/disk_nix.go
jose-manuel-almaza Apr 4, 2025
37b3c0f
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 4, 2025
0de301d
fixed error
jose-manuel-almaza Apr 4, 2025
515b5fc
skip empty labels
jose-manuel-almaza Apr 4, 2025
c264205
remove unnecessary code when creating remote path
jose-manuel-almaza Apr 4, 2025
f82740f
fixed windows test
jose-manuel-almaza Apr 4, 2025
66dd905
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 8, 2025
18ef777
add 'use_diskv2_check' config key
jose-manuel-almaza Apr 8, 2025
a6bf013
update release notes
jose-manuel-almaza Apr 8, 2025
1eea9d8
Update releasenotes/notes/disk_feature_parity-f26158df4ead7b63.yaml
jose-manuel-almaza Apr 8, 2025
b1ad617
Update pkg/config/setup/config.go
jose-manuel-almaza Apr 8, 2025
1ca00b2
create remotePath func
jose-manuel-almaza Apr 8, 2025
b85dd06
fixed NetAddConnection calls
jose-manuel-almaza Apr 8, 2025
50ba0ad
fix label regex to be case insensitive
jose-manuel-almaza Apr 9, 2025
67351c6
remove extra initialization
jose-manuel-almaza Apr 9, 2025
ea71057
avoid empty labels
jose-manuel-almaza Apr 9, 2025
fdedd64
fix windows test
jose-manuel-almaza Apr 9, 2025
a16dbf0
add test for empty labels
jose-manuel-almaza Apr 9, 2025
e4f9498
changed log level when partition usage is zero
jose-manuel-almaza Apr 9, 2025
a8d7c48
Update cmd/agent/dist/conf.d/disk.d/conf.yaml.default
jose-manuel-almaza Apr 10, 2025
4827701
small refactor
jose-manuel-almaza Apr 10, 2025
afc9388
Merge branch 'jose/disk_feature_parity' of github.com:DataDog/datadog…
jose-manuel-almaza Apr 10, 2025
c724ac9
move tag logic to a separate function
jose-manuel-almaza Apr 10, 2025
8f1b3f0
add 'lowercase_device_tag' config key
jose-manuel-almaza Apr 11, 2025
d4d65b3
add base_device_name func
jose-manuel-almaza Apr 11, 2025
ad35774
add 'utilized' metrics
jose-manuel-almaza Apr 11, 2025
f1b0584
send inodes metrics only in linux
jose-manuel-almaza Apr 11, 2025
2db79ef
copy comment from python check
jose-manuel-almaza Apr 11, 2025
41fcd5f
skip cd-rom drives in windows
jose-manuel-almaza Apr 11, 2025
35c2879
ignore all the bits not part of the mountpoint name
jose-manuel-almaza Apr 11, 2025
df4d6ac
fix unused-parameter error
jose-manuel-almaza Apr 11, 2025
3e359c7
Update pkg/collector/corechecks/system/disk/diskv2/disk.go
jose-manuel-almaza Apr 11, 2025
b9d7f08
copy 'device_name' related test to windows
jose-manuel-almaza Apr 11, 2025
ef48fd5
copy 'device_name' related test to windows
jose-manuel-almaza Apr 11, 2025
5fea541
fix windows test
jose-manuel-almaza Apr 14, 2025
9ab049f
fix 'include_all_devices' to true test
jose-manuel-almaza Apr 14, 2025
84d31c6
fix 'include_all_devices' to false test
jose-manuel-almaza Apr 14, 2025
27a589e
fix empty device test
jose-manuel-almaza Apr 14, 2025
32c31b5
fix 'all_partitions' to false test
jose-manuel-almaza Apr 14, 2025
b8cf023
fix 'all_partitions' to true test
jose-manuel-almaza Apr 14, 2025
4523119
fix device include and whitelist tests
jose-manuel-almaza Apr 14, 2025
e5422d4
fix cdrom tests
jose-manuel-almaza Apr 14, 2025
20be185
migrate some tests to windows
jose-manuel-almaza Apr 14, 2025
e8f7cbe
fix tracefs tests
jose-manuel-almaza Apr 15, 2025
c967a37
fix 'file_system_global_exclude' tests
jose-manuel-almaza Apr 15, 2025
2472848
fix 'file_system_*' tests
jose-manuel-almaza Apr 15, 2025
0fd01c4
small refactor
jose-manuel-almaza Apr 15, 2025
ef2bb7a
fix 'file_system_include' and 'file_system_whitelist' tests
jose-manuel-almaza Apr 15, 2025
1c114ed
fix mock.AnythingOfType error
jose-manuel-almaza Apr 15, 2025
df5138c
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 15, 2025
d31c54c
fix 'mount_point_global_exclude' and 'mount_point_global_blacklist' t…
jose-manuel-almaza Apr 15, 2025
17245f2
fix 'mount_point_exclude' and 'mount_point_blacklist' tests
jose-manuel-almaza Apr 15, 2025
6eb9a67
fix 'excluded_mountpoint_re' test
jose-manuel-almaza Apr 15, 2025
2dcde71
fix 'tag_by_filesystem' to true test
jose-manuel-almaza Apr 15, 2025
3ccd034
fix 'use_mount' and 'service_check_rw' to true tests
jose-manuel-almaza Apr 15, 2025
8af93c8
fix TestGivenADiskCheckWithFileSystemGlobalExcludeNotConfigured_WhenC…
jose-manuel-almaza Apr 15, 2025
e6c716a
[AGENTRUN-213] Add disk check e2e test comparing versions (#35990)
pgimalac Apr 16, 2025
08372e0
stop reporting inodes metrics when usage.InodesTotal is 0
jose-manuel-almaza Apr 16, 2025
53ad66f
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 16, 2025
c465d67
small refactor
jose-manuel-almaza Apr 17, 2025
a94ac80
round to 1 decimal metric values in e2e
jose-manuel-almaza Apr 17, 2025
a8ff7f6
add const metricCompareDecimals set to 1
jose-manuel-almaza Apr 17, 2025
8593390
custom comparer alternative
jose-manuel-almaza Apr 17, 2025
a7d157a
add timeout to disk usage call
jose-manuel-almaza Apr 17, 2025
2fcd4d7
fixed comparer
jose-manuel-almaza Apr 17, 2025
5af9363
remove commented lines
jose-manuel-almaza Apr 17, 2025
a91cc30
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 17, 2025
a77bee4
feat: add Windows e2e test for disk
pgimalac Apr 23, 2025
7728bac
fix: use os argument to pick the os in e2e tests
pgimalac Apr 23, 2025
f0a9721
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 23, 2025
b9d3a46
refactor e2e test and fix os problem when calling UpdateEnv
jose-manuel-almaza Apr 24, 2025
0cee8f0
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 24, 2025
fa784b0
use 'github.com/benbjohnson/clock'
jose-manuel-almaza Apr 28, 2025
d52e624
regexes for filesystem include always case insensitive
jose-manuel-almaza Apr 28, 2025
3045a72
Update pkg/collector/corechecks/system/disk/diskv2/disk.go
jose-manuel-almaza Apr 28, 2025
0711e50
fix import error
jose-manuel-almaza Apr 28, 2025
17f67b2
trim tags
jose-manuel-almaza Apr 28, 2025
8e49460
add warning log for invalid regular expressions
jose-manuel-almaza Apr 28, 2025
40830e8
remove CI_PIPELINE_ID mention
jose-manuel-almaza Apr 28, 2025
bce779a
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 29, 2025
9d08b86
Merge branch 'main' into jose/disk_feature_parity
jose-manuel-almaza Apr 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 162 additions & 1 deletion cmd/agent/dist/conf.d/disk.d/conf.yaml.default
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@

init_config:

## @param file_system_global_exclude - list of strings - optional
## Instruct the check to always add these patterns to `file_system_exclude`.
##
## WARNING: Overriding these defaults could negatively impact your system or
## the performance of the check.
#
# file_system_global_exclude:
# - iso9660$
# - tracefs$

## @param device_global_exclude - list of strings - optional
## Instruct the check to always add these patterns to `device_exclude`.
##
## WARNING: Overriding these defaults could negatively impact your system or
## the performance of the check.
#
# device_global_exclude: []

## @param mount_point_global_exclude - list of strings - optional
## Instruct the check to always add these patterns to `mount_point_exclude`.
##
## WARNING: Overriding these defaults could negatively impact your system or
## the performance of the check.
#
# mount_point_global_exclude:
# - (/host)?/proc/sys/fs/binfmt_misc$

instances:

## @param use_mount - boolean - required
Expand Down Expand Up @@ -54,6 +81,89 @@ instances:
# - <KEY_1>:<VALUE_1>
# - <KEY_2>:<VALUE_2>

## @param file_system_include - list of strings - optional
## Instruct the check to only collect from matching file systems.
##
## Character casing is ignored. For convenience, the regular expressions
## start matching from the beginning and therefore to match anywhere you
## must prepend `.*`. For exact matches append `$`.
#
# file_system_include:
# - ext[34]$
# - ntfs$

## @param file_system_exclude - list of strings - optional
## Instruct the check to not collect from matching file systems.
##
## Character casing is ignored. For convenience, the regular expressions
## start matching from the beginning and therefore to match anywhere you
## must prepend `.*`. For exact matches append `$`.
##
## Devices from pseudo or memory-based file systems can be excluded by disabling the
## `include_all_devices` option.
##
## When conflicts arise, this will override `file_system_include`.
#
# file_system_exclude:
# - tmpfs$
# - rootfs$
# - autofs$

## @param device_include - list of strings - optional
## Instruct the check to only collect from matching devices.
##
## Character casing is ignored on Windows. For convenience, the regular
## expressions start matching from the beginning and therefore to match
## anywhere you must prepend `.*`. For exact matches append `$`.
#
# device_include:
# - /dev/sda[1-3]
# - 'C:'

## @param device_exclude - list of strings - optional
## Instruct the check to not collect from matching devices.
##
## Character casing is ignored on Windows. For convenience, the regular
## expressions start matching from the beginning and therefore to match
## anywhere you must prepend `.*`. For exact matches append `$`.
##
## When conflicts arise, this will override `device_include`.
#
# device_exclude:
# - /dev/sde
# - '[FJ]:'

## @param mount_point_include - list of strings - optional
## Instruct the check to only collect from matching mount points.
##
## Character casing is ignored on Windows. For convenience, the regular
## expressions start matching from the beginning and therefore to match
## anywhere you must prepend `.*`. For exact matches append `$`.
#
# mount_point_include:
# - /dev/sda[1-3]
# - 'C:'

## @param mount_point_exclude - list of strings - optional
## Instruct the check to not collect from matching mount points.
##
## Character casing is ignored on Windows. For convenience, the regular
## expressions start matching from the beginning and therefore to match
## anywhere you must prepend `.*`. For exact matches append `$`.
#
# mount_point_exclude:
# - /proc/sys/fs/binfmt_misc
# - /dev/sde
# - '[FJ]:'

## @param include_all_devices - boolean - optional - default: true
## Instruct the check to collect from all devices, including non-physical devices.
## Set this to false to exclude pseudo, memory, duplicate or inaccessible file systems.
##
## For more fine-grained control, use the inclusion and exclusion options.
#
# include_all_devices: true

## @param service_check_rw - boolean - optional
## Instruct the check to notify based on partition state.
##
Expand All @@ -68,7 +178,27 @@ instances:
#
# tag_by_filesystem: false

## @param device_tag_re - list of regex:tags string - optional
## @param tag_by_label - boolean - optional - default: true
## Instruct the check to tag all the metrics with disk label if there is one.
## Works on Linux only.
#
# tag_by_label: true

## @param blkid_cache_file - string - optional
## Instruct the check to read the labels from the blkid cache file instead of `blkid` executable.
## This parameter is used only if `tag_by_label` is true. It is incompatible with `use_lsblk`.
## Works on Linux only.
#
# blkid_cache_file: /run/blkid/blkid.tab

## @param use_lsblk - boolean - optional - default: false
## Instruct the check to read the labels from the `lsblk` executable instead of `blkid` executable.
## This parameter is used only if `tag_by_label` is true. It is incompatible with `blkid_cache_file`.
## Works on Linux only.
#
# use_lsblk: false

## @param device_tag_re - map of regex to tags - optional
## Instruct the check to apply additional tags to matching
## devices (or mount points if `use_mount` is true).
##
Expand All @@ -80,3 +210,34 @@ instances:
# /san/.*: device_type:san
# /dev/sda3: role:db,disk_size:large
# "c:": volume:boot

## @param min_disk_size - number - optional - default: 0
## Exclude devices with a total disk size less than a minimum value (in MiB)
#
# min_disk_size: 0

## @param timeout - integer - optional - default: 5
## Timeout of the disk query in seconds
#
# timeout: 5

## @param create_mounts - list of mappings - optional
## On Windows, instruct the check to create one or more network
## mounts, and have the check collect metrics for the mounted devices.
##
## Uses the provided username and password (if provided and necessary)
## to create an SMB or NFS mount. If `type` is not specified, then
## the operating system will choose the best available network filesystem
## based on the other parameters. If `type` is specified, then any type
## other than `nfs` will default to an SMB file share.
#
# create_mounts:
# - mountpoint: 's:'
# user: auser
# password: somepassword
# host: smbserver
# share: space
# - mountpoint: 'n:'
# host: nfsserver
# share: /mnt/nfs_share
# type: nfs
7 changes: 6 additions & 1 deletion cmd/cluster-agent/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/collector/corechecks/cluster/orchestrator"
"github.com/DataDog/datadog-agent/pkg/collector/corechecks/system/cpu/cpu"
"github.com/DataDog/datadog-agent/pkg/collector/corechecks/system/disk/disk"
"github.com/DataDog/datadog-agent/pkg/collector/corechecks/system/disk/diskv2"
"github.com/DataDog/datadog-agent/pkg/collector/corechecks/system/disk/io"
"github.com/DataDog/datadog-agent/pkg/collector/corechecks/system/filehandles"
"github.com/DataDog/datadog-agent/pkg/collector/corechecks/system/memory"
Expand Down Expand Up @@ -631,7 +632,11 @@ func registerChecks(wlm workloadmeta.Component, tagger tagger.Component, cfg con
corecheckLoader.RegisterCheck(kubernetesapiserver.CheckName, kubernetesapiserver.Factory(tagger))
corecheckLoader.RegisterCheck(ksm.CheckName, ksm.Factory())
corecheckLoader.RegisterCheck(helm.CheckName, helm.Factory())
corecheckLoader.RegisterCheck(disk.CheckName, disk.Factory())
if cfg.GetBool("use_diskv2_check") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it was already there but I'm a bit confused by this one because there's not Python interpreter in the cluster-agent. The disk check is not run according to the status command.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have all the context but fyi the disk check already had a Go implementation (used at least for the iot agent) so maybe that's what was used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I don't know if it runs by default on the cluster-agent or not, but in the worst case this change would keep the current behavior since use_diskv2_check is false by default. What do you think?

corecheckLoader.RegisterCheck(disk.CheckName, diskv2.Factory())
} else {
corecheckLoader.RegisterCheck(disk.CheckName, disk.Factory())
}
corecheckLoader.RegisterCheck(orchestrator.CheckName, orchestrator.Factory(wlm, cfg, tagger))
corecheckLoader.RegisterCheck(winproc.CheckName, winproc.Factory())
}
33 changes: 33 additions & 0 deletions pkg/collector/corechecks/system/disk/diskv2/clock.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use github.com/benbjohnson/clock instead (it's used in many places in the agent)

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.

// Package diskv2 provides Disk Check.
package diskv2

import "time"

// Clock abstracts time-related functions used in the package.
type Clock interface {
// After returns a channel that will send the current time after the specified duration.
After(d time.Duration) <-chan time.Time
}

// RealClock is the production implementation that wraps time.After.
type RealClock struct{}

// After returns the channel from time.After.
func (rc *RealClock) After(d time.Duration) <-chan time.Time {
return time.After(d)
}

// FakeClock is used in unit tests.
type FakeClock struct {
AfterCh chan time.Time
}

// After returns the controlled channel.
func (fc *FakeClock) After(_ time.Duration) <-chan time.Time {
return fc.AfterCh
}
Loading