summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/config/host/munin.conf.header.CentOS6
-rw-r--r--manifests/client.pp12
-rw-r--r--manifests/plugin.pp209
-rw-r--r--plugins/facter/acpi_available.rb14
4 files changed, 121 insertions, 120 deletions
diff --git a/files/config/host/munin.conf.header.CentOS b/files/config/host/munin.conf.header.CentOS
index 30cf437..dcadd6b 100644
--- a/files/config/host/munin.conf.header.CentOS
+++ b/files/config/host/munin.conf.header.CentOS
@@ -25,9 +25,9 @@ graph_strategy cgi
# the services must be defined in the Nagios server as well.
#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg
-#contacts me
-#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root
-#contact.me.always_send warning critical
+contacts me
+contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root
+contact.me.always_send warning critical
# a simple host tree
#[localhost]
diff --git a/manifests/client.pp b/manifests/client.pp
index 48d2a22..df9ab06 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -61,15 +61,15 @@ define munin::register_snmp(
}
class munin::client::base {
- service { 'munin-node':
- ensure => running,
+ service { 'munin-node':
+ ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
- }
- file {'/etc/munin/':
- ensure => directory,
- mode => 0755, owner => root, group => 0;
+ }
+ file {'/etc/munin/':
+ ensure => directory,
+ mode => 0755, owner => root, group => 0;
}
$real_munin_allow = $munin_allow ? {
'' => '127.0.0.1',
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 6dfe5f0..8d739a8 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -7,34 +7,34 @@
### configpaths
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 = "/opt/munin/lib/plugins/" }
- default: { $script_path = "/usr/share/munin/plugins" }
- }
+ 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 = "/opt/munin/lib/plugins/" }
+ default: { $script_path = "/usr/share/munin/plugins" }
+ }
}
### defines
define munin::plugin (
- $ensure = "present",
- $script_path_in = '',
- $config = '')
+ $ensure = "present",
+ $script_path_in = '',
+ $config = '')
{
include munin::plugin::scriptpaths
- $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
-
- $plugin_src = $ensure ? { "present" => $name, default => $ensure }
- $plugin = "/etc/munin/plugins/$name"
- $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
- case $ensure {
- "absent": {
- file { $plugin: ensure => absent, }
- }
- default: {
+ $real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
+
+ $plugin_src = $ensure ? { "present" => $name, default => $ensure }
+ $plugin = "/etc/munin/plugins/$name"
+ $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
+ case $ensure {
+ "absent": {
+ file { $plugin: ensure => absent, }
+ }
+ default: {
case $kernel {
openbsd: { $basic_require = File['/var/run/munin'] }
default: { $basic_require = Package['munin-node'] }
@@ -44,61 +44,61 @@ define munin::plugin (
} else {
$real_require = $basic_require
}
- 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:
+ 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,
+ }
if $require {
File[$plugin_conf]{
require +> $require,
}
}
- }
- }
- }
- }
+ }
+ }
+ }
+ }
}
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",
- }
- }
- }
+ 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",
+ }
+ }
+ }
}
define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') {
- $plugin_src = $ensure ? {
- 'present' => $name,
- 'absent' => $name,
- default => $ensure
+ $plugin_src = $ensure ? {
+ 'present' => $name,
+ 'absent' => $name,
+ default => $ensure
}
$real_source = $source ? {
'' => "munin/plugins/$plugin_src",
@@ -117,11 +117,11 @@ define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') {
}
if $require {
File["munin_plugin_${name}"]{
- require => [ $basic_require, $require ],
+ require => [ $basic_require, $require ],
}
} else {
File["munin_plugin_${name}"]{
- require => $basic_require,
+ require => $basic_require,
}
}
# register the plugin
@@ -136,29 +136,29 @@ define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') {
class munin::plugins::base {
file {
- [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]:
- source => "puppet://$server/common/empty",
+ [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]:
+ source => "puppet://$server/common/empty",
ignore => [ '\.ignore', 'snmp_*' ],
- ensure => directory, checksum => mtime,
- recurse => true, purge => true, force => true,
- mode => 0755, owner => root, group => 0,
- notify => Service['munin-node'];
- '/etc/munin/plugin-conf.d/munin-node':
- ensure => present,
- mode => 0644, owner => root, group => 0,
- notify => Service['munin-node'],
- }
+ ensure => directory, checksum => mtime,
+ recurse => true, purge => true, force => true,
+ mode => 0755, owner => root, group => 0,
+ notify => Service['munin-node'];
+ '/etc/munin/plugin-conf.d/munin-node':
+ ensure => present,
+ mode => 0644, owner => root, group => 0,
+ notify => Service['munin-node'],
+ }
munin::plugin {
- [ df, cpu, interrupts, load, memory, netstat, open_files,
- processes, swap, uptime, users, vmstat
+ [ df, cpu, interrupts, load, memory, netstat, open_files,
+ processes, swap, uptime, users, vmstat
]:
ensure => present,
}
- include munin::plugins::interfaces
+ include munin::plugins::interfaces
case $kernel {
- openbsd: {
+ openbsd: {
File['/etc/munin/plugin-conf.d/munin-node']{
before => File['/var/run/munin'],
}
@@ -189,44 +189,45 @@ class munin::plugins::base {
# handle if_ and if_err_ plugins
class munin::plugins::interfaces inherits munin::plugins::base {
- $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1")
- munin::plugin {
- $ifs: ensure => "if_";
- }
+ $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1")
+ munin::plugin {
+ $ifs: ensure => "if_";
+ }
case $operatingsystem {
openbsd: {
- $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1")
- munin::plugin{
+ $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_errcoll_\\1")
+ munin::plugin{
$if_errs: ensure => "if_errcoll_";
}
}
default: {
- $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1")
- munin::plugin{
- $if_errs: ensure => "if_err_";
+ $if_errs = gsub(split($interfaces, " |,"), "(.+)", "if_err_\\1")
+ munin::plugin{
+ $if_errs: ensure => "if_err_";
}
}
}
}
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;
+ }
- munin::plugin {
- [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]:
- ensure => present;
- acpi:
- ensure => $acpi_available;
- }
+ include munin::plugins::interfaces
}
class munin::plugins::debian inherits munin::plugins::base {
- munin::plugin { apt_all: ensure => present; }
+ munin::plugin { apt_all: ensure => present; }
}
class munin::plugins::openbsd inherits munin::plugins::base {
munin::plugin {
- [ df, cpu, interrupts, load, memory, netstat, open_files,
- processes, swap, users, vmstat
+ [ df, cpu, interrupts, load, memory, netstat, open_files,
+ processes, swap, users, vmstat
]:
ensure => present,
}
@@ -238,10 +239,10 @@ class munin::plugins::openbsd inherits munin::plugins::base {
}
class munin::plugins::vserver inherits munin::plugins::base {
- munin::plugin {
- [ netstat, processes ]:
- ensure => present;
- }
+ munin::plugin {
+ [ netstat, processes ]:
+ ensure => present;
+ }
}
class munin::plugins::gentoo inherits munin::plugins::base {
diff --git a/plugins/facter/acpi_available.rb b/plugins/facter/acpi_available.rb
index 576d76c..9a0474f 100644
--- a/plugins/facter/acpi_available.rb
+++ b/plugins/facter/acpi_available.rb
@@ -1,10 +1,10 @@
# return whether acpi is available -- used for deciding whether to install the munin plugin
Facter.add("acpi_available") do
- setcode do
- if not File.exist? `which acpi 2>/dev/null`.chomp or `acpi -t -B -A 2>/dev/null`.match(/\d/).nil?
- "absent"
- else
- "present"
- end
- end
+ setcode do
+ if not File.exist? `which acpi 2>/dev/null`.chomp or `acpi -t -B -A 2>/dev/null`.match(/\d/).nil?
+ "absent"
+ else
+ "present"
+ end
+ end
end