Centos7上smokeping安装

Centos7上Smokeping安装

一、安装软件

1、添加镜像源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2、安装Apache
yum -y install httpd httpd-devel gcc make curl wget
3、安装rrdtool
  • a.安装依赖的库
yum -y install libxml2-devel libpng-devel glib pango pango-devel \ 
freetype freetype-devel fontconfig cairo cairo-devel \ 
libart_lgpl libart_lgpl-devel
  • b.安装rrdrool
yum -y install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl
yum -y install perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI 
yum -y install perl-FCGI perl-CGI-SpeedCGI perl-Time-HiRes perl-ExtUtils-MakeMaker
yum -y install perl-RRD-Simple rrdtool rrdtool-per
4、安装smokeping依赖的软件
yum install mod_fcgid bind-utils -y
5、本地安装
#下载安装包:
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
  • a.安装依赖包:
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
  • b.解压、编译安装fping
tar xf fping-3.10.tar.gz
cd fping-3.10
./configure
make && make install
  • c.解压、编译安装echoping
tar xf echoping-6.0.2.tar.gz
cd echoping-6.0.2
./configure
make && make install
  • d.解压、编译安装smokeping
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

出现报错:

Can’t locate Sys/Syslog.pm in @INC (@INC contains:
/usr/local/smokeping/thirdparty/lib/perl5/x86_64-linux-thread-multi
/usr/local/smokeping/thirdparty/lib/perl5 …/lib
/usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl
/usr/lib64/perl5 /usr/share/perl5 .) at …/lib/Smokeping.pm line 16.

解决办法:

yum -y install perl-Sys-Syslog #缺包了,安装这个就OK

二、配置参数

1、配置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
vi /usr/local/smokeping/etc/config 
#修改如下内容:
cgiurl=http://你的ip/smokeping.cgi
 *** Database ***
  step = 300  此处建议改为 120    #刷新时间秒
2、编辑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>

#102行修改如下内容

<Directory />  
    Options Indexes FollowSymLinks  
    AllowOverride None  
</Directory></span>  

在这里插入图片描述

3、图像浏览界面的中文支持
yum -y install wqy-zenhei-fonts.noarch  #安装字体
4、编辑Graphs.pm
vi /usr/local/smokeping/lib/Smokeping/Graphs.pm
#在第147行,下边插入这一行代码
'--font TITLE:20:"WenQuanYi Zen Hei Mono"',

在这里插入图片描述

5、smokeping的默认配置文件110行的fping安装目录与此次安装目录不相符需修改!
vi /usr/local/smokeping/etc/config
#第110更改fping的目录为
binary = /usr/local/sbin/fping

OK 现在可以打开页面了 http://ip/smokeping

6、测试数据可自定义
vi /usr/local/smokeping/etc/config   #编辑smokeping配置文件
#末尾添加:
+ gateway
menu = 网关
title = 网关(192.168.1.1)
host = 192.168.1.1
alerts = someloss
7.设置配置文件与日志文件位置
/usr/local/smokeping/bin/smokeping --config=/usr/local/smokeping/etc/config --logfile=/usr/local/smokeping/var/smokeping.log  
systemctl restart httpd                         #重启服务
/usr/local/smokeping/bin/smokeping --restart

稍等一会网页会出现内容
在这里插入图片描述
https://www.cnblogs.com/openacl/p/5872067.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章