一、前言:
Munin是通过客户端-服务器架构收集数据并将其图形化的工具。Munin允许你跟踪你的主机的运行记录,就是所谓的‘节点’,然后将它们发送到中央服务器,随后你就能在这里以图像形式展示它们。
二、环境:
①、系统:Centos5.5(安装apache)
②、服务器信息
服务端:172.16.34.235
客户端:172.16.34.236/237/238
③、munin-2.0.8
三、准备工作:
①、升级yum源:
wget http://archive.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
这样在yum list中包含最新的Munin软件包,使用yum安装:
四、服务端安装配置:
yum -y install munin munin-common munin-node httpd
安装完毕。
②、配置httpd:
Munin安装将它的配置文件放在目录/etc/munin下,我们从服务端开始。
在/etc/httpd/conf/httpd.conf中创建一个虚拟主机可以用来图形化显示我们的节点状态:<VirtualHost *:81>
<VirtualHost *:81>
ServerAdmin webmaster@localhost
ServerName munin.qqiss.com
DocumentRoot /var/www/html/munin
<Directory "/var/www/html/munin">
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "munin access"
AuthType Basic
AuthUserFile /etc/munin/htpasswd.users
Require valid-user
</Directory>
LogLevel notice
CustomLog /var/log/apache2/munin.access.log combined
ErrorLog /var/log/apache2/munin.error.log
ServerSignature On
</VirtualHost>
为httpd设置访问用户:
$ htpasswd -c /etc/munin/htpasswd.users admin
admin:V5ClUKxzeoWD.
③、munin配置:
最后,我们也必须在munin.conf文件中定义所有将向服务器发送报告的节点主机,命令是:
[root@CentOS5-A munin]# cat /etc/munin/munin.conf |grep -v ^#|grep -v ^$
dbdir /var/lib/munin
htmldir /var/www/html/munin
logdir /var/log/munin
rundir /var/run/munin
tmpldir /etc/munin/templates
includedir /etc/munin/conf.d
graph_strategy cron
html_strategy cron
[web]
address 127.0.0.1
use_node_name yes
[webserver1]
address 172.16.34.236
use_node_name yes
[webserver2]
address 172.16.34.237
use_node_name yes
[webserver3]
address 172.16.34.238
use_node_name yes
[root@CentOS5-A munin]#
括号中是每个节点的名字,后面是它的IP地址,use_node_name命令控制munin命名节点的方式,如果后面跟的参数为yes就是用括号中的值来命名,如果是no则将执行一个DNS查询。
至此,服务端已经配置好了
启动:
/etc/init.d/httpd restart
五、客户端节点配置:
①、安装
yum -y munin-common munin-node
客户端主要的配置文件是/etc/munin/munin-node.conf文件,大多数配置信息都不需要改变,但是你需要更改allow选项,它控制哪一个主机能访问munin和检索统计。我们用IP地址来配置munin服务器,例如: allow ^172\.16\.34\.235$
正如你看到的,IP地址必须用perl常用格式来输入。如果你的munin服务器不只一台,那么你可以用多行允许命令来定义它们。
②、启动:
/etc/init.d/munin-node restart默认开启4949端口
[root@CentOS5-C soft]# netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:750 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:4949 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::ffff:172.16.34.237:22 ::ffff:172.16.34.220:50274 ESTABLISHED
[root@CentOS5-C soft]#
六、测试
ie里输入:http://172.16.34.235:81
转载于:https://blog.51cto.com/hanxiaoqi/1096808