cheng029 发表于 2012-10-15 17:16:38

centos6.3安装配置smokeping2.6.8

由于公司需要监控机房的网络质量无奈只能安装smokeping,鉴于网上的教程大多都是老版本的,所以今天我就讲诉一下我在centos上安装新版本的过程,有些得不好的地方还请大家多多原谅。以下所有安装包请到http://www.iyunv.com/thread-1589-1-1.html这里下载。
1.先关闭selinux和清空iptables
vim /etc/selinux/config
SELINUX=disabled
iptables -F
2.更改国内比较快的yum源,我修改为ustc的,个人感觉他比较快。
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
vim CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#YunVN.com
#

name=CentOS-$releasever - Base - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#released updates

name=CentOS-$releasever - Updates - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful

name=CentOS-$releasever - Extras - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages

name=CentOS-$releasever - Plus - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users

name=CentOS-$releasever - Contrib - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
ok,准备工作已做好,下面我们开始安装了。
3.安装环境所需要的yum包
yum -yinstall libxml2-devel libpng-devel glib pango pango-devel freetypefreetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel perl perl-Net-Telnet perl-Net-DNSperl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6perl-CGI-SpeedyCGI rrdtool-perl
4.安装rrdtool
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
tar zxvf rrdtool-1.4.7.tar.gz
cd rrdtool-1.4.7
./configure --prefix=/usr/local/rrdtool
make && make install
5.安装smokeping依赖的软件
【cgilib】
tar zxvf cgilib-0.5.tar.gz
cd cgilib-0.5
make
cp libcgi.a /usr/local/lib
cp cgi.h /usr/include
【fping-2.4b2_to】
tar zxvf fping.tar.gz
cd fping-2.4b2_to
./configure
make
make check
make install
whereis fping
fping: /usr/local/sbin/fping
【echoping】
tar zxvf echoping-6.0.0.tar.gz
cd echoping-6.0.0
./configure
make
make test
遇到测试不成功等信息就 ctrl+c 回到命令行;
make install
whereis echoping
echoping: /usr/local/bin/echoping/usr/local/lib/echoping
安装echoping是有可能会报错,这是因为缺少popt支持,我们需要安装popt
要安装popt还需要gettext的支持,首先安装gettext
tar zxvf gettext-0.18.tar.gz
cd gettext-0.18
./configure
make && make install
cd ..
tar zxvf popt-1.10.4.tar.gz
cd popt-1.10.4
./configure
make && make install
cd ..
cd echoping-6.0.0
./configure
make && make install
6.安装smokeping
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz
tar zxvf smokeping-2.6.8.tar.gz
cd smokeping-2.6.8
./configure –prefix=/usr/local/smokeping
编译的时候会报错提示缺少很多的扩展程序,这时候我们只需要执行一个安装脚本就好了
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
等他安装完再继续编译安装
./configure –prefix=/usr/local/smokeping
gmake install
安装完毕,下面修改配置文件。
进入bin目录,修改smokeping文件
#vim smokeping
第八行:         use lib qw(); # PERL5LIB
修改为:   use lib qw(/usr/local/rrdtool/lib/perl);
进入htdocs目录
# mv smokeping.fcgi.dist smokeping.fcgi
进入etc目录
cp config.dist config
修改config文件
#vim config
以下自行修改为自己需要的
owner = YunVN
contact =
mailhost =
修改报警邮箱
*** Alerts ***
to = smc@yunvn.com
from = smokeping@yunvn.com
*** Probes ***
+ FPing
binary = /usr/sbin/fping##修改为实际路径
binary = /usr/local/sbin/fping

监控主机是分层结构的,用+号表示
例如+第一层 ++第二层 +++第三层 根据自己情况修改;
在这里,设备名中不能有”.”和“-”,应该还有其他的字符我没有遇到的。
master/slave方式以及其他的一些功能后续补充
+ Test
menu= local
#parents = owner:/Test/James location:/
++ Yunvn
menu = localhost
title =localhost
host = localhost
下面附录我的配置文件,仅供参考。
# cat etc/config
*** General ***
owner    = YunVN
contact= kernelsky@126.com
mailhost = my.mail.host
sendmail = /usr/sbin/sendmail
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed ... this is not
# good for images.
# This is www.iyunv.com smokeping server!
imgcache = /usr/local/smokeping/cache
imgurl   = cache
datadir= /usr/local/smokeping/data
piddir= /usr/local/smokeping/var
cgiurl   = http://172.18.85.213/smokeping.cgi
smokemail = /usr/local/smokeping/etc/smokemail.dist
tmail = /usr/local/smokeping/etc/tmail.dist
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no
*** Alerts ***
to = kernelsky@126.com
from = smokealert@iyunv.com
+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 timesin a row
*** Database ***
step   = 30#这里是数据刷新时间,默认是300s,我设置为30s刷新
pings    = 20
# consfn mrhb steps total
AVERAGE0.5   11008
AVERAGE0.5124320
    MIN0.5124320
    MAX0.5124320
AVERAGE0.5 144   720
    MAX0.5 144   720
    MIN0.5 144   720
*** Presentation ***
template = /usr/local/smokeping/etc/basepage.html.dist
+ charts
menu = Charts
title = The most interesting destinations
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
++ max
sorter = Max(entries=>5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
++ loss
sorter = Loss(entries=>5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
++ median
sorter = Median(entries=>5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
+ overview
width = 600
height = 50
range = 10h
+ detail
width = 600
height = 200
unison_tolerance = 2
"Last 3 Hours"    3h
"Last 30 Hours"   30h
"Last 10 Days"    10d
"Last 400 Days"   400d
#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location
*** Probes ***
+ FPing
binary = /usr/local/sbin/fping
*** Slaves ***
secrets=/usr/local/smokeping/etc/smokeping_secrets.dist
+boomer
display_name=boomer
color=0000ff
+slave2
display_name=another
color=00ff00
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of xxx Company. \
         Here you will learn all about the latency of our network.
+ Test
menu= local
#parents = owner:/Test/James location:/
++ James
menu = localhost
title =localhost
host = localhost
+DianXinTong
menu = Storage
++Storage
menu = Storage
title = Stoage
host = 192.168.0.2
创建存放数据文件的目录
mkdir c/usr/local/smokeping/data /usr/local/smokeping/var /usr/local/smokeping/cache
修改smokeping的目录为apache运行用户的属主、组
chown -R daemon.daemon smokeping/
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
chmod –R 777 /usr/local/smokeping/cache /usr/local/smokeping/data /usr/local/smokeping/var
创建smokeping的log文件
touch /var/log/smokeping.log
chown daemon.daemon /var/log/smokeping.log
启动smokeping
perl /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log
建立smokeping启动脚本,方便启动
vim /etc/init.d/smokeping
添加为以下内容:
#!/bin/bash
#
# chkconfig: 2345 80 05
# Description: Smokeping init.d script
# Hacked by : YunVN - http://www.yunvn.com
# Get function from functions library
. /etc/init.d/functions
# Start the service Smokeping
start() {
echo -n "Starting Smokeping: "
/usr/local/smokeping/bin/smokeping >/dev/null 2>&1
### Create the lock file ###
touch /var/lock/subsys/smokeping
success $"Smokeping startup"
echo
}
# Restart the service Smokeping
stop() {
echo -n "Stopping Smokeping: "
kill -9 `ps ax | grep "/usr/local/smokeping/bin/smokeping" | grep -v grep | awk '{ print $1 }'` >/dev/null 2>&1
### Now, delete the lock file ###
rm -f /var/lock/subsys/smokeping
success $"Smokeping shutdown"
echo
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status Smokeping
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
给脚本有可执行权限
# chmod 755 /etc/init.d/smokeping
设置开机启动smokeping
Chkconfigure –level 35 smokeping on
配置apache
#vim /etc/httpd/conf/httpd.conf
最后加入
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
Alias /cache "/usr/local/smokeping/cache"
Alias /cropper "/usr/local/smokeping/htdocs/cropper/"
<Directory /usr/local/smokeping>
      AllowOverride None
       AddHandler cgi-script cgi fcgi
      Options ExecCGI
      Order allow,deny
      Allow from all
      DirectoryIndex smokeping.cgi
</Directory>
设置开机启动httpd
Chkconfigure –level 35 smokeping on
好了,至此安装配置完成;
访问http://IP/smokeping













起来跑步 发表于 2013-5-20 17:19:19

本帖最后由 起来跑步 于 2013-5-20 17:20 编辑

有些系统需要安装下面几个东西:
yum -y install perl-CPAN popt-devel libidn

3个没有地址的安装包。
wgethttp://www.infodrom.org/projects ... d/cgilib-0.5.tar.gz
wgethttp://slackbuilds.org/slackbuilds/13.0/network/fping.tar.gz
wgethttp://jaist.dl.sourceforge.net/ ... hoping-6.0.0.tar.gz

zzss 发表于 2012-10-17 09:13:52

{:6_388:}{:6_389:}

zzss 发表于 2012-10-17 09:14:17

看不懂说的都是些什么。

magic 发表于 2012-11-20 17:21:46

骗人的。2.6.8 明明是2.42来的。

雪狼sunnylinux 发表于 2012-12-12 15:07:11

楼主写的很好但是中间有很多环节都是无法执行下去的,软件的包的安装前后顺序导致很乱,无法完成安装

13432878738 发表于 2013-5-15 17:57:03

俺从不写措字,但俺写通假字!

jarod8016b 发表于 2013-5-15 21:17:22

不在放荡中变坏,就在沉默中变态!

起来跑步 发表于 2013-5-20 17:17:53

这是目前最全的一个安装smokeping的文档了,安装完特意注册来感谢。本来想补充几个安装包的链接,原来注册访问就有了,回复给没有注册的人吧。

夏末秋初 发表于 2014-3-2 23:16:02

高手 佩服

一日分胜负 发表于 2014-3-3 13:45:46

!!!!!!!!!!顶

一日分胜负 发表于 2014-3-3 13:45:56

!!!!!!!!!!顶

ST-calvin 发表于 2014-6-18 16:54:14

{:6_410:}{:6_410:}{:6_410:}

ST-calvin 发表于 2014-6-18 16:54:38

真心不会做。。。求yum源

ST-calvin 发表于 2014-6-18 16:55:06

安装过程还没有图片

jimmysh 发表于 2014-9-9 14:37:37

目前最全的教程,谢谢

qqqqqqr 发表于 2016-5-12 10:05:36

haohao

qqqqqqr 发表于 2016-5-12 10:05:44

hao

qqqqqqr 发表于 2016-5-12 10:07:32

haohao

qqqqqqr 发表于 2016-5-12 10:09:13

hhh
页: [1] 2
查看完整版本: centos6.3安装配置smokeping2.6.8