munin监控配置

来源:互联网 发布:mks软件 编辑:程序博客网 时间:2024/05/04 21:52

 1;
用于 CentOS 5 安装源的 yum-priorities 软件包:
    yum install yum-priorities
2;
 RPMforge

    可以在 http://dag.wieers.com/packages/ 获得 RPMforge 软件包的一个完整的列表。

    下载 rpmforge-release 包。选择以下两个链接中匹配你的 OS 架构(i386/x86_64)的那个下载。如果不能确定是那种架构,请运行 uname -i 命令。

    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

3;
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

4;
服务端安装
先增加个用户 munin

yum install munin munin-node httpd
如果没有安装apahce 需要添加上httpd参数


[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

5;
客户端安装
操作系统是ubuntu9.04
下面尝试安装一个客户端:192.168.1.94在客户端主机上,只需要安装munin-node就可以了
lxu@lxu-laptop:~$ sudo apt-cache search munin
[sudo] password for lxu:
munin - network-wide graphing framework (grapher/gatherer)
munin-node - network-wide graphing framework (node)
mailping - monitor email service availability and functioning
munin-plugins-extra - network-wide graphing framework (user contributed plugins for node)
virt-goodies - A collection of helpful virtualisation related tools

lxu@lxu-laptop:~$ sudo apt-get install munin-node 
将会安装下列额外的软件包:
libio-multiplex-perl libnet-cidr-perl libnet-server-perl libnet-snmp-perl
建议安装的软件包:
libio-socket-ssl-perl libcrypt-des-perl libdigest-hmac-perl
libdigest-sha1-perl libio-socket-inet6-perl munin munin-plugins-extra
liblwp-useragent-determined-perl libnet-irc-perl mysql-client smartmontools
下列【新】软件包将被安装:
libio-multiplex-perl libnet-cidr-perl libnet-server-perl libnet-snmp-perl
munin-node

lxu@lxu-laptop:/etc/munin$ cat munin-node.conf|sed '/^#/d'|sed '/^$/d'
log_level 4
log_file /var/log/munin/munin-node.log
pid_file /var/run/munin/munin-node.pid
background 1
setseid 1
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)$
ignore_file /.pod$
allow ^127/.0/.0/.1$
allow ^192/.168/.1/.19$ #这个就是我们的munin主服务器上的IP,允许这个IP对我的访问.
host *
port 4949
$ sudo /etc/init.d/munin-node restart

 

原创粉丝点击