資源監控工具Munin


Munin 是一款優秀的性能監控工具,採用client-server模式,支持同時監控多個節點,並且以web的方式展現出來。

Munin 功能介紹

Munin 可監控服務器的所有方面,包括最重要的CPU,MEMORY,DISK,IO等等。同時支持監控多組服務器,並以圖形化的方式展現出來。下圖爲Munin的監控CPU的圖形界面。


Munin的組織架構

Munin Master 會定時的向node取數據。圖來自munin guide doc.


Munin的安裝

客戶端安裝(以Centos 6 爲例):

安裝epel yum源:
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -ivh epel-release-latest-6.noarch.rpm
Clean yum 並安裝munin-node
yum clean all
yum install munin-node

安裝完以後配置/etc/munin/munin-node.conf ,把服務器地址配置成allow,並去掉幾個文件夾的註釋#
allow ^127\.0\.0\.1$
allow ^::1$
allow ^10\.128\.1\.232$

重啓munin-mode,並確保從服務器可以telnet到客戶端的4949端口。服務器地址變化後需要重啓munin-node
/etc/init.d/munin-node restart


服務器端安裝(以Centos 7 爲例):
安裝epel yum 源:
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm

clean yum 並安裝munin,以及用於作爲web 服務器的nginx
yum install munin
yum install nginx

配置/etc/munin/munin.conf 加客戶端地址:
dbdir   /var/lib/munin
htmldir /var/www/html/munin
logdir /var/log/munin
rundir  /var/run/munin# Where to look for the HTML templates#
tmpldir /etc/munin/templates

[147]
    address 10.128.1.147
    use_node_name yes

配置/etc/nginx/nginx.conf
修改nginx user 爲munin
user munin;
替換原nginx.conf 中的地址server配置端,替換爲如下配置,並打開Iptables的8080端口,讓外面機器可以訪問。
server {
        listen       8080;
        server_name  _;
        location /munin {
                #alias /var/cache/munin/www/;
                alias  /var/www/html/munin/;
        }

        location ^~ /cgi-bin/munin-cgi-graph/ {
                access_log off;
                fastcgi_split_path_info ^(/cgi-bin/munin-cgi-graph)(.*);
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass unix:/var/run/munin/fcgi-graph.sock;
                include fastcgi_params;
        }

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        error_page  404              /404.html;
        location = /404.html {
            root   /usr/share/nginx/html;
        }

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
    }

啓動nginx,幾分鐘後就可以看到監控畫面了。
systemctl start nginx








發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章