资源监控工具Munin

来源:互联网 发布:三维动画制作软件 编辑:程序博客网 时间:2024/05/16 08:20


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.rpmrpm -ivh epel-release-latest-6.noarch.rpm
Clean yum 并安装munin-node
yum clean allyum 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.rpmrpm -ivh epel-release-latest-7.noarch.rpm

clean yum 并安装munin,以及用于作为web 服务器的nginx
yum install muninyum 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








0 0
原创粉丝点击