Puppet Class: datadog_agent::integrations::snmp

Inherits:
datadog_agent::params
Defined in:
manifests/integrations/snmp.pp

Overview

Parameters:

  • mibs_folder (Any) (defaults to: undef)
  • ignore_nonincreasing_oid (Any) (defaults to: false)
  • init_config (Any) (defaults to: {})
  • instances (Any) (defaults to: [])
  • snmp_v1_instances (Any) (defaults to: [])
  • snmp_v2_instances (Any) (defaults to: [])
  • snmp_v3_instances (Any) (defaults to: [])


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'manifests/integrations/snmp.pp', line 54

class datadog_agent::integrations::snmp (
  $mibs_folder              = undef,
  $ignore_nonincreasing_oid = false,
  $init_config              = {},
  $instances                = [],
  $snmp_v1_instances        = [],
  $snmp_v2_instances        = [],
  $snmp_v3_instances        = [],
) inherits datadog_agent::params {
  require ::datadog_agent

  $versioned_instances = {
    1 => $snmp_v1_instances,
    2 => $snmp_v2_instances,
    3 => $snmp_v3_instances,
  }

  $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/snmp.yaml"
  if $::datadog_agent::_agent_major_version > 5 {
    $dst_dir = "${datadog_agent::params::conf_dir}/snmp.d"
    file { $legacy_dst:
      ensure => 'absent'
    }

    file { $dst_dir:
      ensure  => directory,
      owner   => $datadog_agent::params::dd_user,
      group   => $datadog_agent::params::dd_group,
      mode    => $datadog_agent::params::permissions_directory,
      require => Package[$datadog_agent::params::package_name],
      notify  => Service[$datadog_agent::params::service_name]
    }
    $dst = "${dst_dir}/conf.yaml"
  } else {
    $dst = $legacy_dst
  }

  file { $dst:
    ensure  => file,
    owner   => $datadog_agent::params::dd_user,
    group   => $datadog_agent::params::dd_group,
    mode    => $datadog_agent::params::permissions_protected_file,
    content => template('datadog_agent/agent-conf.d/snmp.yaml.erb'),
    require => Package[$datadog_agent::params::package_name],
    notify  => Service[$datadog_agent::params::service_name]
  }
}