Centos5.6安裝MUNIN
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
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"
過幾分鐘,訪問這個域名即可看到資料。