Ubuntu 16.04 に Munin(CGI) + Nginx をインストール・設定
Ubuntu 16.04 に Munin(CGI) + Nginx をインストール・設定しました。
日本語の情報が見当たらなかったので、備忘録です。
日本語の情報が見当たらなかったので、備忘録です。
Munin インストール
sudo apt-get install munin munin-node spawn-fcgi
Munin 設定
設定ファイルを変更
/etc/munin/munin.conf$ diff munin.conf munin.conf.org 12,15d11 < dbdir /var/lib/munin < htmldir /var/cache/munin/www < logdir /var/log/munin < rundir /var/run/munin 20d15 < tmpldir /etc/munin/templates 46d40 < graph_strategy cgi 76d69 < html_strategy cgi
Munin 再起動
$ sudo /etc/init.d/munin restart $ sudo /etc/init.d/munin-node restart
Munin CGI 設定
CGIログのオーナを設定
$ sudo chown munin /var/log/munin/munin-cgi-*.log
起動スクリプト 作成
$ cat /lib/systemd/system/munin-fastcgi-graph.service [Unit] Description=FastCGI spawner for Munin Graph [Service] ExecStart=/usr/bin/spawn-fcgi -s /var/run/munin/fastcgi-graph.sock \ -P /var/run/munin/fastcgi-graph.pid -U www-data -u munin -g munin \ /usr/lib/munin/cgi/munin-cgi-graph Type=forking PIDFile=/var/run/munin/fastcgi-graph.pid Restart=always SyslogIdentifier=munin-fastcgi-graph [Install] WantedBy=multi-user.target
$ cat /lib/systemd/system/munin-fastcgi-html.service [Unit] Description=FastCGI spawner for Munin Html [Service] ExecStart=/usr/bin/spawn-fcgi -s /var/run/munin/fastcgi-html.sock \ -P /var/run/munin/fastcgi-html.pid -U www-data -u munin -g munin \ /usr/lib/munin/cgi/munin-cgi-html Type=forking PIDFile=/var/run/munin/fastcgi-html.pid Restart=always SyslogIdentifier=munin-fastcgi-html [Install] WantedBy=multi-user.target
Munin CGI 起動・設定
$ sudo service munin-fastcgi-graph start $ sudo service munin-fastcgi-html start $ sudo systemctl enable munin-fastcgi-graph.service $ sudo systemctl enable munin-fastcgi-html.service
Nginx インストール
sudo apt-get install nginx
Nginx 設定
設定ファイルを変更
$ cat /etc/nginx/sites-available/default server { ... location ^~ /munin-cgi/munin-cgi-graph/ { fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*); fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass unix:/var/run/munin/fastcgi-graph.sock; include fastcgi_params; } location /munin/static/ { alias /etc/munin/static/; } location /munin/ { fastcgi_split_path_info ^(/munin)(.*); fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass unix:/var/run/munin/fastcgi-html.sock; include fastcgi_params; } ... }※一部省略してます
Nginx 再起動
$ sudo /etc/init.d/nginx restart
コメント
コメントを投稿