summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2010-07-01 04:43:09 +0200
committermh <mh@immerda.ch>2010-07-01 04:43:09 +0200
commite7d23dabf191c5416197af0b229fc90b94539405 (patch)
treebf9d1f220eb8c0ef176529e2ab18717618e4ee14 /manifests
parentd63bc7ba3edc39e2fe7dbbefd87edac45176b13b (diff)
parentf1586a7fbcc79fee6542790b1f4c930929af7e04 (diff)
merge with lavamind
Diffstat (limited to 'manifests')
-rw-r--r--manifests/client.pp12
-rw-r--r--manifests/client/base.pp14
-rw-r--r--manifests/client/centos.pp2
-rw-r--r--manifests/client/darwin.pp38
-rw-r--r--manifests/client/debian.pp18
-rw-r--r--manifests/client/gentoo.pp4
-rw-r--r--manifests/client/package.pp8
-rw-r--r--manifests/host.pp16
-rw-r--r--manifests/init.pp10
-rw-r--r--manifests/plugin.pp52
-rw-r--r--manifests/plugin/scriptpaths.pp12
-rw-r--r--manifests/plugins/debian.pp2
-rw-r--r--manifests/plugins/interfaces.pp6
-rw-r--r--manifests/plugins/linux.pp8
-rw-r--r--manifests/plugins/nagios.pp20
-rw-r--r--manifests/plugins/vserver.pp4
-rw-r--r--manifests/register.pp43
-rw-r--r--manifests/register/snmp.pp22
-rw-r--r--manifests/register_snmp.pp21
-rw-r--r--manifests/remoteplugin.pp26
-rw-r--r--manifests/snmp_collector.pp22
21 files changed, 179 insertions, 181 deletions
diff --git a/manifests/client.pp b/manifests/client.pp
index 24d84da..273070d 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -5,12 +5,12 @@
class munin::client inherits munin {
- $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port }
- $munin_host_real = $munin_host ? {
- '' => '*',
- 'fqdn' => '*',
- default => $munin_host
- }
+ $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port }
+ $munin_host_real = $munin_host ? {
+ '' => '*',
+ 'fqdn' => '*',
+ default => $munin_host
+ }
case $operatingsystem {
openbsd: { include munin::client::openbsd }
diff --git a/manifests/client/base.pp b/manifests/client/base.pp
index b3fcc4a..17387e8 100644
--- a/manifests/client/base.pp
+++ b/manifests/client/base.pp
@@ -1,6 +1,6 @@
class munin::client::base {
service { 'munin-node':
- ensure => running,
+ ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
@@ -14,10 +14,12 @@ class munin::client::base {
default => $munin_allow
}
file {'/etc/munin/munin-node.conf':
- content => template("munin/munin-node.conf.$operatingsystem"),
+ content => template("munin/munin-node.conf.$operatingsystem"),
notify => Service['munin-node'],
- mode => 0644, owner => root, group => 0,
- }
- munin::register { $fqdn: }
- include munin::plugins::base
+ mode => 0644, owner => root, group => 0,
+ }
+ munin::register { $fqdn:
+ config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'],
+ }
+ include munin::plugins::base
}
diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp
index 46a7e3f..42e8c59 100644
--- a/manifests/client/centos.pp
+++ b/manifests/client/centos.pp
@@ -1,3 +1,3 @@
class munin::client::centos inherits munin::client::package {
- include munin::plugins::centos
+ include munin::plugins::centos
}
diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp
index f6fc95f..369a605 100644
--- a/manifests/client/darwin.pp
+++ b/manifests/client/darwin.pp
@@ -1,21 +1,21 @@
class munin::client::darwin {
- file { "/usr/share/snmp/snmpd.conf":
- mode => 744,
- content => template("munin/darwin_snmpd.conf.erb"),
- group => 0,
- owner => root,
- }
- delete_matching_line{"startsnmpdno":
- file => "/etc/hostconfig",
- pattern => "SNMPSERVER=-NO-",
- }
- line { "startsnmpdyes":
- file => "/etc/hostconfig",
- line => "SNMPSERVER=-YES-",
- notify => Exec["/sbin/SystemStarter start SNMP"],
- }
- exec{"/sbin/SystemStarter start SNMP":
- noop => false,
- }
- munin::register_snmp { $fqdn: }
+ file { "/usr/share/snmp/snmpd.conf":
+ mode => 744,
+ content => template("munin/darwin_snmpd.conf.erb"),
+ group => 0,
+ owner => root,
+ }
+ delete_matching_line{"startsnmpdno":
+ file => "/etc/hostconfig",
+ pattern => "SNMPSERVER=-NO-",
+ }
+ line { "startsnmpdyes":
+ file => "/etc/hostconfig",
+ line => "SNMPSERVER=-YES-",
+ notify => Exec["/sbin/SystemStarter start SNMP"],
+ }
+ exec{"/sbin/SystemStarter start SNMP":
+ noop => false,
+ }
+ munin::register_snmp { $fqdn: }
}
diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp
index a6d677e..97f5fbf 100644
--- a/manifests/client/debian.pp
+++ b/manifests/client/debian.pp
@@ -1,15 +1,15 @@
class munin::client::debian inherits munin::client::package {
# the plugin will need that
- package { "iproute": ensure => installed }
+ package { "iproute": ensure => installed }
- Service["munin-node"]{
- # sarge's munin-node init script has no status
- hasstatus => $lsbdistcodename ? { sarge => false, default => true }
- }
+ Service["munin-node"]{
+ # sarge's munin-node init script has no status
+ hasstatus => $lsbdistcodename ? { sarge => false, default => true }
+ }
File["/etc/munin/munin-node.conf"]{
- content => template("munin/munin-node.conf.$operatingsystem.$lsbdistcodename"),
+ content => template("munin/munin-node.conf.$operatingsystem.$lsbdistcodename"),
}
- # workaround bug in munin_node_configure
- plugin { "postfix_mailvolume": ensure => absent }
- include munin::plugins::debian
+ # workaround bug in munin_node_configure
+ plugin { "postfix_mailvolume": ensure => absent }
+ include munin::plugins::debian
}
diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp
index 53d472b..c24d317 100644
--- a/manifests/client/gentoo.pp
+++ b/manifests/client/gentoo.pp
@@ -3,6 +3,6 @@ class munin::client::gentoo inherits munin::client::package {
name => 'munin',
category => 'net-analyzer',
}
-
- include munin::plugins::gentoo
+
+ include munin::plugins::gentoo
}
diff --git a/manifests/client/package.pp b/manifests/client/package.pp
index 84fcf5c..18566b8 100644
--- a/manifests/client/package.pp
+++ b/manifests/client/package.pp
@@ -1,11 +1,11 @@
class munin::client::package inherits munin::client::base {
- package { 'munin-node': ensure => installed }
+ package { 'munin-node': ensure => installed }
Service['munin-node']{
require => Package[munin-node],
}
File['/etc/munin/munin-node.conf']{
- # this has to be installed before the package, so the postinst can
- # boot the munin-node without failure!
- before => Package['munin-node'],
+ # this has to be installed before the package, so the postinst can
+ # boot the munin-node without failure!
+ before => Package['munin-node'],
}
}
diff --git a/manifests/host.pp b/manifests/host.pp
index 9fd637d..87d3255 100644
--- a/manifests/host.pp
+++ b/manifests/host.pp
@@ -4,9 +4,9 @@
class munin::host inherits munin
{
- package {"munin": ensure => installed, }
+ package {"munin": ensure => installed, }
- File <<| tag == 'munin' |>>
+ File <<| tag == 'munin' |>>
file{'/etc/munin/munin.conf.header':
source => [ "puppet://$server/modules/site-munin/config/host/${fqdn}/munin.conf.header",
@@ -18,12 +18,12 @@ class munin::host inherits munin
owner => root, group => 0, mode => 0644;
}
- concatenated_file { "/etc/munin/munin.conf":
- dir => '/var/lib/puppet/modules/munin/nodes',
- header => "/etc/munin/munin.conf.header",
- }
-
- file { ["/var/log/munin-update.log", "/var/log/munin-limits.log",
+ concatenated_file { "/etc/munin/munin.conf":
+ dir => '/var/lib/puppet/modules/munin/nodes',
+ header => "/etc/munin/munin.conf.header",
+ }
+
+ file { ["/var/log/munin-update.log", "/var/log/munin-limits.log",
"/var/log/munin-graph.log", "/var/log/munin-html.log"]:
ensure => present,
mode => 640, owner => munin, group => 0;
diff --git a/manifests/init.pp b/manifests/init.pp
index 5c4feeb..bae83a4 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -2,17 +2,17 @@
# munin module
# munin.pp - everything a sitewide munin installation needs
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
-#
+#
# Copyright 2008, Puzzle ITC GmbH
# Marcel Härry haerry+puppet(at)puzzle.ch
# Simon Josi josi+puppet(at)puzzle.ch
#
-# This program is free software; you can redistribute
-# it and/or modify it under the terms of the GNU
-# General Public License version 3 as published by
+# This program is free software; you can redistribute
+# it and/or modify it under the terms of the GNU
+# General Public License version 3 as published by
# the Free Software Foundation.
#
-# the port is a parameter so vservers can share
+# the port is a parameter so vservers can share
# IP addresses and still be happy
class munin {
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 1fa4651..cdaa17d 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -17,10 +17,10 @@ define munin::plugin (
$plugin = "/etc/munin/plugins/$name"
$plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
case $ensure {
- "absent": {
- file { $plugin: ensure => absent, }
- }
- default: {
+ "absent": {
+ file { $plugin: ensure => absent, }
+ }
+ default: {
case $kernel {
openbsd: { $basic_require = File['/var/run/munin'] }
default: { $basic_require = Package['munin-node'] }
@@ -30,35 +30,35 @@ define munin::plugin (
} else {
$real_require = $basic_require
}
- file { $plugin:
- ensure => "${real_script_path}/${plugin_src}",
- require => $real_require,
- notify => Service['munin-node'];
- }
+ file { $plugin:
+ ensure => "${real_script_path}/${plugin_src}",
+ require => $real_require,
+ notify => Service['munin-node'];
+ }
- }
+ }
}
case $config {
- '': {
- file { $plugin_conf: ensure => absent }
- }
- default: {
- case $ensure {
- absent: {
- file { $plugin_conf: ensure => absent }
- }
- default: {
- file { $plugin_conf:
- content => "[${name}]\n$config\n",
- mode => 0644, owner => root, group => 0,
- }
+ '': {
+ file { $plugin_conf: ensure => absent }
+ }
+ default: {
+ case $ensure {
+ absent: {
+ file { $plugin_conf: ensure => absent }
+ }
+ default: {
+ file { $plugin_conf:
+ content => "[${name}]\n$config\n",
+ mode => 0644, owner => root, group => 0,
+ }
if $require {
File[$plugin_conf]{
require +> $require,
}
}
- }
- }
- }
+ }
+ }
+ }
}
}
diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp
index 115644c..164a17e 100644
--- a/manifests/plugin/scriptpaths.pp
+++ b/manifests/plugin/scriptpaths.pp
@@ -1,12 +1,12 @@
class munin::plugin::scriptpaths {
case $operatingsystem {
- gentoo: { $script_path = '/usr/libexec/munin/plugins' }
- debian: { $script_path = '/usr/share/munin/plugins' }
- centos: { $script_path = '/usr/share/munin/plugins' }
- openbsd: { $script_path = $operatingsystemrelease ? {
+ gentoo: { $script_path = "/usr/libexec/munin/plugins" }
+ debian: { $script_path = "/usr/share/munin/plugins" }
+ centos: { $script_path = "/usr/share/munin/plugins" }
+ openbsd: { $script_path = $operatingsystemrelease ? {
'4.3' => '/opt/munin/lib/plugins/',
default => '/usr/local/libexec/munin/plugins/'
- } }
- default: { $script_path = '/usr/share/munin/plugins' }
+ } }
+ default: { $script_path = "/usr/share/munin/plugins" }
}
}
diff --git a/manifests/plugins/debian.pp b/manifests/plugins/debian.pp
index f239989..6d2faef 100644
--- a/manifests/plugins/debian.pp
+++ b/manifests/plugins/debian.pp
@@ -1,4 +1,2 @@
class munin::plugins::debian inherits munin::plugins::base {
- munin::plugin { apt_all: ensure => present; }
}
-
diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp
index 99b85ba..df0828c 100644
--- a/manifests/plugins/interfaces.pp
+++ b/manifests/plugins/interfaces.pp
@@ -8,14 +8,14 @@ class munin::plugins::interfaces inherits munin::plugins::base {
case $operatingsystem {
openbsd: {
$if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1")
- munin::plugin{
+ munin::plugin{
$if_errs: ensure => "if_errcoll_";
}
}
default: {
$if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1")
- munin::plugin{
- $if_errs: ensure => "if_err_";
+ munin::plugin{
+ $if_errs: ensure => "if_err_";
}
}
}
diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp
index c7beb59..86696cc 100644
--- a/manifests/plugins/linux.pp
+++ b/manifests/plugins/linux.pp
@@ -1,9 +1,9 @@
class munin::plugins::linux inherits munin::plugins::base {
munin::plugin {
- [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]:
- ensure => present;
- acpi:
- ensure => $acpi_available;
+ [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]:
+ ensure => present;
+ acpi:
+ ensure => $acpi_available;
}
include munin::plugins::interfaces
diff --git a/manifests/plugins/nagios.pp b/manifests/plugins/nagios.pp
deleted file mode 100644
index c07e99d..0000000
--- a/manifests/plugins/nagios.pp
+++ /dev/null
@@ -1,20 +0,0 @@
-class munin::plugins::nagios inherits munin::plugins::base {
-
- munin::plugin::deploy {
- nagios_hosts: config => 'user root';
- nagios_svc: config => 'user root';
- nagios_perf_hosts: ensure => nagios_perf_, config => 'user root';
- nagios_perf_svc: ensure => nagios_perf_, config => 'user root';
- }
-
- exec { 'munin_nagios2stats_link':
- command => 'ln -s /usr/sbin/nagios2stats /usr/local/sbin/nagiostats',
- onlyif => ["test ! -e /usr/local/sbin/nagiostats", "test -e /usr/sbin/nagios2stats"],
- }
-
- exec { 'munin_nagios3stats_link':
- command => 'ln -s /usr/sbin/nagios3stats /usr/local/sbin/nagiostats',
- onlyif => ["test ! -e /usr/local/sbin/nagiostats", "test -e /usr/sbin/nagios3stats"],
- }
-
-}
diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp
index bce28a1..f24af07 100644
--- a/manifests/plugins/vserver.pp
+++ b/manifests/plugins/vserver.pp
@@ -1,7 +1,7 @@
class munin::plugins::vserver inherits munin::plugins::base {
munin::plugin {
- [ netstat, processes ]:
- ensure => present;
+ [ netstat, processes ]:
+ ensure => present;
}
}
diff --git a/manifests/register.pp b/manifests/register.pp
index e1271e1..21f1d35 100644
--- a/manifests/register.pp
+++ b/manifests/register.pp
@@ -1,17 +1,34 @@
-define munin::register()
+define munin::register (
+ $host = 'absent',
+ $port = 'absent',
+ $description = 'absent',
+ $config = []
+)
{
- $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port }
- $munin_host_real = $munin_host ? {
- '' => $fqdn,
- 'fqdn' => $fqdn,
- default => $munin_host
- }
+ $fhost = $name
+ $client_type = 'client'
- @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}":
- ensure => present,
- content => template("munin/defaultclient.erb"),
- tag => 'munin',
- }
-}
+ $munin_port_real = $port ? {
+ 'absent' => $munin_port ? {
+ '' => 4949,
+ default => $munin_port
+ },
+ default => $port
+ }
+ $munin_host_real = $host ? {
+ 'absent' => $munin_host ? {
+ '' => $fqdn,
+ 'fqdn' => $fqdn,
+ default => $munin_host
+ },
+ default => $host
+ }
+ @@file { "munin_client_${fhost}_${munin_port_real}":
+ ensure => present,
+ path => "/var/lib/puppet/modules/munin/nodes/${fhost}_${munin_port_real}",
+ content => template("munin/client.erb"),
+ tag => 'munin',
+ }
+}
diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp
new file mode 100644
index 0000000..c0d9279
--- /dev/null
+++ b/manifests/register/snmp.pp
@@ -0,0 +1,22 @@
+define munin::register::snmp (
+ $community = 'public',
+ $description = 'absent'
+)
+{
+ $fhost = $name
+ $munin_host_real = $fqdn
+ $client_type = 'snmp'
+ $config = [ 'use_node_name no' ]
+
+ exec { "munin_register_snmp_${fhost}":
+ command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} | sh",
+ unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null",
+ }
+
+ @@file { "munin_snmp_${fhost}":
+ ensure => present,
+ path => "/var/lib/puppet/modules/munin/nodes/${fhost}",
+ content => template("munin/client.erb"),
+ tag => 'munin',
+ }
+}
diff --git a/manifests/register_snmp.pp b/manifests/register_snmp.pp
deleted file mode 100644
index e74ba44..0000000
--- a/manifests/register_snmp.pp
+++ /dev/null
@@ -1,21 +0,0 @@
-# snmp_testplugin: the plugin we use to test if it's set
-define munin::register_snmp(
- $snmpd_testplugin = 'load'
-)
-{
- $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port }
- $munin_host_real = $munin_host ? {
- '' => '*',
- 'fqdn' => '*',
- default => $munin_host
- }
- exec{"register_snmp_munin_for_${name}":
- command => "munin-node-configure-snmp ${name} | sh",
- unless => "test -e /etc/munin/plugins/snmp_${name}_${snmpd_testplugin}",
- }
- @@file { "munin_snmp_${name}": path => "/var/lib/puppet/modules/munin/nodes/${name}",
- ensure => present,
- content => template("munin/snmpclient.erb"),
- tag => 'munin',
- }
-}
diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp
index 4bca235..ce87492 100644
--- a/manifests/remoteplugin.pp
+++ b/manifests/remoteplugin.pp
@@ -1,18 +1,18 @@
define munin::remoteplugin($ensure = "present", $source, $config = '') {
case $ensure {
- "absent": { munin::plugin{ $name: ensure => absent } }
- default: {
- file {
- "/var/lib/puppet/modules/munin/plugins/${name}":
- source => $source,
- mode => 0755, owner => root, group => 0;
- }
- munin::plugin { $name:
- ensure => $ensure,
- config => $config,
- script_path_in => "/var/lib/puppet/modules/munin/plugins",
- }
- }
+ "absent": { munin::plugin{ $name: ensure => absent } }
+ default: {
+ file {
+ "/var/lib/puppet/modules/munin/plugins/${name}":
+ source => $source,
+ mode => 0755, owner => root, group => 0;
+ }
+ munin::plugin { $name:
+ ensure => $ensure,
+ config => $config,
+ script_path_in => "/var/lib/puppet/modules/munin/plugins",
+ }
+ }
}
}
diff --git a/manifests/snmp_collector.pp b/manifests/snmp_collector.pp
index 4f72b95..6f3fe34 100644
--- a/manifests/snmp_collector.pp
+++ b/manifests/snmp_collector.pp
@@ -1,14 +1,14 @@
class munin::snmp_collector{
- file {
- "/var/lib/puppet/modules/munin/create_snmp_links":
- source => "puppet://$server/modules/munin/create_snmp_links.sh",
- mode => 755, owner => root, group => 0;
- }
+ file {
+ "/var/lib/puppet/modules/munin/create_snmp_links":
+ source => "puppet://$server/modules/munin/create_snmp_links.sh",
+ mode => 755, owner => root, group => 0;
+ }
- exec { "create_snmp_links":
- command => "/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes",
- require => File["snmp_links"],
- timeout => "2048",
- schedule => daily
- }
+ exec { "create_snmp_links":
+ command => "/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes",
+ require => File["snmp_links"],
+ timeout => "2048",
+ schedule => daily
+ }
}