共计 6565 个字符,预计需要花费 17 分钟才能阅读完成。
CentOS 6.x 环境下搭建 SmokePing
一、环境准备
[root@SmokePing src]# cat /etc/RedHat-release
CentOS release 6.5 (Final)
[root@SmokePing src]# cd /usr/local/src/
[root@SmokePing src]# yum install -y lrzsz
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lrzsz.x86_64 0:0.12.20-27.1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================
Package Arch Version Repository Size
========================================================================================
Installing:
lrzsz x86_64 0.12.20-27.1.el6 base 71 k
Transaction Summary
========================================================================================
Install 1 Package(s)
Total download size: 71 k
Installed size: 159 k
Downloading Packages:
lrzsz-0.12.20-27.1.el6.x86_64.rpm | 71 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lrzsz-0.12.20-27.1.el6.x86_64 1/1
Verifying : lrzsz-0.12.20-27.1.el6.x86_64 1/1
Installed:
lrzsz.x86_64 0:0.12.20-27.1.el6
Complete!
[root@SmokePing src]# rz -E #将下载好的软件拖拽至服务器
rz waiting to receive.
[root@SmokePing src]# ll
总用量 2200
-rw-r--r--. 1 root root 1660983 8 月 23 2017 echoping-6.0.2.tar.gz
-rw-r--r--. 1 root root 157010 8 月 23 2017 fping-3.10.tar.gz
-rw-r--r--. 1 root root 427185 8 月 23 2017 smokeping-2.6.9.tar.gz
二、环境部署
1) 安装依赖包
[root@SmokePing src]# yum install -y 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
2) 编译安装 echoping
[root@SmokePing src]# tar zxvf echoping-6.0.2.tar.gz
[root@SmokePing src]# cd ./echoping-6.0.2
[root@SmokePing echoping-6.0.2]# ./configure
...........................................................................# 编译过程
[root@SmokePing echoping-6.0.2]# make && make install
3) 编译安装 fping
[root@SmokePing src]# tar zxvf fping-3.10.tar.gz && cd fping-3.10
[root@SmokePing fping-3.10]# ./configure
.............................................................................# 编译过程
[root@SmokePing fping-3.10]# make && make install
4) 编译安装 smokeping
[root@SmokePing src]# tar zxvf smokeping-2.6.9.tar.gz && cd smokeping-2.6.9
[root@SmokePing smokeping-2.6.9]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
[root@SmokePing smokeping-2.6.9]# ./configure --prefix=/usr/local/smokeping
[root@SmokePing smokeping-2.6.9]# /usr/bin/gmake install
5)配置 smokeping,以及修改配置文件
[root@SmokePing smokeping-2.6.9]# cd /usr/local/smokeping/
[root@SmokePing smokeping]# mkdir cache data var
[root@SmokePing smokeping]# touch /var/log/smokeping.log
[root@SmokePing smokeping]# chown apache:apache cache data var
[root@SmokePing smokeping]# chown apache:apache /var/log/smokeping.log
[root@SmokePing smokeping]# chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
[root@SmokePing smokeping]# cd /usr/local/smokeping/htdocs
[root@SmokePing htdocs]# mv smokeping.fcgi.dist smokeping.fcgi
[root@SmokePing htdocs]# cd /usr/local/smokeping/etc
[root@SmokePing etc]# mv config.dist config
--------------------------- 分割线 --------------------------------------------------
[root@SmokePing etc]# vim /usr/local/smokeping/etc/config #修改配置文件
# cgiurl = http://some.url/smokeping.cgi
cgiurl = http://192.168.195.137/smokeping.cgi
step = 60
charset = utf-8 #在 50 行添加
binary = /usr/local/sbin/fping
+ Other
menu = 三大网络监控
title = 监控统计
++ dianxin
menu = 电信网络监控
title = 电信网络监控列表
host = /Other/dianxin/dianxin-bj /Other/dianxin/dianxin-hlj /Other/dianxin/dianxin-tj /Other/dianxin/dianxin-sc /Other/dianxin/dianxin-sh /Other/dianxin/dianxin-gz
+++ dianxin-bj
menu = 北京电信
title = 北京电信
alerts = someloss
host = 202.96.199.133
+++ dianxin-hlj
menu = 黑龙江电信
title = 黑龙江电信
alerts = someloss
host = 219.147.198.242
+++ dianxin-tj
menu = 天津电信
title = 天津电��
alerts = someloss
host = 219.150.32.132
+++ dianxin-sc
menu = 四川电信
title = 四川电信
alerts = someloss
host = 61.139.2.69
+++ dianxin-sh
menu = 上海电信
title = 上海电信
alerts = someloss
host = 116.228.111.118
+++ dianxin-gz
menu = 广东电信
title = 广东电信
alerts = someloss
host = 113.111.211.22
++ liantong
menu = 联通网络监控
title = 联通网络监控列表
host = /Other/liantong/liantong-bj /Other/liantong/liantong-hlj /Other/liantong/liantong-tj /Other/liantong/liantong-sc /Other/liantong/liantong-sh /Other/liantong/liantong-gz
+++ liantong-bj
menu = 北京联通
title = 北京联通
alerts = someloss
host = 61.135.169.121
+++ liantong-hlj
menu = 黑龙江联通
title = 黑龙江联通
alerts = someloss
host = 202.97.224.69
+++ liantong-tj
menu = 天津联通
title = 天津联通
alerts = someloss
host = 202.99.96.68
+++ liantong-sc
menu = 四川联通
title = 四川联通
alerts = someloss
host = 119.6.6.6
+++ liantong-sh
menu = 上海联通
title = 上海联通
alerts = someloss
host = 210.22.84.3
+++ liantong-gz
menu = 广东联通
title = 广东联通
alerts = someloss
host = 221.5.88.88
++ yidong
menu = 移动网络监控
title = 移动网络监控列表
host = /Other/yidong/yidong-bj /Other/yidong/yidong-hlj /Other/yidong/yidong-tj /Other/yidong/yidong-sc /Other/yidong/yidong-sh /Other/yidong/yidong-gz
+++ yidong-bj
menu = 北京移动
title = 北京移动
alerts = someloss
host = 221.130.33.52
+++ yidong-hlj
menu = 黑龙江移动
title = 黑龙江移动
alerts = someloss
host = 211.137.241.35
+++ yidong-tj
menu = 天津移动
title = 天津移动
alerts = someloss
host = 211.137.160.5
+++ yidong-sc
menu = 四川移动
title = 四川移动
alerts = someloss
host = 218.201.4.3
+++ yidong-sh
menu = 上海移动
title = 上海移动
alerts = someloss
host = 117.131.19.23
+++ yidong-gz
menu = 广东移动
title = 广东移动
alerts = someloss
host = 211.136.192.6 # 至此配置修改完成
echo 'export PATH=/usr/local/smokeping/bin/:$PATH' >> /etc/profile #编辑完配置文件后,设置环境变量
6)修改 http 的配置文件
[root@SmokePing etc]# vim /etc/httpd/conf/httpd.conf #在最后添加如下配置,按 'G' 可直接跳到最后
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)修改 Graphs.pm 配置
[root@SmokePing etc]# vim /usr/local/smokeping/lib/Smokeping/Graphs.pm
'--font TITLE:20:"WenQuanYi Zen Hei Mono"', #147 行下插入,按:147 可跳转到该行
三、测试
1)启动服务:
[root@SmokePing etc]# /etc/init.d/httpd restart
停止 httpd:[确定]
正在启动 httpd:httpd: apr_sockaddr_info_get() failed for SmokePing
httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
[确定]
———————————————————————————————————–
[root@SmokePing etc]# /usr/local/smokeping/bin/smokeping start
WARNING: Hostname ‘james.address’ does currently not resolve to an IPv6 or IPv4 address
Note: logging to syslog as local0/info.
Daemonizing /usr/local/smokeping/bin/smokeping …
2) 打开 http://192.168.195.137/smokeping #如果打不开,尝试关闭 selinux,检查 smokeping 的配置文件
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-12/149505.htm