Munin 安装配置

来源:互联网 发布:淘宝店铺店招装修工具 编辑:程序博客网 时间:2024/05/18 20:10
# uname -r
2.6.18-53.el5


用第三方的RPMforge Repository yum源来快速安装munin

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
[root@192 ~]# rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
warning: rpmforge-release-0.3.6-1.el5.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing...                ########################################### [100%]
1:rpmforge-release       ########################################### [100%]
安装后在/etc/yum.repos.d文件夹中生成mirrors-rpmforge rpmforge.repo 配置信息。
[root@192 ~]# cd /etc/yum.repos.d/
[root@192 yum.repos.d]# ls
CentOS-Base.repo    CentOS-Base.repo.bak  mirrors-rpmforge
CentOS-Base.repo.5  CentOS-Media.repo     rpmforge.repo
有了这个RPMforge Repository的源就可以轻松的开始munin

安装和配置 munin
执行yum 完成安装


yum install munin munin-node httpd
如果没有安装apahce 需要添加上httpd参数
=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
munin                   noarch     1.2.5-2.el5.rf   rpmforge          128 k
Installing for dependencies:
perl-DateManip          noarch     5.44-1.2.1       base              144 k
perl-HTML-Template      noarch     2.9-1.el5.rf     rpmforge           62 k
perl-rrdtool            i386       1.3.8-2.el5.rf   rpmforge           51 k
rrdtool                 i386       1.3.8-2.el5.rf   rpmforge          913 k
xorg-x11-fonts-Type1    noarch     7.1-2.1.el5      base       

Installing:
munin-node              noarch     1.2.5-2.el5.rf   rpmforge          148 k
Installing for dependencies:
perl-Compress-Raw-Bzip2  i386       2.021-1.el5.rf   rpmforge          108 k
perl-Compress-Raw-Zlib  i386       2.021-1.el5.rf   rpmforge          169 k
perl-Crypt-DES          i386       2.05-3.2.el5.rf  rpmforge           37 k
perl-Digest-HMAC        noarch     1.01-15          base               12 k
perl-Digest-SHA1        i386       2.12-1.el5.rf    rpmforge           73 k
perl-HTML-Parser        i386       3.62-1.el5.rf    rpmforge          148 k
perl-HTML-Tagset        noarch     3.20-1.el5.rf    rpmforge           14 k
perl-IO-Compress        noarch     2.021-1.el5.rf   rpmforge          238 k
perl-Net-SNMP           noarch     5.2.0-1.2.el5.rf  rpmforge           96 k
perl-Net-Server         noarch     0.97-1.el5.rf    rpmforge          157 k
perl-Socket6            i386       0.23-1.el5.rf    rpmforge           49 k
perl-libwww-perl        noarch     5.805-1.1.1      base              376 k
Transaction Summary
=============================================================================




[root@192 munin]# pwd
/etc/munin
[root@192 munin]# ls
munin.conf         munin-node.conf         plugins
munin-node.confdafault  plugins.conf
plugin-conf.d           templates

# mkdir /var/www/html/munin
# mkdir /var/run/munin
# mkdir /etc/munin/templates

这个很重要否则日志会报错
chown -R munin:munin /etc/munin/templates
chown -R munin:munin /var/www/html/munin
简单设置 munin的配置文件/etc/munin/munin.conf
vi /etc/munin/munin.conf
内容如下:
dbdir    /var/lib/munin
htmldir    /var/www/html/munin
logdir    /var/log/munin
rundir  /var/run/munin
tmpldir    /etc/munin/templates
[localhost]
address 127.0.0.1
use_node_name yes
#添加一个客户端
[lxu]
address 192.168.1.94
use_node_name yes

设置 munin启动脚步并启动 munin
chkconfig --levels 235 munin-node on
/etc/init.d/munin-node start

[root@192 ~]# /etc/init.d/munin-node start
Starting Munin Node:                                       [  OK  ]
[root@192 ~]# ps fax|grep munin
11627 pts/2    S+     0:00          \_ grep munin
11548 ?        Ss     0:00 /usr/sbin/munin-node

[root@192 munin]# pwd
/var/log/munin
[root@192 munin]# ls
munin-graph.log  munin-limits.log  munin-update.log
munin-html.log   munin-node.log



[root@192 munin]# 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
Sep 17 12:00:11 - munin-html finished

[root@192 munin]# ll /var/www/html/munin/
total 20
-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

 

启动munin

    在运行前我们还有一步工作要做,那就是更改/var/www/munin目录的权限

Java代码  收藏代码
  1. chown munin.munin -R /var/www/munin  
  2. sudo /etc/init.d/munin-node start  

   现在munin就已经在工作了,你可以在 /var/www/munin下边看到它生成html内容,当然这样看很不方便,我们可以利用nginx来看这些内容,现在我们配置一下nginx。

指向Tomcat ,Tomcat 中的server.xml配置 

  <Context path="/" docBase="/var/www/html/munin" debug="0" reloadable="false" crossContext="true"  allowLinking="true"/>




原创粉丝点击