Initial version of snmp module.
This commit is contained in:
parent
7bd26f33d3
commit
4ee0691e63
3 changed files with 88 additions and 0 deletions
71
snmp/manifests/init.pp
Normal file
71
snmp/manifests/init.pp
Normal file
|
@ -0,0 +1,71 @@
|
|||
|
||||
# Install net-snmp utilities
|
||||
#
|
||||
class snmp::utils {
|
||||
|
||||
package { "net-snmp":
|
||||
name => $::operatingsystem ? {
|
||||
"openbsd" => "net-snmp",
|
||||
default => "net-snmp-utils",
|
||||
},
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Install snmp trap daemon
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $acl:
|
||||
# Array containing list of allowed SNMP community names.
|
||||
# Defaults is to allow all trap messages.
|
||||
#
|
||||
# === Sample usage
|
||||
#
|
||||
# class { "snmp::trapd":
|
||||
# acl => [ "public", ],
|
||||
# }
|
||||
#
|
||||
class snmp::trapd($acl=NONE) {
|
||||
|
||||
require snmp::utils
|
||||
include user::system
|
||||
|
||||
realize([ User["snmptrapd"], Group["snmptrapd"], ])
|
||||
|
||||
case $::operatingsystem {
|
||||
"openbsd": {
|
||||
file { "/etc/rc.d/snmptrapd":
|
||||
ensure => present,
|
||||
source => "puppet:///modules/snmp/snmptrapd.rc",
|
||||
mode => "0755",
|
||||
owner => "root",
|
||||
group => "wheel",
|
||||
notify => Service["snmptrapd"],
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("snmp::trapd not supported in ${::operatingsystem}")
|
||||
}
|
||||
}
|
||||
|
||||
file { "/etc/snmptrapd.conf":
|
||||
ensure => present,
|
||||
content => template("snmp/snmptrapd.conf.erb"),
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => $::operatingsystem ? {
|
||||
"openbsd" => "wheel",
|
||||
default => "root",
|
||||
},
|
||||
notify => Service["snmptrapd"],
|
||||
}
|
||||
|
||||
service { "snmptrapd":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => User["snmptrapd"],
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue