Skip to content

Commit a1581be

Browse files
Merge branch 'master' into fernandorodriguezcdatadog-patch-1
2 parents f83412e + 5735a60 commit a1581be

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

nfsstat/assets/configuration/spec.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ files:
2323
- template: init_config/default
2424
- template: instances
2525
options:
26+
- name: disable_missing_mountpoints_warning
27+
required: false
28+
description: |
29+
If false, no warning is logged if host has check enabled but no NFS mount point is found.
30+
value:
31+
type: boolean
32+
default: false
33+
example: false
2634
- template: instances/default
2735
- template: logs
2836
example:

nfsstat/changelog.d/19916.added

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
+ Add option to disable missing mountpoints warning

nfsstat/datadog_checks/nfsstat/config_models/defaults.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def instance_disable_generic_tags():
1616
return False
1717

1818

19+
def instance_disable_missing_mountpoints_warning():
20+
return False
21+
22+
1923
def instance_empty_default_hostname():
2024
return False
2125

nfsstat/datadog_checks/nfsstat/config_models/instance.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class InstanceConfig(BaseModel):
3535
frozen=True,
3636
)
3737
disable_generic_tags: Optional[bool] = None
38+
disable_missing_mountpoints_warning: Optional[bool] = None
3839
empty_default_hostname: Optional[bool] = None
3940
metric_patterns: Optional[MetricPatterns] = None
4041
min_collection_interval: Optional[float] = None

nfsstat/datadog_checks/nfsstat/data/conf.yaml.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ init_config:
2727
instances:
2828

2929
-
30+
## @param disable_missing_mountpoints_warning - boolean - optional - default: false
31+
## If false, no warning is logged if host has check enabled but no NFS mount point is found.
32+
#
33+
# disable_missing_mountpoints_warning: false
34+
3035
## @param tags - list of strings - optional
3136
## A list of tags to attach to every metric and service check emitted by this instance.
3237
##

nfsstat/datadog_checks/nfsstat/nfsstat.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def __init__(self, name, init_config, instances):
3131
'(through nfs-utils) or set the path to the installed version'
3232
)
3333
self.autofs_enabled = is_affirmative(init_config.get('autofs_enabled', False))
34+
self.disable_missing_mountpoints_warning = is_affirmative(
35+
self.instance.get('disable_missing_mountpoints_warning', False)
36+
)
3437

3538
def check(self, instance):
3639
stat_out, err, _ = get_subprocess_output(self.nfs_cmd, self.log)
@@ -41,7 +44,8 @@ def check(self, instance):
4144

4245
if 'No NFS mount point' in stats[0]:
4346
if not self.autofs_enabled:
44-
self.warning("No NFS mount points were found.")
47+
if not self.disable_missing_mountpoints_warning:
48+
self.warning("No NFS mount points were found.")
4549
else:
4650
self.log.debug("AutoFS enabled: no mount points currently.")
4751
return

0 commit comments

Comments
 (0)