munin监控配置

本文介绍如何在CentOS 5系统上安装并配置Munin监控系统,包括服务端与客户端的安装步骤,以及如何添加RPMforge Repository源以获取所需软件包。此外,还介绍了如何安装MySQL插件来增强Munin的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

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

 

 

官方插件下载地址:http://exchange.munin-monitoring.org/plugins/search?keyword=mysql

 

mysql plugin

首先,补充一个munin没有的plugin,下载: mysql_munin.tar.gz

  1. 将 mysql_munin.tar.gz 解压缩到 /usr/share/munin/plugins
  2. 在 /etc/munin/plugins 建立link
    ln -s /usr/share/munin/plugins/mysql_* /etc/munin/plugins
    rm -f /etc/munin/plugins/mysql_isam_space_
  3. 修改 /etc/munin/plugin-conf.d/munin-node,增加
    [mysql*]
    user root # 使用此插件的系统用户
    env.mysqladmin /usr/local/mysql/bin/mysqladmin # mysqladmin命令的完整路径
    env.mysqlopts -uroot -pfnm_2008_fnm # mysql的用户名密码
  4. service munin-node restart
  5. 验证安装,telnet localhost 4499 之后,执行 fetch mysql_queries

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值