139 lines
3.7 KiB
Plaintext
Executable File
139 lines
3.7 KiB
Plaintext
Executable File
#!/command/with-contenv bash
|
|
|
|
####################
|
|
# Munin
|
|
####################
|
|
echo "---------- Setting up munin config ----------"
|
|
if [ ! -d "/opt/munin" ] ; then
|
|
mkdir /opt/munin
|
|
fi
|
|
if [ ! -f "/opt/munin/munin.conf" ] ; then
|
|
cat > /opt/munin/munin.conf <<EOF
|
|
dbdir /opt/munin/db
|
|
htmldir /opt/munin/www
|
|
logdir /opt/munin/log
|
|
rundir /opt/munin/run
|
|
cgitmpdir /opt/munin/cgi-tmp
|
|
|
|
graph_strategy cron
|
|
html_strategy cron
|
|
|
|
timeout 15
|
|
|
|
[munin.local]
|
|
address 127.0.0.1
|
|
use_node_name yes
|
|
EOF
|
|
fi
|
|
if [ ! -f "/opt/munin/munin-node.conf" ] ; then
|
|
cat > /opt/munin/munin-node.conf <<EOF
|
|
log_level 4
|
|
log_file /opt/munin/log/munin-node.log
|
|
pid_file /opt/munin/munin-node.pid
|
|
|
|
background 0
|
|
setsid 0
|
|
|
|
user munin
|
|
group munin
|
|
|
|
# Regexps for files to ignore
|
|
ignore_file [\#~]\$
|
|
ignore_file DEADJOE\$
|
|
ignore_file \.bak\$
|
|
ignore_file %\$
|
|
ignore_file \.dpkg-(tmp|new|old|dist)\$
|
|
ignore_file \.rpm(save|new)\$
|
|
ignore_file \.pod\$
|
|
|
|
allow ^127\.0\.0\.1\$
|
|
allow ^::1\$
|
|
|
|
host 127.0.0.1
|
|
port 4949
|
|
EOF
|
|
fi
|
|
rm /etc/munin/munin-node.conf
|
|
ln -sf /opt/munin/munin-node.conf /etc/munin/munin-node.conf
|
|
rm /etc/munin/munin.conf
|
|
ln -sf /opt/munin/munin.conf /etc/munin/munin.conf
|
|
echo "---------- Setting up munin directories ---------"
|
|
if [ ! -d "/opt/munin/log" ] ; then
|
|
mkdir /opt/munin/log
|
|
fi
|
|
chown munin: /opt/munin/log
|
|
if [ ! -d "/opt/munin/run" ] ; then
|
|
mkdir /opt/munin/run
|
|
fi
|
|
chown munin: /opt/munin/run
|
|
if [ ! -d "/opt/munin/db" ] ; then
|
|
mkdir /opt/munin/db
|
|
fi
|
|
chown munin: /opt/munin/db
|
|
if [ ! -d "/opt/munin/www" ] ; then
|
|
mkdir /opt/munin/www
|
|
fi
|
|
chown munin: /opt/munin/www
|
|
if [ ! -d "/opt/munin/cgi-tmp" ] ; then
|
|
mkdir /opt/munin/cgi-tmp
|
|
fi
|
|
chown munin: /opt/munin/cgi-tmp
|
|
if [ ! -f "/opt/munin/log/munin-update.log" ] ; then
|
|
touch /opt/munin/log/munin-update.log
|
|
chown munin: /opt/munin/log/munin-update.log
|
|
fi
|
|
echo "---------- Setting up lighttpd munin config ----------"
|
|
if [ ! -f "/opt/munin/lighttpd-munin.conf" ] ; then
|
|
cat > /opt/munin/lighttpd-munin.conf <<EOF
|
|
server.username = "munin"
|
|
server.groupname = "munin"
|
|
|
|
server.document-root = "/opt/munin/www"
|
|
server.port = 2813
|
|
|
|
server.errorlog = "/dev/stdout"
|
|
accesslog.filename = "/dev/stdout"
|
|
dir-listing.activate = "disable"
|
|
server.modules = (
|
|
"mod_access",
|
|
"mod_accesslog",
|
|
"mod_alias",
|
|
"mod_rewrite",
|
|
"mod_redirect",
|
|
"mod_cgi",
|
|
"mod_fastcgi",
|
|
"mod_auth",
|
|
"mod_authn_file",
|
|
)
|
|
server.pid-file = "/run/lighttpd-munin.pid"
|
|
server.follow-symlink = "enable"
|
|
index-file.names = ( "index.html", "index.htm" )
|
|
|
|
url.redirect += ( "^/*$" => "/munin/" )
|
|
|
|
\$HTTP["url"] =~ "/munin-cgi/munin-cgi-graph" {
|
|
alias.url += ( "/munin-cgi/munin-cgi-graph" => "/usr/lib/munin/cgi/munin-cgi-graph" )
|
|
cgi.assign = ( "" => "" )
|
|
}
|
|
|
|
alias.url += ( "/munin/static" => "/etc/munin/static" )
|
|
alias.url += ( "/munin" => "/opt/munin/www" )
|
|
|
|
mimetype.assign = (
|
|
".html" => "text/html",
|
|
".txt" => "text/plain",
|
|
".css" => "text/css",
|
|
".js" => "application/x-javascript",
|
|
".jpg" => "image/jpeg",
|
|
".jpeg" => "image/jpeg",
|
|
".gif" => "image/gif",
|
|
".png" => "image/png",
|
|
"" => "application/octet-stream"
|
|
)
|
|
EOF
|
|
fi
|
|
echo "---------- Munin node setup ----------"
|
|
rm /etc/munin/plugin-conf.d/*
|
|
munin-node-configure --shell --remove-also --debug | sh -x
|
|
#su - munin --shell=/bin/sh /usr/bin/munin-cron
|