-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathdirectory.pp
More file actions
49 lines (46 loc) · 1.47 KB
/
directory.pp
File metadata and controls
49 lines (46 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Class: datadog_agent::integrations::directory
#
# This class will install the necessary config to hook the directory check
#
# Parameters:
# $directory
# The directory to gather stats for
# $tag_name
# The name used to tag the metrics (directory alias)
# $pattern
# The `fnmatch` pattern to use when reading the "directory"'s files. default "*"
# $recursive
# Boolean, when true the stats will recurse into directories
#
# Sample Usage:
#
# class { 'datadog_agent::integrations::directory' :
# directory => '/mnt/media',
# tag_name => 'name',
# pattern => '*',
# recursive => true,
# }
class datadog_agent::integrations::directory (
$directory = undef,
$tag_name = '',
$pattern = '*',
$recursive = false
) inherits datadog_agent::params {
if $directory == undef {
fail('you must specify a directory path within the datadog_agent::integrations::directory class')
}
if $::datadog_agent::agent6_enable {
$dst = "${datadog_agent::conf6_dir}/directory.yaml"
} else {
$dst = "${datadog_agent::conf_dir}/directory.yaml"
}
file { $dst:
ensure => file,
owner => $datadog_agent::params::dd_user,
group => $datadog_agent::params::dd_group,
mode => '0600',
content => template('datadog_agent/agent-conf.d/directory.yaml.erb'),
require => Package[$datadog_agent::params::package_name],
notify => Service[$datadog_agent::params::service_name]
}
}