Updated munin::server for Munin 2.0

This commit is contained in:
Ossi Salmi 2012-08-27 21:35:32 +03:00
parent 32d897c223
commit a2ca8e60ac
5 changed files with 66 additions and 23 deletions

7
munin/files/cgi-htaccess Normal file
View file

@ -0,0 +1,7 @@
Options +ExecCGI
<IfModule mod_fcgid.c>
SetHandler fcgid-script
</IfModule>
<IfModule !mod_fcgid.c>
SetHandler cgi-script
</IfModule>

View file

@ -0,0 +1,4 @@
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/munin/cgi
RewriteCond %{REQUEST_URI} !^/munin/static
RewriteRule ^(.*)$ cgi/munin-cgi-html/$1 [QSA,PT,L]

View file

@ -0,0 +1,3 @@
<Directory "/srv/www/https/*/munin">
AllowOverride All
</Directory>

View file

@ -55,11 +55,10 @@ class munin::node {
} }
} }
@@file { "/etc/munin/nodes.d/${homename}.conf": @@file { "/etc/munin/conf.d/${homename}.conf":
ensure => present, ensure => present,
content => "[${homename}]\n address ${ipaddress}\n use_node_name yes\n", content => "[${homename}]\n address ${ipaddress}\n use_node_name yes\n",
tag => "munin", tag => "munin",
notify => Exec["generate-munin-conf"],
} }
exec { "munin-node-configure": exec { "munin-node-configure":
@ -104,11 +103,10 @@ define munin::snmpnode($snmp_community="public", $snmp_version="2") {
notify => Service["munin-node"], notify => Service["munin-node"],
} }
@@file { "/etc/munin/nodes.d/${name}.conf": @@file { "/etc/munin/conf.d/${name}.conf":
ensure => present, ensure => present,
content => "[${name}]\n address ${ipaddress}\n use_node_name no\n", content => "[${name}]\n address ${ipaddress}\n use_node_name no\n",
tag => "munin", tag => "munin",
notify => Exec["generate-munin-conf"],
} }
} }
@ -238,9 +236,9 @@ class munin::server {
file { "/var/cache/munin": file { "/var/cache/munin":
ensure => directory, ensure => directory,
mode => "0755", mode => "0775",
owner => "munin", owner => "munin",
group => "munin", group => $apache::sslserver::group,
seltype => "httpd_munin_content_t", seltype => "httpd_munin_content_t",
require => Package["munin"], require => Package["munin"],
} }
@ -253,13 +251,40 @@ class munin::server {
atboot => true, atboot => true,
device => "none", device => "none",
fstype => "tmpfs", fstype => "tmpfs",
options => "uid=munin,gid=munin,mode=0755", options => "uid=munin,gid=${$apache::sslserver::group},mode=0775",
dump => "0", dump => "0",
pass => "0", pass => "0",
require => File["/var/cache/munin"], require => File["/var/cache/munin"],
} }
file { "/etc/munin/nodes.d": file { [ "/var/log/munin/munin-cgi-graph.log",
"/var/log/munin/munin-cgi-html.log", ]:
ensure => present,
mode => "0664",
owner => "munin",
group => $apache::sslserver::group,
require => Package["munin"],
}
file { "/var/www/html/munin/.htaccess":
ensure => present,
mode => "0644",
owner => "root",
group => "root",
source => [ "puppet:///files/munin/htaccess",
"puppet:///modules/munin/munin-htaccess", ],
require => Package["munin"],
}
file { "/var/www/html/munin/cgi/.htaccess":
ensure => present,
mode => "0644",
owner => "root",
group => "root",
source => "puppet:///modules/munin/cgi-htaccess",
require => Package["munin"],
}
file { "/etc/munin/conf.d":
ensure => directory, ensure => directory,
purge => true, purge => true,
force => true, force => true,
@ -271,22 +296,13 @@ class munin::server {
require => Package["munin"], require => Package["munin"],
} }
file { "/etc/munin/munin.conf.in": file { "/etc/munin/munin.conf":
ensure => present, ensure => present,
content => template("munin/munin.conf.in.erb"), content => template("munin/munin.conf.erb"),
owner => "root", owner => "root",
group => "root", group => "root",
mode => "0644", mode => "0644",
require => Package["munin"], require => Package["munin"],
notify => Exec["generate-munin-conf"],
}
exec { "generate-munin-conf":
command => "cat /etc/munin/munin.conf.in /etc/munin/nodes.d/*.conf > /etc/munin/munin.conf",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
user => root,
refreshonly => true,
require => File["/etc/munin/munin.conf.in"],
} }
File <<| tag == "munin" |>> File <<| tag == "munin" |>>
@ -294,12 +310,17 @@ class munin::server {
define configwebhost() { define configwebhost() {
file { "/srv/www/https/${name}/munin": file { "/srv/www/https/${name}/munin":
ensure => link, ensure => link,
target => "/var/cache/munin", target => "/var/www/html/munin",
require => File["/srv/www/https/${name}"], require => File["/srv/www/https/${name}"],
} }
} }
if $munin_webhosts { if $munin_webhosts {
apache::configfile { "munin.conf":
http => false,
source => "puppet:///modules/munin/munin-httpd.conf",
}
configwebhost { $munin_webhosts: } configwebhost { $munin_webhosts: }
} }

View file

@ -2,13 +2,21 @@
# databases, the HTML output, and the logs, severally. They all # databases, the HTML output, and the logs, severally. They all
# must be writable by the user running munin-cron. # must be writable by the user running munin-cron.
dbdir /var/lib/munin dbdir /var/lib/munin
htmldir /var/cache/munin htmldir /var/www/html/munin
logdir /var/log/munin logdir /var/log/munin
rundir /var/run/munin rundir /var/run/munin
cgitmpdir /var/cache/munin
# Where to look for the HTML templates # Where to look for the HTML templates
tmpldir /etc/munin/templates tmpldir /etc/munin/templates
# Number of graph processes # Create html and graphs on-demand
max_graph_jobs <%= processorcount %> html_strategy cgi
graph_strategy cgi
cgiurl_graph /munin/cgi/munin-cgi-graph
# Number of graph processes
munin_cgi_graph_jobs <%= processorcount %>
# Include nodes
includedir /etc/munin/conf.d