CentOS7 源码安装 smokeping 2.7

Stella981
• 阅读 876

[TOC]

1. 安装基础依赖包

安装 epel yum 源和相关基础依赖包。

yum -y install epel-release wget make gcc openssl openssl-devel rrdtool rrdtool-perl perl-core perl mod_fcgid perl-CPAN httpd httpd-devel curl bind-utils gcc make vim gcc-c++ perl-LWP-Protocol-https wqy-microhei-fonts

2. 安装fping

smokeping 2.7.2以上需要fping4.0以上

cd /data/packages
wget https://fping.org/dist/fping-4.2.tar.gz
tar -zxvf fping-4.2.tar.gz
cd fping-4.2
./configure
make
make install

3. 安装echoping

如果使用tcp ping,需要它。

cd /data/packages
wget https://fossies.org/linux/misc/old/echoping-6.0.2.tar.gz
tar -zxvf echoping-6.0.2.tar.gz
cd echoping-6.0.2
yum install -y popt-devel openssl openssl-devel
./configure --with-ssl --without-libidn
make
make install

4. 安装smokeping

源码安装 smokeping 2.7.3。

cd /data/packages
wget https://oss.oetiker.ch/smokeping/pub/smokeping-2.7.3.tar.gz
tar -zxvf smokeping-2.7.3.tar.gz
cd smokeping-2.7.3
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install

5. 配置 smokeping 和 apche

5.1 配置 smokeping

cd /usr/local/smokeping
mkdir var htdocs/{data,cache}
chown apache.apache -R /usr/local/smokeping
touch /var/log/smokeping.log
chown apache.apache /var/log/smokeping.log
cd /usr/local/smokeping/htdocs/
cp smokeping.fcgi.dist smokeping.fcgi
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist

cat > /usr/local/smokeping/etc/config<<EOF
*** General ***
owner    = admin
contact  = some@address.nowhere
mailhost = my.mail.host
sendmail = /usr/sbin/sendmail
imgcache = /usr/local/smokeping/htdocs/cache
imgurl   = cache
datadir  = /usr/local/smokeping/htdocs/data
piddir  = /usr/local/smokeping/var
cgiurl   = http://10.10.23.103/smokeping/smokeping.fcgi
smokemail = /usr/local/smokeping/etc/smokemail.dist
tmail = /usr/local/smokeping/etc/tmail.dist
# specify this to get syslog logging
syslogfacility = local0

*** Alerts ***
to = alertee@address.somewhere
from = smokealert@company.xy

+hostdown
type = loss
# in percent
pattern = ==0%,==0%,==0%,==U
comment = 对端无响应

+hightloss
type = loss
# in percent
pattern = ==0%,==0%,==0%,==0%,>10%,>10%,>10%
comment = 连续3次采样-丢包率超过10%

+lossdetect
type = loss
# in percent
pattern = ==0%,==0%,==0%,==0%,>0%,>0%,>0%
comment = 连续3次采样-存在丢包

+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = 间断性丢包

+rttdetect
type = rtt
# in milli seconds
pattern = <100,<100,<100,<100,<100,<150,>150,>150,>150
comment = 连续3次采样延迟增大-超过150ms

*** Database ***
step     = 60
pings    = 20

# consfn mrhb steps total

AVERAGE  0.5   1  1008
AVERAGE  0.5  12  4320
    MIN  0.5  12  4320
    MAX  0.5  12  4320
AVERAGE  0.5 144   720
    MAX  0.5 144   720
    MIN  0.5 144   720

*** Presentation ***

charset = utf-8
template = /usr/local/smokeping/etc/basepage.html.dist
htmltitle = yes
graphborders = no

+ 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

*** Probes ***
+ FPing
binary = /usr/local/sbin/fping
#可以设置源IP地址,适用于多IP的服务器,(比如组专线内网+公网)服务器
#sourceaddressn = 1.1.1.1

#*** Slaves ***
#secrets=/usr/local/smokeping/etc/smokeping_secrets.dist
#+aliyunShenzhen
#display_name=slave1
#location=China
#color=ff0000
#
#+aliyunHangzhou
#display_name=slave2
#location=China
#color=ff00ff

*** Targets ***
probe = FPing

menu = Top
title = 网络质量监控系统
remark = 如果您是合法管理员,那么欢迎您,如果不是,请立即离开          Only legal administrators are welcome, if you are not, please leave immediately

#加载额外的监控主机(将监控主机,单独成一个文件)
@include targets
EOF

添加监控主机列表文件:

cat > /usr/local/smokeping/etc/targets<<EOF
+ dns
menu = 全球公共DNS网络监控
title = 全球公共DNS网络监控
#slaves = slave1 slave2
#alerts = hostdown,hightloss

++ public-dns
menu = 公共DNS
title = 公共DNS网络监控列表
host = /dns/public-dns/dns-1 /dns/public-dns/dns-2 /dns/public-dns/dns-3 /dns/public-dns/dns-4 /dns/public-dns/dns-5 /dns/public-dns/dns-6 /dns/public-dns/dns-7 /dns/public-dns/dns-8 /dns/public-dns/dns-9 /dns/public-dns/dns-10 /dns/public-dns/dns-11 /dns/public-dns/dns-12 /dns/public-dns/dns-13 /dns/public-dns/dns-14 /dns/public-dns/dns-15 /dns/public-dns/dns-16 /dns/public-dns/dns-17 /dns/public-dns/dns-18 /dns/public-dns/dns-19 /dns/public-dns/dns-20 /dns/public-dns/dns-21 /dns/public-dns/dns-22 /dns/public-dns/dns-23 /dns/public-dns/dns-24

+++ dns-1
menu = 江西移动-211.141.90.68
title = 江西移动-211.141.90.68
host = 211.141.90.68
+++ dns-2
menu = 江西电信-202.101.224.68
title = 江西电信-202.101.224.68
host = 202.101.224.68
+++ dns-3
menu = 江西联通-220.248.192.12
title = 江西联通-220.248.192.12
host = 220.248.192.12
+++ dns-4
menu = 114-DNS-114.114.114.114
title = 114-DNS-114.114.114.114
host = 114.114.114.114
+++ dns-5
menu = 114安全版-114.114.114.119
title = 114安全版-114.114.114.119
host = 114.114.114.119

+++ dns-6
menu = 阿里-223.5.5.5
title = 阿里-223.5.5.5
host = 223.5.5.5
+++ dns-7
menu = 百度-180.76.76.76
title = 百度-180.76.76.76
host = 180.76.76.76
+++ dns-8
menu = DNSPOD-119.29.29.29
title = DNSPOD-119.29.29.29
host = 119.29.29.29
+++ dns-9
menu = CNNIC-1.2.4.8
title = CNNIC-1.2.4.8
host = 1.2.4.8
+++ dns-10
menu = DNS派-218.30.118.6
title = DNS派-218.30.118.6
host = 218.30.118.6

+++ dns-11
menu = 谷歌-8.8.8.8
title = 谷歌-8.8.8.8
host = 8.8.8.8
+++ dns-12
menu = IBMQ9-9.9.9.9
title = IBMQ9-9.9.9.9
host = 9.9.9.9
+++ dns-13
menu = CF-1.1.1.1
title = CF-1.1.1.1
host = 1.1.1.1
+++ dns-14
menu = 科莫多-8.26.56.26
title = 科莫多-8.26.56.26
host = 8.26.56.26
+++ dns-15
menu = GTEI-4.2.2.1
title = GTEI-4.2.2.1
host = 4.2.2.1

+++ dns-16
menu = PCCW-205.252.144.228
title = PCCW-205.252.144.228
host = 205.252.144.228
+++ dns-17
menu = HKIX-202.181.224.2
title = HKIX-202.181.224.2
host = 202.181.224.2
+++ dns-18
menu = 澳门-202.175.3.8
title = 澳门-202.175.3.8
host = 202.175.3.8
+++ dns-19
menu = 中华电信-168.95.192.1
title = 中华电信-168.95.192.1
host = 168.95.192.1
+++ dns-20
menu = 英国-193.0.14.129
title = 英国-193.0.14.129
host = 193.0.14.129

+++ dns-21
menu = 日本-202.12.27.33
title = 日本-202.12.27.33
host = 202.12.27.33
+++ dns-22
menu = 韩国-164.124.101.31
title = 韩国-164.124.101.31
host = 164.124.101.31
+++ dns-23
menu = 洛杉矶hostspace-162.212.181.53
title = 洛杉矶hostspace-162.212.181.53
host = 162.212.181.53
+++ dns-24
menu = 洛杉矶hostspace-1-192.126.112.53
title = 洛杉矶hostspace-2-192.126.112.53
host = 192.126.112.53
EOF

添加 smokeping 为服务:

cat > /usr/lib/systemd/system/smokeping.service<<EOF
[Unit]
Description=Latency Logging and Graphing System
After=syslog.target network.target

[Service]
#ExecStart=/usr/sbin/smokeping --nodaemon  # 2.6 yum install
ExecStart=/usr/local/smokeping/bin/smokeping --nodaemon  --config=/usr/local/smokeping/etc/config --logfile=/var/log/smokeping.log # 2.7 src install
ExecReload=/bin/kill -HUP $MAINPID
StandardError=syslog

[Install]
WantedBy=multi-user.target
EOF

5.2 配置 apache

/etc/httpd/conf/httpd.conf 的行 DocumentRoot "/var/www/html" 后添加内容,如下:

DocumentRoot "/var/www/html"
Alias /smokeping "/usr/local/smokeping/htdocs/"
<Directory "/usr/local/smokeping">
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
AllowOverride AuthConfig
Order allow,deny
Allow from all
AuthName "Smokeping"
AuthType Basic
AuthUserFile /usr/local/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi
</Directory>

htpasswd -c /opt/smokeping/htdocs/htpasswd admin 生成 basic 验证密码。

中文支持,/usr/local/smokeping/etc/basepage.html.dist 的 head 内添加

<META charset="utf-8" />

6. 访问测试

启动 smokeping 和 apache,然后访问 http://10.10.23.103/smokeping/

systemctl daemon-reaload
systemctl start smokeping
systemctl start apache
点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
待兔 待兔
5个月前
手写Java HashMap源码
HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
Wesley13 Wesley13
3年前
Java获得今日零时零分零秒的时间(Date型)
publicDatezeroTime()throwsParseException{    DatetimenewDate();    SimpleDateFormatsimpnewSimpleDateFormat("yyyyMMdd00:00:00");    SimpleDateFormatsimp2newS
Stella981 Stella981
3年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
3年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
3年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
11个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这