Munin セットアップ
Nid: 1224
1 . 監視対象サーバ Munin インストール
$ sudo apt-get install munin-node
2 . 監視対象サーバ設定
監視サーバアドレス 192.168.1.1 の例
$ sudo vi /etc/munin/munin-node.conf allow ^192\.168\.1\.1$ $ sudo systemctl restart munin-node.service $ sudo systemctl enable munin-node.service $ sudo ufw allow from 192.168.1.1 to any port 4949
3 . 監視対象サーバ Nginx 設定
$ sudo vi /etc/nginx/sites-available/default location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; allow ::1; deny all; } $ sudo nginx -t && sudo nginx -s reload $ curl http://localhost/nginx_status Active connections: 1 server accepts handled requests 1323 1323 2600 Reading: 0 Writing: 1 Waiting: 0 $ cd /etc/munin/plugins $ sudo ln -s /usr/share/munin/plugins/nginx_request $ sudo ln -s /usr/share/munin/plugins/nginx_status $ sudo vi /etc/munin/plugin-conf.d/munin-node [nginx*] env.url http://localhost/nginx_status $ sudo /etc/init.d/munin-node restart $ tail /var/log/munin/munin-node.log
4 . 監視サーバ Munin インストール
$ sudo apt-get install munin munin-node spawn-fcgi
5 . 監視サーバ設定
$ sudo vi /etc/munin/munin.conf dbdir /var/lib/munin htmldir /var/www/html/munin logdir /var/log/munin rundir /var/run/munin $ sudo /etc/init.d/munin restart $ sudo /etc/init.d/munin-node restart $ sudo -u munin munin-cron
6 . 監視サーバ Nginx 設定
$ sudo vi /etc/nginx/sites-available/munin.example.com server { listen 80; listen [::]:80; root /var/cache/munin/www/; index index.php index.html; server_name munin.example.com; } $ sudo ln -s /etc/nginx/sites-available/munin.example.com /etc/nginx/sites-enabled/ $ sudo nginx -t && sudo nginx -s reload
7 . 監視画面
ブラウザで http://munin.example.com へアクセス
8 . プラグイン状況確認
$ sudo munin-node-configure -suggest Plugin | Used | Suggestions ------ | ---- | ----------- acpi | no | no [failed to find thermal zones below /sys/class/thermal/thermal_zone*] amavis | no | no apache_accesses | no | no [LWP::UserAgent not found] ...