Skip to content

Commit a664d64

Browse files
nicholas-devlinChristineTChendraav
authored
Make max file count configurable in the directory check (#6847)
* Update directory.py I wanted to monitor more than 20 files and expected this setting to be configureable like in our [rabbitmq check](https://github.com/DataDog/integrations-core/blob/master/rabbitmq/datadog_checks/rabbitmq/rabbitmq.py#L183-L187) and the [jmx fetch based integrations](https://github.com/DataDog/jmxfetch/blob/master/src/main/java/org/datadog/jmxfetch/Instance.java#L64) * Update directory/datadog_checks/directory/directory.py forgot self when referencing the max constant in the default value Co-authored-by: Christine Chen <[email protected]> * remove extra space Co-authored-by: Christine Chen <[email protected]> Co-authored-by: draav <[email protected]>
1 parent f825044 commit a664d64

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

directory/datadog_checks/directory/directory.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def check(self, instance):
5454
ignore_missing = is_affirmative(instance.get('ignore_missing', False))
5555
follow_symlinks = is_affirmative(instance.get('follow_symlinks', True))
5656
custom_tags = instance.get('tags', [])
57+
max_filegauge_count = instance.get('max_filegauge_count', self.MAX_FILEGAUGE_COUNT)
5758

5859
if not exists(abs_directory):
5960
msg = (
@@ -79,6 +80,7 @@ def check(self, instance):
7980
follow_symlinks,
8081
countonly,
8182
custom_tags,
83+
max_filegauge_count,
8284
)
8385

8486
def _get_stats(
@@ -95,12 +97,13 @@ def _get_stats(
9597
follow_symlinks,
9698
countonly,
9799
tags,
100+
max_filegauge_count,
98101
):
99102
dirtags = ['{}:{}'.format(dirtagname, name)]
100103
dirtags.extend(tags)
101104
directory_bytes = 0
102105
directory_files = 0
103-
max_filegauge_balance = self.MAX_FILEGAUGE_COUNT
106+
max_filegauge_balance = max_filegauge_count
104107

105108
# If we do not want to recursively search sub-directories only get the root.
106109
walker = walk(directory, follow_symlinks) if recursive else (next(walk(directory, follow_symlinks)),)

0 commit comments

Comments
 (0)