Setup monitoring with Munin
mouse 2260 · person cloud · link
Last update
2017-11-03
2017
11-03
« — »
1
apt-get install munin munin-plugins-extra

select desidred plugins by creating/deleting links in /etc/munin/plugins from /usr/share/munin/plugins:

1
2
3
4
5
6
7
8
9
10
11
12
# ls -l /etc/munin/plugins | sed -r 's/.* (.+ -> .+)/\1/' | column -t
cpu       ->  /usr/share/munin/plugins/cpu
cpuspeed  ->  /usr/share/munin/plugins/cpuspeed
df        ->  /usr/share/munin/plugins/df
df_inode  ->  /usr/share/munin/plugins/df_inode
fail2ban  ->  /usr/share/munin/plugins/fail2ban
load      ->  /usr/share/munin/plugins/load
memory    ->  /usr/share/munin/plugins/memory
swap      ->  /usr/share/munin/plugins/swap
uptime    ->  /usr/share/munin/plugins/uptime
users     ->  /usr/share/munin/plugins/users
vmstat    ->  /usr/share/munin/plugins/vmstat

set your custom munin options, copy /etc/munin/munin.conf in /etc/munin/munin-conf.d/local.conf and edit it:

1
2
3
4
5
# save sdcard writes see tmpfs-folders script
dbdir   /run/shm/tmpfs-folders/munin/db
htmldir /run/shm/tmpfs-folders/munin/www
logdir  /run/shm/tmpfs-folders/munin/log
rundir  /run/shm/tmpfs-folders/munin/run

also set log_file in /etc/munin/munin-node.conf:

1
2
# save sdcard writes see tmpfs-folders script
log_file /run/shm/tmpfs-folders/munin/log/munin-node.log

configure nginx:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
server {
  listen 1234;
  server_name munin;
  index  index.html index.htm;

  try_files  $uri  $uri/  =404;

  location / {
    rewrite ^/$ munin/localdomain/localhost.localdomain/ redirect; break;
  }

  location /munin/static/ {
    alias /run/shm/tmpfs-folders/munin/www/static/;
    expires modified +1w;
  }

  location /munin/ {
    alias /run/shm/tmpfs-folders/munin/www/;
    expires modified +310s;
  }
} # server