2015-01-28 15:10:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Munin: resource monitoring tool
|
|
|
|
#################################################
|
|
|
|
|
|
|
|
source setup/functions.sh # load our functions
|
|
|
|
source /etc/mailinabox.conf # load global vars
|
|
|
|
|
|
|
|
# install Munin
|
2015-05-25 17:01:53 +00:00
|
|
|
apt_install munin munin-node
|
2015-01-28 15:10:44 +00:00
|
|
|
|
|
|
|
# edit config
|
|
|
|
cat > /etc/munin/munin.conf <<EOF;
|
2015-05-25 17:01:53 +00:00
|
|
|
dbdir /var/lib/munin
|
|
|
|
htmldir /var/cache/munin/www
|
|
|
|
logdir /var/log/munin
|
|
|
|
rundir /var/run/munin
|
|
|
|
tmpldir /etc/munin/templates
|
|
|
|
|
|
|
|
includedir /etc/munin/munin-conf.d
|
|
|
|
|
|
|
|
# a simple host tree
|
|
|
|
[$PRIMARY_HOSTNAME]
|
|
|
|
address 127.0.0.1
|
|
|
|
|
|
|
|
# send alerts to the following address
|
|
|
|
contacts admin
|
|
|
|
contact.admin.command mail -s "Munin notification ${var:host}" administrator@$PRIMARY_HOSTNAME
|
|
|
|
contact.admin.always_send warning critical
|
2015-01-28 15:10:44 +00:00
|
|
|
EOF
|
|
|
|
|
2015-07-22 21:01:17 +00:00
|
|
|
# ensure munin-node knows the name of this machine
|
|
|
|
tools/editconf.py /etc/munin/munin-node.conf -s \
|
|
|
|
host_name=$PRIMARY_HOSTNAME
|
|
|
|
|
2015-05-25 17:01:53 +00:00
|
|
|
# generate initial statistics so the directory isn't empty
|
|
|
|
sudo -u munin munin-cron
|