284354749 发表于 2015-9-7 14:11:47

安装Munin监控替代Cacti | Alex's blog

  安装Munin监控替代Cacti | Alex's blog

安装Munin监控替代Cacti

FreeBSD && Linux, VPS && hosting
Add comments
  这次添加第二台服务器的时候是在受不了Cacti了,全都换成了Munin监控。
  在CentOS5上安装的话,Munin并没有在官方的yum源中,需要自己手工添加yum源:
  #rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
#wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
#rpm -Uvh epel-release-5-4.noarch.rpm
  centos6的话可能需要安装epel6.5的版本:
  wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
rpm -ivh epel-release-6-5.noarch.rpm
  然后在创建一个文件:/etc/yum.repos.d/dag.repo
  #vim /etc/yum.repos.d/dag.repo

name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1
  弄完以后就可以通过yum来安装Munin了。
  1. 监控端(生成Munin图表的server)安装:
  #yum -y install munin
  2. 被监控端(提供运行数据的server)安装:
  #yum -y install munin-node
  3. 监控端配置:
Munin不用设置用户,只需要制定一个发布图表的目录即可,当然这个目录最好是web服务器中的目录,这样就能够直接通过web服务器查看监控信息了:
  # vim /etc/munin/munin.conf
Configfile for Munin master
dbdir       /var/lib/munin/
htmldir   /var/www/munin/
#如果/var/www是web服务器的主目录的话,就在里面创建一个用户名为munin的目录否则munin无法写入;名称随便可以起,例子中的名称也是munin
logdir      /var/log/munin
rundir      /var/run/munin/
  # This is an example of the correct way to activate Nagios warnings
contact.nagios.command /usr/local/nagios/bin/send_nsca nagioshost.example.com -c /usr/local/nagios/etc/send_nsca.cfg -to 60
  # From and including the first host, no more global directives can be defined.
# Everything after one host definition belongs to that host, until another host definition is found.
               # 创建一个名为foo.example.com的监控
#
address 12.23.34.56         #被监控的IP地址为12.23.34.56
  4. 被监控端配置
  # vim /etc/munin/munin-node.conf
log_level 4
log_file /var/log/munin/munin-node.log
port 4949
pid_file /var/run/munin/munin-node.pid
background 1
host *
user root
group root
setsid yes
ignore_file ~$
ignore_file \.bak$
ignore_file %$
ignore_file \.dpkg-(tmp|new|old|dist)$
ignore_file \.rpm(save|new)$
# host_name localhost.localdomain
allow ^127\.0\.0\.1$
#指定自己允许被那个IP地址监控,写成正则表达式的格式,例如允许被12.21.34.43监控就写成allow ^12\.21\.34\.43$
  然后分别启动监控端的munin服务和被监控端的munin-node服务即可。第一次画图会比较慢,等几个小时后图形就正常了。
监控服务端启动:
  #service munin start
#chkconfig munin on //为了保证服务开机启动
  被监控段启动:
  #service munin-node start
#chkconfig munin-node on //为了保证服务开机启动
页: [1]
查看完整版本: 安装Munin监控替代Cacti | Alex's blog