$plugin_src = $ensure ? { "present" => $name, default => $ensure }
$plugin = "/etc/munin/plugins/$name"
$plugin_conf = "/etc/munin/plugin-conf.d/$name.conf"
+
+ include munin::plugins::setup
case $ensure {
"absent": {
file { $plugin: ensure => absent, }
-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": }
+class munin::plugins::apache {
+ munin::plugin{ [ 'apache_accesses', 'apache_processes',' apache_volume' ]: }
+ munin::plugin::deploy { "apache_activity": }
}
class munin::plugins::base {
- file {
- [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]:
- source => "puppet://$server/modules/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
- ]:
+ # setup basic plugins
+ munin::plugin {
+ [ 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: {
- 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 }
+ case $kernel {
+ openbsd: { include munin::plugins::openbsd }
+ 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 }
+ }
}
-class munin::plugins::debian inherits munin::plugins::base {
-}
+class munin::plugins::debian { }
-class munin::plugins::djbdns inherits munin::plugins::base {
+class munin::plugins::djbdns {
munin::plugin::deploy { "tinydns": }
}
-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_mem": config => "user root"}
- munin::plugin::deploy { "xen_vm": config => "user root"}
- munin::plugin::deploy { "xen_vbd": config => "user root"}
- munin::plugin::deploy { "xen_traffic_all": config => "user root"}
+class munin::plugins::dom0 {
+ munin::plugin::deploy {
+ [ 'xen', 'xen-cpu', 'xen_memory', 'xen_mem',
+ 'xen_vm', 'xen_vbd' 'xen_traffic_all' ]:
+ config => 'user root';
+ }
}
-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"}
+class munin::plugins::gentoo {
+ munin::plugin::deploy { 'gentoo_lastupdated':
+ config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail /usr/bin/tail\nenv.grep /bin/grep"
+ }
}
# handle if_ and if_err_ plugins
-class munin::plugins::interfaces inherits munin::plugins::base {
+class munin::plugins::interfaces {
- $ifs = gsub(split($interfaces, " |,"), "(.+)", "if_\\1")
- munin::plugin {
+ $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_";
+ }
}
- 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_";
- }
- }
+ default: {
+ $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;
- }
-
- include munin::plugins::interfaces
+class munin::plugins::linux {
+ munin::plugin {
+ [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]:
+ ensure => present;
+ acpi:
+ ensure => $acpi_available;
+ }
}
-class munin::plugins::muninhost inherits munin::plugins::base {
- munin::plugin { munin_update: }
- munin::plugin { munin_graph: }
+class munin::plugins::muninhost {
+ munin::plugin { ['munin_update', 'munin_graph']: }
}
-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,
- }
-
+class munin::plugins::openbsd {
+ munin::plugin {
+ [ memory_pools, memory_types ]:
+ ensure => present,
+ }
}
-class munin::plugins::physical inherits munin::plugins::base {
- case $kernel {
- linux: { munin::plugin { iostat: } }
- }
+class munin::plugins::physical {
+ case $kernel {
+ linux: { munin::plugin { iostat: } }
+ }
}
-class munin::plugins::selinux inherits munin::plugins::base {
- munin::plugin::deploy { "selinuxenforced": }
- munin::plugin::deploy { "selinux_avcstats": }
+class munin::plugins::selinux {
+ munin::plugin::deploy { [ 'selinuxenforced', 'selinux_avcstats' ]: }
}
--- /dev/null
+class munin::plugins::setup {
+ file {
+ [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]:
+ source => "puppet://$server/modules/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'],
+ }
+ 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'],
+ }
+ }
+ }
+}
-class munin::plugins::vserver inherits munin::plugins::base {
- munin::plugin {
- [ netstat, processes ]:
- ensure => present;
- }
+class munin::plugins::vserver {
+ munin::plugin {
+ [ netstat, processes ]:
+ ensure => present;
+ }
}