MUNIN是一个基于WEB界面的系统监视工具,MUNIN是一个基于WEB界面的系统监视工具。munin主要对系统 网络 磁盘 进程 应用等访问进行监控。可以很直观的在图上的曲线看出运行情况
MUNIN的安装有2种方式,一个是去munin上下载源代码进行编译,不过要解决不少依赖问题。
二是进行yum安装,这样可以避免依赖问题。
centos默认情况下不能进行munin的yum安装。先要安装yum-priorities
1;
用于 CentOS 5 安装源的 yum-priorities 软件包:
yum install yum-priorities
i386 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
x86_64 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
2.
我的centos是64位的,下载如下:
wget http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
3;
rpm -Uvh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
#cd /etc/yum.repos.d/
# ls
CentOS-Base.repo CentOS-Base.repo.bak mirrors-rpmforge
CentOS-Base.repo.5 CentOS-Media.repo rpmforge.repo
有了这个RPMforge Repository的源就可以开始yum 安装munin
4 服务端安装
#yum install munin munin-node
安装完毕之后
#cd /etc/munin
# ls
munin.conf munin-node.conf plugins
munin-node.confdafault plugins.conf
plugin-conf.d templates
需要在你web服务器的静态目录中创建一个目录 munin
#mkdir -p /usr/local/nginx/html/htdocs/munin/
#chown -R munin:munin /usr/local/nginx/html/htdocs/munin/
简单设置 munin的配置文件/etc/munin/munin.conf
vi /etc/munin/munin.conf
dbdir /var/lib/munin
htmldir /usr/local/nginx/html/htdocs/munin/
logdir /var/log/munin
rundir /var/run/munin
tmpldir /etc/munin/templates
[localhost]
address 127.0.0.1
use_node_name yes
#添加一个客户端
[db]
address 172.32.1.1
use_node_name yes
[db2]
address 172.32.1.2
use_node_name yes
设置 munin启动脚步并启动 munin
#chkconfig --levels 235 munin-node on
#/etc/init.d/munin-node start
Starting Munin Node: [ OK ]
# ps fax|grep munin
11627 pts/2 S+ 0:00 \_ grep munin
11548 ? Ss 0:00 /usr/sbin/munin-node
#cd /var/log/munin
# ls
munin-graph.log munin-limits.log munin-update.log
munin-html.log munin-node.log
# tail -f /var/log/munin/munin-html.log
Sep 17 12:00:11 - processing service: netstat
Sep 17 12:00:11 - processing service: open_files
Sep 17 12:00:11 - processing service: open_inodes
Sep 17 12:00:11 - processing service: processes
Sep 17 12:00:11 - processing service: sendmail_mailqueue
Sep 17 12:00:11 - processing service: sendmail_mailstats
Sep 17 12:00:11 - processing service: sendmail_mailtraffic
Sep 17 12:00:11 - processing service: swap
Sep 17 12:00:11 - processing service: vmstat
# ll /usr/local/nginx/html/htdocs/munin/
-rw-r--r-- 1 munin munin 2555 Sep 17 12:00 definitions.html
-rw-r--r-- 1 munin munin 1470 Sep 17 12:00 index.html
-rw-r--r-- 1 munin munin 473 Sep 17 12:00 logo.png
-rw-r--r-- 1 munin munin 3538 Sep 17 12:00 style.css
drwxr-xr-x 2 munin munin 4096 Sep 17 12:00 localhost
5;客户端安装,我的客户端也是centos5.6
在客户端主机上,只需要安装munin-node就可以了
当然首先还是得重复一下服务器端的前面2步
yum install yum-priorities
wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.i386.rpmrpm -Uvh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
yum install -y munin-node
cd /etc/munin
vi munin-node.conf
添加服务端的ip
allow ^172\.32\.1\.19$ #这个就是munin主服务器上的IP,允许这个IP对我的访问.
#/etc/init.d/munin-node restart
cat /var/log/munin/munin-node.log
在apache/nginx中配置一个虚拟主机
ServerName www.ff-bb.cn
DocumentRoot "/var/www/html/munin"
过几分钟,访问这个域名即可看到数据。