1.安装apache
yum -y install httpd httpd-devel gcc make curl wget
2.安装rrdtool
yum -y install libxml2-devel libpng-devel glib pango pango-devel \
freetype freetype-devel fontconfig cairo cairo-devel \
libart_lgpl libart_lgpl-devel
yum -y install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl \
perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI \
perl-FCGI perl-CGI-SpeedCGI perl-Time-HiRes perl-ExtUtils-MakeMaker \
perl-RRD-Simple rrdtool rrdtool-per
3.安装smokeping依赖的软件
yum install mod_fcgid bind-utils
4. 本地安装
wget http://www.fping.org/dist/fping-3.10.tar.gz
wget https://fossies.org/linux/misc/old/echoping-6.0.2.tar.gz
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
yum install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-IO-Socket-SSL perl-Socket6 perl-Time-HiRes perl-ExtUtils-MakeMaker rrdtool rrdtool-perl curl httpd httpd-devel gcc make wget libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel popt popt-devel libidn libidn-devel -y
tar xf fping-3.10.tar.gz
cd fping-3.10
./configure
make && make install
tar xf echoping-6.0.2.tar.gz
cd echoping-6.0.2
./configure
make && make install
tar xf smokeping-2.6.9.tar.gz
cd smokeping-2.6.9
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install
修改/usr/local/smokeping/lib/Smokeping.pm
$ENV{LC_NUMERIC}='C';
if (POSIX::setlocale(&POSIX::LC_NUMERIC,"") ne "C") {
die("Resetting LC_NUMERIC failed - try removing LC_ALL from the environment");
}
为:
$ENV{LC_ALL}='zh_CN.UTF-8';
if (POSIX::setlocale(&POSIX::LC_ALL,"") ne "zh_CN.UTF-8") {
die("Resetting LC_NUMERIC failed - try removing LC_ALL from the environment");
}
5. 以下开始配置 smokeping
cd /usr/local/smokeping/
mkdir cache data var
touch /var/log/smokeping.log
chown apache:apache cache data var
chown apache:apache /var/log/smokeping.log
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
cd /usr/local/smokeping/htdocs
mv smokeping.fcgi.dist smokeping.fcgi
cd /usr/local/smokeping/etc
mv config.dist config
vim config
修改如下内容:
cgiurl=http://你的ip/smokeping.cgi
*** Database ***
step = 300 此处建议改为 120
6、编辑apache配置文件
vim /etc/httpd/conf/httpd.conf #在结尾添加如下代码:
Alias /cache "/usr/local/smokeping/cache/"
Alias /cropper "/usr/local/smokeping/htdocs/cropper/"
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
<Directory "/usr/local/smokeping">
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
DirectoryIndex smokeping.fcgi
Directory>
7/图像浏览界面的中文支持
yum -y install wqy-zenhei-fonts.noarch
*** Presentation *** charset = UTF-8 #添加这行,解决出图乱码问题
template = /usr/local/smokeping/etc/basepage.html.dist
编辑Graphs.pm
vi /usr/local/smokeping/lib/Smokeping/Graphs.pm
#在第147行,下边插入这一行代码
'--font TITLE:20:"WenQuanYi Zen Hei Mono"',
if ($mode =~ /[anc]/){
my $val = 0;
for my $host (@hosts){
my ($graphret,$xs,$ys) = RRDs::graph
("dummy",
'--start', $tasks[0][1],
'--end', $tasks[0][2],
"DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",
'--font TITLE:20:"WenQuanYi Zen Hei Mono"',#加在这里
'PRINT:maxping:MAX:%le' );
my $ERROR = RRDs::error();
return "RRDtool did not understand your input: $ERROR." if $ERROR;
$val = $graphret->[0] if $val < $graphret->[0];
}
$val = 1e-6 if $val =~ /nan/i;
$max = { $tasks[0][1] => $val * 1.5 };
}
8、测试数据可自定义
+ lanxin-cn
menu = lanxin-cn
title = lanxin-cn
++ qns4-178020
menu = qns4-178020
title = qns4-178020
alerts = someloss
host = 101.198.178.20
++ qns3-178003
menu = qns3-178003
title = qns3-178003
alerts = someloss
host = 101.198.178.3
9 smokeping的默认配置文件110行的fping安装目录与此次安装目录不相符需修改!
vi /usr/local/smokeping/etc/config
#第110更改fping的目录为
binary = /usr/local/sbin/fping
10 apache访问没有权限
# 如果是没有修改过此项配置,那默认的配置如下:
AllowOverride none
Require all denied
# 将默认设置改成如下配置:
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
11 启动apache服务和smokeping服务
访问地址 ip/smokeping 如123.59.120.208/smokeping