diff options
author | mh <mh@immerda.ch> | 2009-09-29 22:51:15 +0200 |
---|---|---|
committer | mh <mh@immerda.ch> | 2009-09-29 22:51:15 +0200 |
commit | 1893960c1babb6a261cc6fc399231e9c0644a104 (patch) | |
tree | 7e4fb1f3d2d34490b8d5cfff50d6f9cadf890fb9 /manifests/plugins | |
parent | c63a28d3c16ec2bb3a46d3d5faf6d7ef3b737b70 (diff) |
refactor everything into its own file
Diffstat (limited to 'manifests/plugins')
-rw-r--r-- | manifests/plugins/apache.pp | 6 | ||||
-rw-r--r-- | manifests/plugins/base.pp | 49 | ||||
-rw-r--r-- | manifests/plugins/debian.pp | 4 | ||||
-rw-r--r-- | manifests/plugins/deploy.pp | 37 | ||||
-rw-r--r-- | manifests/plugins/djbdns.pp | 3 | ||||
-rw-r--r-- | manifests/plugins/dom0.pp | 7 | ||||
-rw-r--r-- | manifests/plugins/gentoo.pp | 3 | ||||
-rw-r--r-- | manifests/plugins/interfaces.pp | 22 | ||||
-rw-r--r-- | manifests/plugins/linux.pp | 10 | ||||
-rw-r--r-- | manifests/plugins/muninhost.pp | 4 | ||||
-rw-r--r-- | manifests/plugins/nagios.pp | 8 | ||||
-rw-r--r-- | manifests/plugins/openbsd.pp | 13 | ||||
-rw-r--r-- | manifests/plugins/physical.pp | 5 | ||||
-rw-r--r-- | manifests/plugins/scriptpaths.pp | 9 | ||||
-rw-r--r-- | manifests/plugins/selinux.pp | 4 | ||||
-rw-r--r-- | manifests/plugins/vserver.pp | 7 |
16 files changed, 191 insertions, 0 deletions
diff --git a/manifests/plugins/apache.pp b/manifests/plugins/apache.pp new file mode 100644 index 0000000..ee90de8 --- /dev/null +++ b/manifests/plugins/apache.pp @@ -0,0 +1,6 @@ +class munin::plugins::apache inherits munin::plugins::base { + munin::plugin{ "apache_accesses": } + munin::plugin{ "apache_processes": } + munin::plugin{ "apache_volume": } + munin::plugin::deploy { "apache_activity": } +} diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp new file mode 100644 index 0000000..9f47f6b --- /dev/null +++ b/manifests/plugins/base.pp @@ -0,0 +1,49 @@ +class munin::plugins::base { + file { + [ '/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'], + } + + munin::plugin { + [ df, cpu, interrupts, load, memory, netstat, open_files, + processes, swap, uptime, users, vmstat + ]: + ensure => present, + } + include munin::plugins::interfaces + + case $kernel { + openbsd: { + File['/etc/munin/plugin-conf.d/munin-node']{ + before => File['/var/run/munin'], + } + } + default: { + File['/etc/munin/plugin-conf.d/munin-node']{ + before => Package['munin-node'], + } + } + } + case $kernel { + linux: { + case $vserver { + guest: { include munin::plugins::vserver } + default: { + include munin::plugins::linux + } + } + } + } + case $virtual { + physical: { include munin::plugins::physical } + xen0: { include munin::plugins::dom0 } + } diff --git a/manifests/plugins/debian.pp b/manifests/plugins/debian.pp new file mode 100644 index 0000000..f239989 --- /dev/null +++ b/manifests/plugins/debian.pp @@ -0,0 +1,4 @@ +class munin::plugins::debian inherits munin::plugins::base { + munin::plugin { apt_all: ensure => present; } +} + diff --git a/manifests/plugins/deploy.pp b/manifests/plugins/deploy.pp new file mode 100644 index 0000000..24ac3d3 --- /dev/null +++ b/manifests/plugins/deploy.pp @@ -0,0 +1,37 @@ +define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') { + $plugin_src = $ensure ? { + 'present' => $name, + 'absent' => $name, + default => $ensure + } + $real_source = $source ? { + '' => "munin/plugins/$plugin_src", + default => $source + } + include munin::plugin::scriptpaths + file { "munin_plugin_${name}": + path => "$munin::plugin::scriptpaths::script_path/${name}", + source => "puppet://$server/$real_source", + mode => 0755, owner => root, group => 0; + } + + case $kernel { + openbsd: { $basic_require = File['/var/run/munin'] } + default: { $basic_require = Package['munin-node'] } + } + if $require { + File["munin_plugin_${name}"]{ + require => [ $basic_require, $require ], + } + } else { + File["munin_plugin_${name}"]{ + require => $basic_require, + } + } + # register the plugin + if $require { + munin::plugin{$name: ensure => $ensure, config => $config, require => $require } + } else { + munin::plugin{$name: ensure => $ensure, config => $config } + } +} diff --git a/manifests/plugins/djbdns.pp b/manifests/plugins/djbdns.pp new file mode 100644 index 0000000..37d8ed6 --- /dev/null +++ b/manifests/plugins/djbdns.pp @@ -0,0 +1,3 @@ +class munin::plugins::djbdns inherits munin::plugins::base { + munin::plugin::deploy { "tinydns": } +} diff --git a/manifests/plugins/dom0.pp b/manifests/plugins/dom0.pp new file mode 100644 index 0000000..276dc9f --- /dev/null +++ b/manifests/plugins/dom0.pp @@ -0,0 +1,7 @@ +class munin::plugins::dom0 inherits munin::plugins::physical { + munin::plugin::deploy { "xen": config => "user root"} + munin::plugin::deploy { "xen-cpu": config => "user root"} + munin::plugin::deploy { "xen_memory": config => "user root"} + munin::plugin::deploy { "xen_vbd": config => "user root"} + munin::plugin::deploy { "xen_traffic_all": config => "user root"} +} diff --git a/manifests/plugins/gentoo.pp b/manifests/plugins/gentoo.pp new file mode 100644 index 0000000..81d0e6b --- /dev/null +++ b/manifests/plugins/gentoo.pp @@ -0,0 +1,3 @@ +class munin::plugins::gentoo inherits munin::plugins::base { + munin::plugin::deploy { "gentoo_lastupdated": config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail /usr/bin/tail\nenv.grep /bin/grep"} +} diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp new file mode 100644 index 0000000..99b85ba --- /dev/null +++ b/manifests/plugins/interfaces.pp @@ -0,0 +1,22 @@ +# 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_"; + } + case $operatingsystem { + openbsd: { + $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_"; + } + } + } +} diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp new file mode 100644 index 0000000..c7beb59 --- /dev/null +++ b/manifests/plugins/linux.pp @@ -0,0 +1,10 @@ +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; + } + + include munin::plugins::interfaces +} diff --git a/manifests/plugins/muninhost.pp b/manifests/plugins/muninhost.pp new file mode 100644 index 0000000..2af4897 --- /dev/null +++ b/manifests/plugins/muninhost.pp @@ -0,0 +1,4 @@ +class munin::plugins::muninhost inherits munin::plugins::base { + munin::plugin { munin_update: } + munin::plugin { munin_graph: } +} diff --git a/manifests/plugins/nagios.pp b/manifests/plugins/nagios.pp new file mode 100644 index 0000000..93a261c --- /dev/null +++ b/manifests/plugins/nagios.pp @@ -0,0 +1,8 @@ +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'; + } +} diff --git a/manifests/plugins/openbsd.pp b/manifests/plugins/openbsd.pp new file mode 100644 index 0000000..67cf32d --- /dev/null +++ b/manifests/plugins/openbsd.pp @@ -0,0 +1,13 @@ +class munin::plugins::openbsd inherits munin::plugins::base { + munin::plugin { + [ df, cpu, interrupts, load, memory, netstat, open_files, + processes, swap, users, vmstat + ]: + ensure => present, + } + munin::plugin { + [ memory_pools, memory_types ]: + ensure => present, + } + +} diff --git a/manifests/plugins/physical.pp b/manifests/plugins/physical.pp new file mode 100644 index 0000000..6706711 --- /dev/null +++ b/manifests/plugins/physical.pp @@ -0,0 +1,5 @@ +class munin::plugins::physical inherits munin::plugins::base { + case $kernel { + linux: { munin::plugin { iostat: } } + } +} diff --git a/manifests/plugins/scriptpaths.pp b/manifests/plugins/scriptpaths.pp new file mode 100644 index 0000000..ebaa6fa --- /dev/null +++ b/manifests/plugins/scriptpaths.pp @@ -0,0 +1,9 @@ +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" } + } +} diff --git a/manifests/plugins/selinux.pp b/manifests/plugins/selinux.pp new file mode 100644 index 0000000..6affc86 --- /dev/null +++ b/manifests/plugins/selinux.pp @@ -0,0 +1,4 @@ +class munin::plugins::selinux inherits munin::plugins::base { + munin::plugin::deploy { "selinuxenforced": } + munin::plugin::deploy { "selinux_avcstats": } +} diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp new file mode 100644 index 0000000..bce28a1 --- /dev/null +++ b/manifests/plugins/vserver.pp @@ -0,0 +1,7 @@ +class munin::plugins::vserver inherits munin::plugins::base { + munin::plugin { + [ netstat, processes ]: + ensure => present; + } +} + |