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

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