Skip to content

Commit

Permalink
initial publication
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoneycutt committed Jun 28, 2010
0 parents commit 59adf16
Show file tree
Hide file tree
Showing 23 changed files with 376 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name 'ghoneycutt-snmp'
version '1.0.0'

dependency 'ghoneycutt/lsbprovider', '>= 1.0.0'
6 changes: 6 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
snmp

Released 20100628 - Garrett Honeycutt - GPLv2

This is the snmp module for managing snmp clients. The given template
is a good starting point, though you will need to modify the network locations.
16 changes: 16 additions & 0 deletions files/scripts/postfix_procs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# This file is being maintained by Puppet.
# DO NOT EDIT

# 14 Dec 2007 - Garrett Honeycutt - [email protected]
#
# released under GPL
#
# returns number of 'master' processes running
#
# there should be one process if postfix is operating correctly
#

masterProcsAmount=`/usr/local/bin/check_procs -C master -c 1:1 | /usr/bin/awk '{print $3}'`
echo $masterProcsAmount
exit $masterProcsAmount
16 changes: 16 additions & 0 deletions files/scripts/stopped_procs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# This file is being maintained by Puppet.
# DO NOT EDIT

# 5 Dec 2007 - Garrett Honeycutt - [email protected]
#
# released under GPL
#
# returns number of stopped/traced processes running
#
# note: the 'sched' process is always in state T, so on Solaris this should
# always return 1 and under linux this should always return 0

stoppedProcsAmount=`/usr/local/bin/check_procs -s T | /usr/bin/awk '{print $3}'`
echo $stoppedProcsAmount
exit $stoppedProcsAmount
9 changes: 9 additions & 0 deletions files/scripts/zombie_procs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# This file is being maintained by Puppet.
# DO NOT EDIT

# returns number of zombie processes running

zombieProcsAmount=`/usr/local/bin/check_procs -s Z | /usr/bin/awk '{print $3}'`
echo $zombieProcsAmount
exit $zombieProcsAmount
40 changes: 40 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Class: snmp
#
# This module manages snmp and is included by the generic module
# to be applied to *ALL* nodes
#
# Requires:
# class snmp::files
# class lsbprovider::files
# $snmpSyslocation must be set in site manifest, ie "$snmpSyslocation = "CompanyX NOC"
# $contactEmail must be set in site manifest
#
class snmp {

include snmp::files

package { "net-snmp": }

file { "/etc/snmp/snmpd.conf":
content => template("snmp/snmpd.conf.erb"),
notify => Service["snmpd"],
require => [ Class["snmp::files"], Package["net-snmp"] ],
} # file

service { "snmpd":
enable => true,
ensure => running,
require => Package["net-snmp"],
} # service
} # class snmp

#
# Grab snmpd helper scripts
#
class snmp::files inherits lsbprovider::files {

File["/opt/$lsbProvider/bin"] {
source +> ["puppet:///modules/snmp/scripts/","puppet:///modules/snmp/binaries/$platform"],
sourceselect => all,
}
} # class snmp::files
12 changes: 12 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
+-----------------------------------------------------------------------+
| |
| ==> DO NOT EDIT THIS FILE! <== |
| |
| You should edit the `Modulefile` and run `puppet-module build` |
| to generate the `metadata.json` file for your releases. |
| |
+-----------------------------------------------------------------------+
*/

{}
Binary file added pkg/ghoneycutt-snmp-1.0.0.tar.gz
Binary file not shown.
4 changes: 4 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/Modulefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name 'ghoneycutt-snmp'
version '1.0.0'

dependency 'ghoneycutt/lsbprovider', '>= 1.0.0'
6 changes: 6 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
snmp

Released 20100628 - Garrett Honeycutt - GPLv2

This is the snmp module for managing snmp clients. The given template
is a good starting point, though you will need to modify the network locations.
16 changes: 16 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/files/scripts/postfix_procs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# This file is being maintained by Puppet.
# DO NOT EDIT

# 14 Dec 2007 - Garrett Honeycutt - [email protected]
#
# released under GPL
#
# returns number of 'master' processes running
#
# there should be one process if postfix is operating correctly
#

masterProcsAmount=`/usr/local/bin/check_procs -C master -c 1:1 | /usr/bin/awk '{print $3}'`
echo $masterProcsAmount
exit $masterProcsAmount
16 changes: 16 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/files/scripts/stopped_procs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# This file is being maintained by Puppet.
# DO NOT EDIT

# 5 Dec 2007 - Garrett Honeycutt - [email protected]
#
# released under GPL
#
# returns number of stopped/traced processes running
#
# note: the 'sched' process is always in state T, so on Solaris this should
# always return 1 and under linux this should always return 0

stoppedProcsAmount=`/usr/local/bin/check_procs -s T | /usr/bin/awk '{print $3}'`
echo $stoppedProcsAmount
exit $stoppedProcsAmount
9 changes: 9 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/files/scripts/zombie_procs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# This file is being maintained by Puppet.
# DO NOT EDIT

# returns number of zombie processes running

zombieProcsAmount=`/usr/local/bin/check_procs -s Z | /usr/bin/awk '{print $3}'`
echo $zombieProcsAmount
exit $zombieProcsAmount
40 changes: 40 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Class: snmp
#
# This module manages snmp and is included by the generic module
# to be applied to *ALL* nodes
#
# Requires:
# class snmp::files
# class lsbprovider::files
# $snmpSyslocation must be set in site manifest, ie "$snmpSyslocation = "CompanyX NOC"
# $contactEmail must be set in site manifest
#
class snmp {

include snmp::files

package { "net-snmp": }

file { "/etc/snmp/snmpd.conf":
content => template("snmp/snmpd.conf.erb"),
notify => Service["snmpd"],
require => [ Class["snmp::files"], Package["net-snmp"] ],
} # file

service { "snmpd":
enable => true,
ensure => running,
require => Package["net-snmp"],
} # service
} # class snmp

#
# Grab snmpd helper scripts
#
class snmp::files inherits lsbprovider::files {

File["/opt/$lsbProvider/bin"] {
source +> ["puppet:///modules/snmp/scripts/","puppet:///modules/snmp/binaries/$platform"],
sourceselect => all,
}
} # class snmp::files
26 changes: 26 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "1.0.0",
"dependencies": [
{
"version_requirement": ">= 1.0.0",
"name": "ghoneycutt/lsbprovider"
}
],
"name": "ghoneycutt-snmp",
"checksums": {
"templates/snmpd.conf.erb": "9dce86b17b9e4de7dfaf04eafeffa40a",
"spec/spec_helper.rb": "ca19ec4f451ebc7fdb035b52eae6e909",
"files/scripts/postfix_procs": "6da078317b0acdad7d72b8eee6b956af",
"README": "f1ca34a4b952c79c97e4dfcab22c645e",
"files/scripts/zombie_procs": "df67d40c7faf6215619298aa39f2c6fa",
"files/scripts/stopped_procs": "41ec6392ee6a75f3f94f583198354e23",
"tests/init.pp": "27ab1c2c08d9d088d84e6927d906c169",
"spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c",
"metadata.json": "d34d0b70aba36510fbc2df4e667479ef",
"Modulefile": "2a54c23fe1b7ce292d26e6a906a9e09e",
"manifests/init.pp": "f7d3c02431cc4b169ae155de36a55a7e"
},
"types": [

]
}
6 changes: 6 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/spec/spec.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--format
s
--colour
--loadby
mtime
--backtrace
18 changes: 18 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'pathname'
dir = Pathname.new(__FILE__).parent
$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')

require 'mocha'
require 'puppet'
gem 'rspec', '=1.2.9'
require 'spec/autorun'

Spec::Runner.configure do |config|
config.mock_with :mocha
end

# We need this because the RAL uses 'should' as a method. This
# allows us the same behaviour but with a different method name.
class Object
alias :must :should
end
53 changes: 53 additions & 0 deletions pkg/ghoneycutt-snmp-1.0.0/templates/snmpd.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file is being maintained by Puppet.
# DO NOT EDIT

###############################################################################
# Access Control
###############################################################################

# Sources
# sec.name source community
com2sec local localhost public
com2sec <%= lsbProvider %> localhost <%= lsbProvider %>
com2sec <%= lsbProvider %> 10.1.0.0/16 <%= lsbProvider %>

# Security mappings
group MyROGroup v2c local
group MyROGroup v2c <%= lsbProvider %>

# Views
# incl/excl subtree mask
view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system
view sysView included system

# Access levels
# context sec.model sec.level match read write notif
access MyROGroup "" any noauth exact all none none

###############################################################################
# System contact information
###############################################################################

syslocation <%= snmpSyslocation %>
syscontact Root <<%= contactEmail %>>

###############################################################################
# disk checks
###############################################################################

# disk checks - "alarm" at 80% full
disk / 20%
disk /boot 20%
disk /data 20%

###############################################################################
# load average checks
###############################################################################

# Check for loads:
load 10 10 10

###############################################################################
# Extensible sections.
###############################################################################
1 change: 1 addition & 0 deletions pkg/ghoneycutt-snmp-1.0.0/tests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include snmp
6 changes: 6 additions & 0 deletions spec/spec.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--format
s
--colour
--loadby
mtime
--backtrace
18 changes: 18 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'pathname'
dir = Pathname.new(__FILE__).parent
$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')

require 'mocha'
require 'puppet'
gem 'rspec', '=1.2.9'
require 'spec/autorun'

Spec::Runner.configure do |config|
config.mock_with :mocha
end

# We need this because the RAL uses 'should' as a method. This
# allows us the same behaviour but with a different method name.
class Object
alias :must :should
end
53 changes: 53 additions & 0 deletions templates/snmpd.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file is being maintained by Puppet.
# DO NOT EDIT

###############################################################################
# Access Control
###############################################################################

# Sources
# sec.name source community
com2sec local localhost public
com2sec <%= lsbProvider %> localhost <%= lsbProvider %>
com2sec <%= lsbProvider %> 10.1.0.0/16 <%= lsbProvider %>

# Security mappings
group MyROGroup v2c local
group MyROGroup v2c <%= lsbProvider %>

# Views
# incl/excl subtree mask
view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system
view sysView included system

# Access levels
# context sec.model sec.level match read write notif
access MyROGroup "" any noauth exact all none none

###############################################################################
# System contact information
###############################################################################

syslocation <%= snmpSyslocation %>
syscontact Root <<%= contactEmail %>>

###############################################################################
# disk checks
###############################################################################

# disk checks - "alarm" at 80% full
disk / 20%
disk /boot 20%
disk /data 20%

###############################################################################
# load average checks
###############################################################################

# Check for loads:
load 10 10 10

###############################################################################
# Extensible sections.
###############################################################################
1 change: 1 addition & 0 deletions tests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include snmp

0 comments on commit 59adf16

Please sign in to comment.