Skip to content
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

Ignore /proc/sys/fs/binfmt_misc by default #7650

Merged
merged 3 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion disk/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ files:
- name: file_system_global_blacklist
description: |
Instruct the check to always add these patterns to `file_system_blacklist`.

WARNING: Overriding these defaults could negatively impact your system or
the performance of the check.
value:
example:
- iso9660$
Expand All @@ -17,6 +20,9 @@ files:
- name: device_global_blacklist
description: |
Instruct the check to always add these patterns to `device_blacklist`.

WARNING: Overriding these defaults could negatively impact your system or
the performance of the check.
value:
example: []
type: array
Expand All @@ -25,8 +31,12 @@ files:
- name: mount_point_global_blacklist
description: |
Instruct the check to always add these patterns to `mount_point_blacklist`.

WARNING: Overriding these defaults could negatively impact your system or
the performance of the check.
value:
example: []
example:
- (/host)?/proc/sys/fs/binfmt_misc$
type: array
items:
type: string
Expand Down
12 changes: 11 additions & 1 deletion disk/datadog_checks/disk/data/conf.yaml.default
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,29 @@ init_config:

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

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

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

## Every instance is scheduled independent of the others.
#
Expand Down
6 changes: 5 additions & 1 deletion disk/datadog_checks/disk/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,4 +438,8 @@ def get_default_device_blacklist():

@staticmethod
def get_default_mount_mount_blacklist():
return []
return [
# https://github.com/DataDog/datadog-agent/issues/1961
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1049
'(/host)?/proc/sys/fs/binfmt_misc$'
]
6 changes: 3 additions & 3 deletions disk/tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_bad_config_string_regex():
assert_regex_equal(c._device_whitelist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._device_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_whitelist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test|(/host)?/proc/sys/fs/binfmt_misc$', IGNORE_CASE))


def test_ignore_empty_regex():
Expand All @@ -58,7 +58,7 @@ def test_ignore_empty_regex():
assert_regex_equal(c._device_whitelist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._device_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_whitelist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test|(/host)?/proc/sys/fs/binfmt_misc$', IGNORE_CASE))


def test_exclude_bad_devices():
Expand Down Expand Up @@ -191,7 +191,7 @@ def test_legacy_config():

assert_regex_equal(c._file_system_blacklist, re.compile('iso9660$|test$', re.I))
assert_regex_equal(c._device_blacklist, re.compile('test1$|test2', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('test', IGNORE_CASE))
assert_regex_equal(c._mount_point_blacklist, re.compile('(/host)?/proc/sys/fs/binfmt_misc$|test', IGNORE_CASE))


def test_legacy_exclude_disk():
Expand Down
3 changes: 2 additions & 1 deletion disk/tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from datadog_checks.base.utils.platform import Platform
from datadog_checks.base.utils.timeout import TimeoutException
from datadog_checks.disk import Disk
from datadog_checks.disk.disk import IGNORE_CASE

from .common import DEFAULT_DEVICE_BASE_NAME, DEFAULT_DEVICE_NAME, DEFAULT_FILE_SYSTEM, DEFAULT_MOUNT_POINT
from .mocks import MockDiskMetrics, MockPart, mock_blkid_output
Expand All @@ -26,7 +27,7 @@ def test_default_options():
assert check._device_whitelist is None
assert check._device_blacklist is None
assert check._mount_point_whitelist is None
assert check._mount_point_blacklist is None
assert check._mount_point_blacklist == re.compile('(/host)?/proc/sys/fs/binfmt_misc$', IGNORE_CASE)
assert check._tag_by_filesystem is False
assert check._device_tag_re == []
assert check._service_check_rw is False
Expand Down