Puppet Class: snmpd::utils

Defined in:
manifests/utils.pp

Overview

Class: snmpd::utils

Set up the framework and clients for the SNMP utilities. This can be used without the server, but it isn’t very common.

See snmpcmd(1) for additional details.

Parameters

Authors

Parameters:

  • rsync_server (Any) (defaults to: hiera('rsync::server'))
  • rsync_timeout (Any) (defaults to: hiera('rsync::timeout','2'))


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
50
51
52
53
54
55
56
57
# File 'manifests/utils.pp', line 14

class snmpd::utils (
  $rsync_server = hiera('rsync::server'),
  $rsync_timeout = hiera('rsync::timeout','2')
){
  include 'rsync'

  package { 'net-snmp-utils': ensure => 'latest' }

  exec { 'set_snmp_perms':
    command => '/usr/bin/setfacl -R -m g:snmp:r /etc/snmp /usr/local/share/snmp',
    onlyif  => '/bin/grep -q "^snmp" /etc/group',
    require => Package['net-snmp-utils']
  }

  file { '/etc/snmp/snmp.local.conf':
    owner   => 'root',
    group   => 'root',
    mode    => '0640',
    notify  => Exec['set_snmp_perms'],
    require => Package['net-snmp-utils']
  }

  # This directory will be where items pulled from rsync will go.
  file { '/usr/local/share/snmp':
    ensure  => 'directory',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    require => Package['net-snmp-utils']
  }

  # This pulls down all custom mibs from the rsync server.
  rsync { 'snmp_mibs':
    source       => 'snmp/mibs',
    target       => '/usr/local/share/snmp',
    server       => $rsync_server,
    timeout      => $rsync_timeout,
    delete       => true,
    preserve_acl => false,
    notify       => Exec['set_snmp_perms']
  }

  validate_integer($rsync_timeout)
}