Puppet Class: librenms::snmp
- Defined in:
- manifests/snmp.pp
Summary
Manages all SNMP resourcesOverview
Manages all SNMP resources
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 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'manifests/snmp.pp', line 7
class librenms::snmp {
$_contact = $librenms::snmp_contact ? {
undef => $librenms::config_admin_email,
default => $librenms::snmp_contact,
}
if empty($librenms::snmp_trap_mib_dirs) {
$mib_dirs = "${librenms::vcs_root_dir}/mibs"
}
else {
$mib_dirs = join($librenms::snmp_trap_mib_dirs, ':')
}
class { 'snmp':
autoupgrade => true,
contact => $_contact,
ensure => $librenms::snmp_package_ensure,
location => $librenms::snmp_location,
manage_client => true,
ro_community => $librenms::snmp_ro_community,
# trapd config: https://docs.librenms.org/Extensions/SNMP-Trap-Handler/
trap_service_enable => $librenms::snmp_trap_enabled,
trap_service_ensure => $librenms::snmp_trap_ensure,
trap_handlers => [
"default ${librenms::vcs_root_dir}/snmptrap.php",
],
disable_authorization => 'yes',
}
file { '/etc/systemd/system/snmptrapd.service.d/':
ensure => 'directory',
owner => 'root',
group => 'root',
}
file { '/etc/systemd/system/snmptrapd.service.d/mibs.conf':
ensure => 'file',
owner => 'root',
group => 'root',
content => @("CONTENT"/L),
[Service]
Environment=MIBDIRS=+${mib_dirs}
Environment=MIBS=+${join($librenms::snmp_trap_mibs, ':')}
| CONTENT
}
exec { 'librenms_snmptrapd_reload':
command => '/bin/systemctl daemon-reload',
refreshonly => true,
subscribe => File['/etc/systemd/system/snmptrapd.service.d/mibs.conf'],
notify => Service['snmptrapd']
}
}
|