|
| 1 | +# Class: datadog_agent::integrations::disk |
| 2 | +# |
| 3 | +# This class will install the necessary config to hook the disk check |
| 4 | +# |
| 5 | +# Parameters: |
| 6 | +# $use_mount |
| 7 | +# The use_mount parameter will instruct the check to collect disk |
| 8 | +# and fs metrics using mount points instead of volumes. |
| 9 | +# values: yes, no (Boolean, default: no) |
| 10 | +# $excluded_filesystems |
| 11 | +# The filesystems you wish to exclude, example: tmpfs, run (string or array) |
| 12 | +# $excluded_disks |
| 13 | +# The disks you (optional) wish to exclude, example: /dev/sda (string or array) |
| 14 | +# $excluded_disk_re |
| 15 | +# Regular expression (optional) to exclude disks, eg: /dev/sde.* |
| 16 | +# $excluded_mountpoint_re |
| 17 | +# Regular expression (optional) to exclude mountpoints, eg: /mnt/somebody-elses-problem.* |
| 18 | +# $all_partitions |
| 19 | +# The (optional) all_partitions parameter will instruct the check to |
| 20 | +# get metrics for all partitions. use_mount should be set to yes (to avoid |
| 21 | +# collecting empty device names) when using this option. |
| 22 | +# $tag_by_filesystem |
| 23 | +# The (optional) tag_by_filesystem parameter will instruct the check to |
| 24 | +# tag all disks with their filesystem (for ex: filesystem:nfs) |
| 25 | +# valuse: yes, no (Boolean, default: no) |
| 26 | +# |
| 27 | +# Sample Usage: |
| 28 | +# |
| 29 | +# class { 'datadog_agent::integrations::disk' : |
| 30 | +# use_mount => 'yes', |
| 31 | +# excluded_filesystems => '/dev/tmpfs', |
| 32 | +# excluded_disk_re => '/dev/sd[e-z]*' |
| 33 | +# } |
| 34 | +class datadog_agent::integrations::disk ( |
| 35 | + $use_mount = 'no', |
| 36 | + $excluded_filesystems = undef, |
| 37 | + $excluded_disks = undef, |
| 38 | + $excluded_disk_re = undef, |
| 39 | + $excluded_mountpoint_re = undef, |
| 40 | + $all_partitions = undef, |
| 41 | + $tag_by_filesystem = undef |
| 42 | +) inherits datadog_agent::params { |
| 43 | + include datadog_agent |
| 44 | + |
| 45 | + validate_re($use_mount, '^(no|yes)$', "use_mount should be either 'yes' or 'no'") |
| 46 | + if $all_partitions { |
| 47 | + validate_re($all_partitions, '^(no|yes)$', "all_partitions should be either 'yes' or 'no'") |
| 48 | + } |
| 49 | + |
| 50 | + file { "${datadog_agent::params::conf_dir}/disk.yaml": |
| 51 | + ensure => file, |
| 52 | + owner => $datadog_agent::params::dd_user, |
| 53 | + group => $datadog_agent::params::dd_group, |
| 54 | + mode => '0600', |
| 55 | + content => template('datadog_agent/agent-conf.d/disk.yaml.erb'), |
| 56 | + require => Package[$datadog_agent::params::package_name], |
| 57 | + notify => Service[$datadog_agent::params::service_name] |
| 58 | + } |
| 59 | +} |
0 commit comments