maozishuai 2012-06-17
一. Smokeping 简介
1.1 Smokeping简介:
Smokeping 是rrdtool 的作者Tobi Oetiker 的作品,是用Perl 写的,主要是监视网络性能,包括常规的ping,用echoping监控www 服务器性能,监视dns 查询性能,监视ssh 性能等。底层也是rrdtool做支持,特点是画的图非常漂亮,网络丢包和延迟用颜色和阴影来表示。
1.2 Smokeping 架构组件
Smokeping 有以下组件组成:RRDtool、Fping、Echoping、Curl、Dig、SSh、Perl 模块,Perl、SpeedyCGI、Apache 等。
master/slave 的工作方式,可以在多个节点收集同一个监测点的数据;
1.3 Smokeping 相关资源
1> Smokeping 官方网站:http://oss.oetiker.ch/smokeping
2> Smokeiping 相关软件下载地址:
具体下载目录在 /2012年资料/6月/17日/Linux下构建Smokeping网络监控平台/
二.Smokeping 安装
2.1 准备工作
[root@smokeping ~]# uname -a
Linux smokeping.www.linuxidc.com 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:54 EDT 2009 i686 i686 i386 GNU/Linux
[root@smokeping ~]# cat /etc/RedHat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
[root@smokeping ~]# perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi
….
先暂时关闭iptables以及selinux刨除其他影响
构建本地yum数据库
[root@smokeping ~]# cat /etc/yum.repos.d/server.repo
[rhel-server]
name=Red Hat Enterprise Linux server
baseurl=file:///mnt/cdrom/Server/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
[rhel-vt]
name=Red Hat Enterprise Linux vt
baseurl=file:///mnt/cdrom/VT/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
[rhel-cluster]
name=Red Hat Enterprise Linux cluster
baseurl=file:///mnt/cdrom/Cluster/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
[rhel-clusterstorage]
name=Red Hat Enterprise Linux clusterstorage
baseurl=file:///mnt/cdrom/ClusterStorage/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
[root@smokeping ~]#
[root@smokeping ~]# mkdir /mnt/cdrom
[root@smokeping ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@smokeping ~]# yum list all
2.2 安装rrdtool
RRDTool 是由Tobias Oetiker 开发的开源软件,它使用RRD(Round Rebin Databases)作为存储格式,Round robin 是一种处理定量数据以及当前元素指针的技术,RRDTool 主要用来跟踪对象的变化情况,生成改对象变化的趋势图。
[root@smokeping ~]# cd /root/smokeping/
[root@smokeping smokeping]# ls
cgilib-0.5.tar.gz
CGI-SpeedyCGI-2.22.tar.gz
echoping-6.0.2.tar.gz
fping.tar.gz
rrdtool-1.4.4.tar.gz
smokeping-2.4.2.tar.gz
# 安装依赖的软件包:
[root@smokeping smokeping]# yum -y install freetype freetype-devel libpng libpng-devel gd gd-devel libxml2 libxml2-devel libiconv libiconv-devel pango pango-devel qpixman qpixman-devel glib glib-devel cairo cairo-devel libart* gettext gettext-devel libjpeg libjpeg-devel perl-XML-Simple.noarch perl-Crypt-SSLeay perl-Digest-HMAC
使rrdtool支持中文
[root@smokeping smokeping]# cat /etc/sysconfig/i18n
LANG="zh_CN.UTF-8"
[root@smokeping smokeping]# export LANG="zh_CN.UTF-8"
[root@smokeping smokeping]# yum -y install fonts-chinese
安装rrdtool
[root@smokeping smokeping]# tar -zxvf rrdtool-1.4.4.tar.gz -C /usr/local/src/
[root@smokeping smokeping]# cd /usr/local/src/rrdtool-1.4.4/
[root@smokeping rrdtool-1.4.4]# ls
[root@smokeping rrdtool-1.4.4]# sed -i 's/setlocale(LC_NUMERIC, "C")/setlocale(LC_ALL, "zh_CN.UTF-8")/g' src/rrd_graph.c
[root@smokeping rrdtool-1.4.4]# sed -i 's/setlocale(LC_NUMERIC, old_locale)/setlocale(LC_ALL, old_locale)/g' src/rrd_graph.c
[root@smokeping rrdtool-1.4.4]# ./configure --prefix=/usr/local/rrdtool [root@smokeping rrdtool-1.4.4]# make && make install
执行rrdtool 命令,如果出现以下输出,表示安装成功,并列出了该命令的使用帮助。
[root@smokeping rrdtool-1.4.4]# cd /usr/local/rrdtool/bin/
[root@smokeping bin]# ll
total 400
-rwxr-xr-x 1 root root 95492 Jun 17 09:50 rrdcached
-rwxr-xr-x 1 root root 46362 Jun 17 09:50 rrdcgi
-rwxr-xr-x 1 root root 41520 Jun 17 09:50 rrdtool
-rwxr-xr-x 1 root root 207192 Jun 17 09:50 rrdupdate
[root@smokeping bin]# ./rrdtool
RRDtool 1.4.4 Copyright 1997-2010 by Tobias Oetiker
Compiled Jun 17 2012 09:50:49
Usage: rrdtool [options] command command_options
Valid commands: create, update, updatev, graph, graphv, dump, restore,
last, lastupdate, first, info, fetch, tune,
resize, xport, flushcached
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
For more information read the RRD manpages
[root@smokeping bin]#