Skip to content

Commit

Permalink
Merge pull request #6 from jordiprats/master
Browse files Browse the repository at this point in the history
cleanup
  • Loading branch information
jordiprats authored Jul 20, 2018
2 parents d47d211 + f7fd13a commit d24aa24
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This module is intended to disable snmpd

* snmpd package
* snmpd service
*

### Setup Requirements

This module requires pluginsync enabled
Expand Down
4 changes: 0 additions & 4 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# == Class: snmpd
#
# === snmpd::config documentation
#
class snmpd::config inherits snmpd {

if($snmpd::manage_package and $snmpd::package_ensure!='absent')
Expand Down
15 changes: 11 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# == Class: snmpd
#
# === snmpd documentation
#
# @param manage_package Selects if this puppet module manages the package (default: true)
# @param package_ensure What state the package should be in (default: installed)
# @param manage_service controls whether service definition should be managed by Puppet (default: true)
# @param manage_docker_service controls whether service definition should be managed by Puppet in a docker container (default: true)
# @param service_ensure Whether a service should be running. Valid values are stopped (also called false), running (default: running)
# @param service_enable Whether a service should be enabled to start at boot
# @param comunity SNMP comunity (default: public)
# @param subtree subtrees to publish (default: '.1.3.6.1.2.1.1', '.1.3.6.1.2.1.25.1.1')
# @param allowed_hosts list of allowed hosts
# @param syslocation System contact information: location (default: somewhere)
# @param syscontact System contact information: contact (default: someone)
class snmpd (
$manage_package = true,
$package_ensure = 'installed',
Expand Down
4 changes: 0 additions & 4 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# == Class: snmpd
#
# === snmpd::install documentation
#
class snmpd::install inherits snmpd {

if($snmpd::manage_package)
Expand Down
1 change: 0 additions & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class snmpd::service inherits snmpd {

#
validate_bool($snmpd::manage_docker_service)
validate_bool($snmpd::manage_service)
Expand Down
22 changes: 11 additions & 11 deletions templates/snmpdconf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
###############################################################################

####
# First, map the community name "public" into a "security name"
# First, map the community name into a "security name"

# sec.name source community
<% @allowed_hosts.each do | val | -%>
Expand All @@ -29,7 +29,7 @@ group notConfigGroup v2c notConfigUser
####
# Third, create a view for us to let the group have rights to:

# Make at least snmpwalk -v 1 localhost -c public system fast again.
# Make at least snmpwalk -v 1 localhost -c <%= @community %> system fast again.
# name incl/excl subtree mask(optional)
<% @subtree.each do | val | -%>
view systemview included <%= val %>
Expand All @@ -53,7 +53,7 @@ syslocation <%= @syslocation %>
syscontact <%= @syscontact %>

# Example output of snmpwalk:
# % snmpwalk -v 1 localhost -c public system
# % snmpwalk -v 1 localhost -c <%= @community %> system
# system.sysDescr.0 = "SunOS name sun4c"
# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4
# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55
Expand Down Expand Up @@ -104,7 +104,7 @@ dontLogTCPWrappersConnects yes

# A snmpwalk of the process mib tree would look something like this:
#
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.2
# % snmpwalk -v 1 localhost -c <%= @community %> .1.3.6.1.4.1.2021.2
# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1
# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2
# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3
Expand Down Expand Up @@ -175,7 +175,7 @@ dontLogTCPWrappersConnects yes
#exec shelltest /bin/sh /tmp/shtest

# Then,
# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8
# % snmpwalk -v 1 localhost -c <%= @community %> .1.3.6.1.4.1.2021.8
# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1
# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2
# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest"
Expand Down Expand Up @@ -212,7 +212,7 @@ dontLogTCPWrappersConnects yes

#disk / 10000

# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9
# % snmpwalk -v 1 localhost -c <%= @community %> .1.3.6.1.4.1.2021.9
# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0
# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F
# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0"
Expand Down Expand Up @@ -241,7 +241,7 @@ dontLogTCPWrappersConnects yes
# Check for loads:
#load 12 14 14

# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.10
# % snmpwalk -v 1 localhost -c <%= @community %> .1.3.6.1.4.1.2021.10
# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1
# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2
# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3
Expand Down Expand Up @@ -284,7 +284,7 @@ dontLogTCPWrappersConnects yes
#
# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest

# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50
# % snmpwalk -v 1 localhost -c <%= @community %> .1.3.6.1.4.1.2021.50
# enterprises.ucdavis.50.1.1 = 1
# enterprises.ucdavis.50.2.1 = "shelltest"
# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest"
Expand Down Expand Up @@ -327,7 +327,7 @@ dontLogTCPWrappersConnects yes

# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/local/passtest

# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255
# % snmpwalk -v 1 localhost -c <%= @community %> .1.3.6.1.4.1.2021.255
# enterprises.ucdavis.255.1 = "life the universe and everything"
# enterprises.ucdavis.255.2.1 = 42
# enterprises.ucdavis.255.2.2 = OID: 42.42.42
Expand All @@ -336,10 +336,10 @@ dontLogTCPWrappersConnects yes
# enterprises.ucdavis.255.5 = 42
# enterprises.ucdavis.255.6 = Gauge: 42
#
# % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5
# % snmpget -v 1 localhost <%= @community %> .1.3.6.1.4.1.2021.255.5
# enterprises.ucdavis.255.5 = 42
#
# % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string"
# % snmpset -v 1 localhost <%= @community %> .1.3.6.1.4.1.2021.255.1 s "New string"
# enterprises.ucdavis.255.1 = "New string"
#

Expand Down

0 comments on commit d24aa24

Please sign in to comment.