Showing with 79 additions and 20 deletions.
  1. +3 −1 .fixtures.yml
  2. +4 −12 .travis.yml
  3. +5 −1 README.markdown
  4. +8 −0 manifests/init.pp
  5. +15 −3 manifests/params.pp
  6. +3 −3 metadata.json
  7. +36 −0 spec/classes/snmp_init_spec.rb
  8. +5 −0 templates/snmpd.conf.erb
4 changes: 3 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
stdlib:
repo: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "4.22.0"
symlinks:
snmp: "#{source_dir}"
16 changes: 4 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,16 @@ matrix:
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="no"
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="no"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 4.0"
- rvm: 2.4.1
env: PUPPET_GEM_VERSION="~> 5.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
allow_failures:
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="no"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 4.0"
- rvm: 2.4.1
env: PUPPET_GEM_VERSION="~> 5.0"
notifications:
email:
- github@razorsedge.org
6 changes: 5 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ Default: [ 'notConfigGroup "" any noauth exact systemview none none' ]
Array of dlmod lines to add to the snmpd.conf file. Must provide NAME and PATH (ex. "cmaX /usr/lib64/libcmaX64.so"). See http://www.net-snmp.org/docs/man/snmpd.conf.html#lbBD for details.
Default: []

##### `extends`
Array of extend lines to add to the snmpd.conf file. Must provide NAME, PROG and ARG. See http://www.net-snmp.org/docs/man/snmpd.conf.html#lbBA for details.
Default: []

##### `snmpd_config`
Safety valve. Array of lines to add to the snmpd.conf file. See http://www.net-snmp.org/docs/man/snmpd.conf.html for all options.
Default: []
Expand Down Expand Up @@ -517,7 +521,7 @@ Net-SNMP module support is available with these operating systems:

* RedHat family - tested on CentOS 5.9, CentOS 6.6, and CentOS 7.0
* SuSE family - tested on SLES 11 SP1
* Debian family - tested on Ubuntu 12.04.2 LTS, Debian 6.0.7, and Debian 7.0
* Debian family - tested on Ubuntu 12.04.2 LTS, Debian 6.0.7, Debian 7.0, and Debian 9.
* FreeBSD family - tested on FreeBSD 9.2-RELEASE, FreeBSD 10.0-RELEASE
* OpenBSD family - tested on OpenBSD 5.9

Expand Down
8 changes: 8 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
# See http://www.net-snmp.org/docs/man/snmpd.conf.html#lbBD for details.
# Default: []
#
# [*extends*]
# Array of extend lines to add to the snmpd.conf file.
# Must provide NAME, PROG and ARG.
# See http://www.net-snmp.org/docs/man/snmpd.conf.html#lbBA for details.
# Default: []
#
# [*snmpd_config*]
# Safety valve. Array of lines to add to the snmpd.conf file.
# See http://www.net-snmp.org/docs/man/snmpd.conf.html for all options.
Expand Down Expand Up @@ -308,6 +314,7 @@
$views = $snmp::params::views,
$accesses = $snmp::params::accesses,
$dlmod = $snmp::params::dlmod,
$extends = $snmp::params::extends,
$snmpd_config = $snmp::params::snmpd_config,
$disable_authorization = $snmp::params::disable_authorization,
$do_not_log_traps = $snmp::params::do_not_log_traps,
Expand Down Expand Up @@ -367,6 +374,7 @@
validate_array($views)
validate_array($accesses)
validate_array($dlmod)
validate_array($extends)
validate_array($snmpd_config)
validate_array($snmptrapd_config)

Expand Down
18 changes: 15 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@
$dlmod = []
}

$snmp_extends = getvar('::snmp_extends')
if $snmp_extends {
$extemds = $::snmp_extends
} else {
$extends = []
}

$snmp_disable_authorization = getvar('::snmp_disable_authorization')
if $snmp_disable_authorization {
$disable_authorization = $::snmp_disable_authorization
Expand Down Expand Up @@ -463,17 +470,22 @@
$trap_service_name = 'snmptrapd'
}
'Debian': {
if $::operatingsystem == 'Debian' and $::operatingsystemmajrelease >= '9' {
$varnetsnmp_owner = 'Debian-snmp'
$varnetsnmp_group = 'Debian-snmp'
} else {
$varnetsnmp_owner = 'snmp'
$varnetsnmp_group = 'snmp'
}
$package_name = 'snmpd'
$service_config = '/etc/snmp/snmpd.conf'
$service_config_perms = '0600'
$service_config_dir_group = 'root'
$service_name = 'snmpd'
$snmpd_options = '-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
$snmpd_options = "-Lsd -Lf /dev/null -u ${varnetsnmp_owner} -g ${varnetsnmp_group} -I -smux -p /var/run/snmpd.pid"
$sysconfig = '/etc/default/snmpd'
$var_net_snmp = '/var/lib/snmp'
$varnetsnmp_perms = '0755'
$varnetsnmp_owner = 'snmp'
$varnetsnmp_group = 'snmp'

$client_package_name = 'snmp'
$client_config = '/etc/snmp/snmp.conf'
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "razorsedge-snmp",
"version": "3.8.1",
"version": "3.9.0",
"author": "razorsedge",
"summary": "Simple Network Management Protocol is for monitoring network and computer equipment. Net-SNMP implements v1, v2c, and v3 on both IPv4 and IPv6.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -41,11 +41,11 @@
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [ "6", "7" ]
"operatingsystemrelease": [ "6", "7", "8", "9" ]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [ "12.04", "14.04" ]
"operatingsystemrelease": [ "12.04", "14.04", "16.04" ]
}
],
"requirements": [
Expand Down
36 changes: 36 additions & 0 deletions spec/classes/snmp_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,16 @@
end
end

describe 'extends => [ "SomeArray1", "SomeArray2" ]' do
let(:params) {{ :extends => [ 'SomeArray1', 'SomeArray2' ] }}
it 'should contain File[snmpd.conf] with contents from array' do
verify_contents(catalogue, 'snmpd.conf', [
'extend SomeArray1',
'extend SomeArray2',
])
end
end

describe 'openmanage_enable => true' do
let(:params) {{ :openmanage_enable => true }}
it 'should contain File[snmpd.conf] with contents "smuxpeer .1.3.6.1.4.1.674.10892.1"' do
Expand Down Expand Up @@ -1062,6 +1072,32 @@
end
end

context 'on a supported osfamily (Debian Stretch), custom parameters' do
let :facts do {
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:lsbmajdistrelease => '9',
:operatingsystemmajrelease => '9'
}
end

describe 'service_ensure => stopped and trap_service_ensure => running' do
let :params do {
:service_ensure => 'stopped',
:trap_service_ensure => 'running'
}
end
end

describe 'Debian-snmp as snmp user' do
it 'should contain File[snmpd.sysconfig] with contents "OPTIONS="-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux -p /var/run/snmpd.pid""' do
verify_contents(catalogue, 'snmpd.sysconfig', [
'SNMPDOPTS=\'-Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux -p /var/run/snmpd.pid\'',
])
end
end
end

context 'on a supported osfamily (Suse), custom parameters' do
let :facts do {
:osfamily => 'Suse',
Expand Down
5 changes: 5 additions & 0 deletions templates/snmpd.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ sysName <%= @sysname %>

################################################################################
# EXTENDING AGENT FUNCTIONALITY
<% if @extends.any? -%>
<% @extends.each do |extending| -%>
extend <%= extending %>
<% end -%>
<% end -%>
<% if @dlmod.any? -%>
# ------------------------------------------------------------------------------
Expand Down