diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/client.pp | 85 | ||||
-rw-r--r-- | manifests/host.pp | 15 | ||||
-rw-r--r-- | manifests/init.pp | 8 | ||||
-rw-r--r-- | manifests/plugin.pp | 164 |
4 files changed, 226 insertions, 46 deletions
diff --git a/manifests/client.pp b/manifests/client.pp index 0ad7856..2d13d24 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -22,6 +22,14 @@ class munin::client { include munin::client::debian include munin::plugins::debian } + gentoo: { + include munin::client::gentoo + include munin::plugins::gentoo + } + centos: { + include munin::client::centos + include munin::plugins::centos + } default: { fail ("Don't know how to handle munin on $operatingsystem") } } @@ -31,9 +39,6 @@ class munin::client { guest: { include munin::plugins::vserver } default: { include munin::plugins::linux - case $virtual { - xen0: { include munin::plugins::xen } - } } } } @@ -41,7 +46,11 @@ class munin::client { err( "Don't know which munin plugins to install for $kernel" ) } } - + case $virtual { + physical: { include munin::plugins::physical } + xen0: { include munin::plugins::dom0 } + xenu: { include munin::plugins::domU } + } } define munin::register() @@ -74,7 +83,7 @@ class munin::client::darwin file { "/usr/share/snmp/snmpd.conf": mode => 744, content => template("munin/darwin_snmpd.conf.erb"), - group => staff, + group => 0, owner => root, } delete_matching_line{"startsnmpdno": @@ -94,16 +103,17 @@ class munin::client::darwin class munin::client::debian { - package { "munin-node": ensure => installed } + # the plugin will need that + package { "iproute": ensure => installed } file { "/etc/munin/": ensure => directory, - mode => 0755, owner => root, group => root; + mode => 0755, owner => root, group => 0; "/etc/munin/munin-node.conf": content => template("munin/munin-node.conf.${operatingsystem}.${lsbdistcodename}"), - mode => 0644, owner => root, group => root, + mode => 0644, owner => root, group => 0, # this has to be installed before the package, so the postinst can # boot the munin-node without failure! before => Package["munin-node"], @@ -122,3 +132,62 @@ class munin::client::debian plugin { "postfix_mailvolume": ensure => absent } } +class munin::client::gentoo +{ + $acpi_available = "absent" + package { 'munin-node': + name => 'munin', + ensure => present, + category => $operatingsystem ? { + gentoo => 'net-analyzer', + default => '', + }, + } + + file { + "/etc/munin/": + ensure => directory, + mode => 0755, owner => root, group => 0; + "/etc/munin/munin-node.conf": + content => template("munin/munin-node.conf.Gentoo."), + mode => 0644, owner => root, group => 0, + # this has to be installed before the package, so the postinst can + # boot the munin-node without failure! + before => Package["munin-node"], + # notify => Service["munin"], + } + + service { "munin-node": + ensure => running, + } + + munin::register { $fqdn: } +} + +class munin::client::centos +{ + package { 'munin-node': + ensure => present, + } + + + file { + "/etc/munin/": + ensure => directory, + mode => 0755, owner => root, group =>0; + "/etc/munin/munin-node.conf": + content => template("munin/munin-node.conf.CentOS."), + mode => 0644, owner => root, group => 0, + # this has to be installed before the package, so the postinst can + # boot the munin-node without failure! + before => Package["munin-node"], + notify => Service["munin-node"], + } + + service { "munin-node": + ensure => running, + } + + munin::register { $fqdn: } + +} diff --git a/manifests/host.pp b/manifests/host.pp index f539c9e..74492b1 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -13,12 +13,13 @@ class munin::host 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 => root; - } - + 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; + } + + include munin::plugins::muninhost } class munin::snmp_collector @@ -27,7 +28,7 @@ class munin::snmp_collector file { "/var/lib/puppet/modules/munin/create_snmp_links": source => "puppet://$servername/munin/create_snmp_links.sh", - mode => 755, owner => root, group => root; + mode => 755, owner => root, group => 0; } exec { "create_snmp_links": diff --git a/manifests/init.pp b/manifests/init.pp index b8fcd6f..e1f62a6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,8 +1,12 @@ # munin.pp - everything a sitewide munin installation needs # Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at> # See LICENSE for the full license granted to you. +<<<<<<< HEAD:manifests/init.pp # adapted by Puzzle ITC - haerry+puppet(at)puzzle.ch # +======= + +>>>>>>> immerda/master:manifests/init.pp # the port is a parameter so vservers can share IP addresses and still be happy # Define where the individual nodes' configs are stored @@ -14,4 +18,6 @@ import "host.pp" import "client.pp" import "plugin.pp" -include assert_lsbdistcodename +case $operatingsystem { + debian,ubuntu: { include assert_lsbdistcodename } +} diff --git a/manifests/plugin.pp b/manifests/plugin.pp index d143861..2b66ce2 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -1,13 +1,41 @@ # plugin.pp - configure a specific munin plugin # Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at> # See LICENSE for the full license granted to you. +# adapted and improved by admin(at)immerda.ch + + +### 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" + } + default: { + $script_path = "/usr/share/munin/plugins" + } + } +} + +### defines define munin::plugin ( $ensure = "present", - $script_path = "/usr/share/munin/plugins", + $script_path_in = '', $config = '') { - debug ( "munin_plugin: name=$name, ensure=$ensure, script_path=$script_path" ) + + 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 } + debug ( "munin_plugin: name=$name, ensure=$ensure, script_path=$munin::plugin::scriptpaths::script_path" ) $plugin = "/etc/munin/plugins/$name" $plugin_conf = "/etc/munin/plugin-conf.d/$name.conf" case $ensure { @@ -16,12 +44,11 @@ define munin::plugin ( file { $plugin: ensure => absent, } } default: { - $plugin_src = $ensure ? { "present" => $name, default => $ensure } debug ( "munin_plugin: making $plugin using src: $plugin_src" ) file { $plugin: - ensure => "$script_path/${plugin_src}", - require => Package["munin-node"], - notify => Service["munin-node"], + ensure => "${real_script_path}/${plugin_src}", + require => Package['munin-node'], + notify => Service['munin-node']; } } } @@ -40,7 +67,7 @@ define munin::plugin ( debug("creating $plugin_conf") file { $plugin_conf: content => "[${name}]\n$config\n", - mode => 0644, owner => root, group => root, + mode => 0644, owner => root, group => 0, } } } @@ -55,33 +82,66 @@ define munin::remoteplugin($ensure = "present", $source, $config = '') { file { "/var/lib/puppet/modules/munin/plugins/${name}": source => $source, - mode => 0755, owner => root, group => root; + mode => 0755, owner => root, group => 0; } munin::plugin { $name: ensure => $ensure, config => $config, - script_path => "/var/lib/puppet/modules/munin/plugins", + script_path_in => "/var/lib/puppet/modules/munin/plugins", } } } } +define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') { + $real_source = $source ? { + '' => "munin/plugins/$name", + default => $source + } + include munin::plugin::scriptpaths + debug ( "munin_plugin_${name}: name=$name, source=$source, script_path=$munin::plugin::scriptpaths::script_path" ) + file { "munin_plugin_${name}": + path => "$munin::plugin::scriptpaths::script_path/${name}", + source => "puppet://$servername/$real_source", + ensure => file, + mode => 0755, owner => root, group => 0; + } + + munin::plugin{$name: ensure => $ensure, config => $config } +} + +### clases for plugins class munin::plugins::base { + case $operatingsystem { + centos: { + file { + [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: + source => "puppet://$servername/munin/empty", + ensure => directory, checksum => mtime, + recurse => true, purge => true, force => true, + mode => 0755, owner => root, group => 0; + "/etc/munin/plugin-conf.d/munin-node": + ensure => present, + mode => 0644, owner => root, group => 0; + } + } - file { - [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: - source => "puppet://$servername/munin/empty", - ensure => directory, checksum => mtime, - recurse => true, purge => true, force => true, - mode => 0755, owner => root, group => root, - notify => Service[munin-node]; - "/etc/munin/plugin-conf.d/munin-node": - ensure => present, - mode => 0644, owner => root, group => root, - notify => Service[munin-node], - before => Package[munin-node]; + default: { + file { + [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]: + source => "puppet://$servername/munin/empty", + 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'], + before => Package['munin-node']; + } + } } - } # handle if_ and if_err_ plugins @@ -93,14 +153,12 @@ class munin::plugins::interfaces inherits munin::plugins::base { $ifs: ensure => "if_"; $if_errs: ensure => "if_err_"; } - - } class munin::plugins::linux inherits munin::plugins::base { plugin { - [ df_abs, forks, iostat, memory, processes, cpu, df_inode, irqstats, + [ df_abs, forks, memory, processes, cpu, df_inode, irqstats, netstat, open_files, swap, df, entropy, interrupts, load, open_inodes, vmstat ]: @@ -113,16 +171,62 @@ class munin::plugins::linux inherits munin::plugins::base { } class munin::plugins::debian inherits munin::plugins::base { - - plugin { apt_all: ensure => present; } - + munin::plugin { apt_all: ensure => present; } } class munin::plugins::vserver inherits munin::plugins::base { - - plugin { + munin::plugin { [ netstat, processes ]: ensure => present; } +} + +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::centos inherits munin::plugins::base { +} + + + +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"} +} + +class munin::plugins::physical inherits munin::plugins::base { + munin::plugin { iostat: } +} + +class munin::plugins::muninhost inherits munin::plugins::base { + munin::plugin { munin_update: } + munin::plugin { munin_graph: } +} + +class munin::plugins::domU inherits munin::plugins::base { } + +class munin::plugins::djbdns inherits munin::plugins::base { + munin::plugin::deploy { "tinydns": } +} + +class munin::plugins::apache inherits munin::plugins::base { + include apache::status + munin::plugin{ "apache_accesses": } + munin::plugin{ "apache_processes": } + munin::plugin{ "apache_volume": } + munin::plugin::deploy { "apache_activity": } +} + +class munin::plugins::selinux inherits munin::plugins::base { + munin::plugin::deploy { "selinuxenforced": } + munin::plugin::deploy { "selinux_avcstats": } +} +class munin::plugins::postgres inherits munin::plugins::base { + munin::plugin::deploy { "pg_conn": } + munin::plugin::deploy { "pg__connections": ensure => false } + munin::plugin::deploy { "pg__locks": ensure => false } } |