SmokePing 快速搭建
SmokePing介绍
环境介绍
fping-4.1
echoping-6.0.2
smokeping 2.7.3
CentOS Linux release 7.5.1804 (Core)
localhost.localdomain
3.10.0-862.11.6.el7.x86_64
下面就smokeping网络监控环境部署过程做一记录:
1.安装apache及所依赖包
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 perl-Sys-Syslog perl-core -y
2.安装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 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 -y
4. 本地安装
wget wget https://github.com/schweikert/fping/releases/download/v4.1/fping-4.1.tar.gz
wget https://fossies.org/linux/misc/old/echoping-6.0.2.tar.gz
wget https://oss.oetiker.ch/smokeping/pub/smokeping-2.7.3.tar.gz
tar xf fping-4.1.tar.gz
cd fping-4.1
./configure
make && make install
tar xf echoping-6.0.2.tar.gz
cd echoping-6.0.2
./configure --prefix=/usr/local/echoping --with-ssl --without-libidn
make && make install
##centos 7 最好用2.7.x 的版本
##centos 6 最好用2.6.x 的版本
tar xf smokeping-2.7.3.tar.gz
cd smokeping-2.7.3
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty ##2.6.9 版本的需要执行 2.7.3 测试可不执行
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install
出现编码错误
vim /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 configx
修改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 /css "/usr/local/smokeping/htdocs/css"
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
Alias /js "/usr/local/smokeping/htdocs/js/"
<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
vim /usr/local/smokeping/etc/config
*** Presentation ***
charset = UTF-8 #添加这行,解决出图乱码问题
template = /usr/local/smokeping/etc/basepage.html.dist
vim /usr/local/smokeping/lib/Smokeping/Graphs.pm
#在第160行,下边插入这一行代码
'--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 "<div>RRDtool did not understand your input: $ERROR.</div>" if $ERROR;
$val = $graphret->[0] if $val < $graphret->[0];
}
$val = 1e-6 if $val =~ /nan/i;
$max = { $tasks[0][1] => $val * 1.5 };
}
8、测试数据可自定义
9、smokeping的默认配置文件110行的fping安装目录与此次安装目录不相符需修改!
vi /usr/local/smokeping/etc/config
#第110更改fping的目录为
binary = /usr/local/sbin/fping
10、apache访问没有权限
vim /etc/httpd/conf/httpd.conf
# 如果是没有修改过此项配置,那默认的配置如下:
<Directory />
AllowOverride none
Require all denied
</Directory>
# 将默认设置改成如下配置:
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
11、启动apache服务和smokeping服务
/usr/sbin/httpd -k start/restart
[root@localhost ~]# /usr/sbin/httpd -k restart
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf.d/nbox.conf:1
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:443
1.AH00548
vim /etc/httpd/conf.d/nbox.conf
#NameVirtualHost *:80注释掉 2.AH00558
编辑httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80
[root@server conf]# ls
extra httpd.conf magic mime.types original
[root@server conf]# vi httpd.conf
#ServerName www.example.com:80
ServerName localhost:80
再重新启动apache 即可。
3.(98)
进入Apache的安装目录,搜索httpd-ssl.conf,右击文本打开。寻找443替换成其他不常用的端口号,比如442。接下来就可以正常启动Apache了
b、启动smokeping
/usr/local/smokeping/bin/smokeping
12、设置密码
htpasswd -c /usr/local/smokeping/htdocs/htpasswd smokeping
New password:
Re-type new password:
##账号是smokeping,密码自行设置
vim /etc/http/conf/httpd.conf
##修改下边内容
Alias /cache "/opt/smokeping/htdocs/cache/"
Alias /css "/opt/smokeping/htdocs/css/"
Alias /smokeping "/opt/smokeping/htdocs/smokeping.fcgi"
Alias /js "/opt/smokeping/htdocs/js/"
<Directory "/opt/smokeping">
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
DirectoryIndex smokeping.fcgi
</Directory>
##改为以下内容
<Directory "/opt/smokeping">
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
AuthName "Smokeping" ##新加内容
AuthType Basic ##新加内容
AuthUserFile /opt/smokeping/htdocs/htpasswd ##新加内容
Require valid-user ##新加内容
DirectoryIndex smokeping.fcgi
</Directory>
13、设置环境变量
echo 'export PATH=/usr/local/smokeping/bin/:$PATH' >> /etc/profile
14、启动http和smokeping
systemctl restart httpd
/usr/local/smokeping/bin/smokeping
出现错误
Error: RRD parameter mismatch ('Wrong value of step: /usr/local/smokeping/data/user/taishan/smokeping.rrd has 300, create string has 120'). You must delete /usr/local/smokeping/data/user/taishan/smokeping.rrd or fix the configuration parameters.
rm -rf /usr/local/smokeping/data/user/taishan/smokeping.rrd
15、设置开机启动
echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&;1 &;" >> /etc/rc.local
16、config 配置文件
17、最终展示

SmokePing 快速搭建的更多相关文章
- Nginx学习笔记--001-Nginx快速搭建
Nginx ("engine x") 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由Igor Sysoev为俄罗斯访问量第二的R ...
- Github pages + jekyll 博客快速搭建
Github pages + jekyll 博客快速搭建 寻找喜欢的模版 https://github.com/jekyll/jekyll/wiki/sites http://jekyllthemes ...
- NodeJS 最快速搭建一个HttpServer
最快速搭建一个HttpServer 在目录里放一个index.html cd D:\Web\InternalWeb start http-server -i -p 8081
- 利用yeoman快速搭建React+webpack+es6脚手架
自从前后端开始分离之后,前端项目工程化也显得越来越重要了,之前写过一篇搭建基于Angular+Requirejs+Grunt的前端项目教程,有兴趣的可以点这里去看 但是有些项目可以使用这种方式,但有些 ...
- 基于Docker快速搭建多节点Hadoop集群--已验证
Docker最核心的特性之一,就是能够将任何应用包括Hadoop打包到Docker镜像中.这篇教程介绍了利用Docker在单机上快速搭建多节点 Hadoop集群的详细步骤.作者在发现目前的Hadoop ...
- 基于 Jenkins 快速搭建持续集成环境
什么是持续集成 随着软件开发复杂度的不断提高,团队开发成员间如何更好地协同工作以确保软件开发的质量已经慢慢成为开发过程中不可回避的问题.尤其是近些年来,敏捷(Agile) 在软件工程领域越来越红火 ...
- bootstrap快速搭建属于自己的后台模板库
不论做什么项目,我们都以快速搭建为主,设计师固然重要,但是,我们前端开发的也必须能给出自己以前做过什么样的模板,自己收藏的模板,或者我们弹框的形式,我的提示框的形式,我用的下拉框的插件,日历的插件,我 ...
- vuejsLearn---通过手脚架快速搭建一个vuejs项目
开始快速搭建一个项目 通过Webpack + vue-loader 手脚架 https://github.com/vuejs-templates/webpack 按照它的步骤一步一步来 $ npm i ...
- 9款一键快速搭建PHP运行环境的好工具
9款一键快速搭建PHP运行环境的好工具 胡倡萌 2011/02/19 网络资源 77,063 1 内容提要: 建立一个PHP网站,首先需要搭建PHP的开发和运行环境,对于PHP初学者也是一个难 ...
随机推荐
- yield与park的区别
yield表示放弃本次cpu的时间片,但是操作系统在下一个时间片依旧可能会调用该线程/进程 park表示线程/进程睡眠,需要让其他线程/进程唤醒,才有可能重新被操作系统分配时间片, 非自旋锁,底层一般 ...
- css概述四
八.文本格式化 2.文本属性 ①文本颜色 color:合法的颜色值 ②文本对齐方式 text-align: 取值 left/center/right/justify 注意 1.一个元素写了text- ...
- 关于MySQL数据被删除后空间重用的问题实验
以前知道,MySQL在通过delete语句删除数据后,空间并不会被腾出,而只是在数据文件中被标记为已删除,除非执行optimize table.前两天听说,虽然delete数据后硬盘空间不会被腾出,但 ...
- JS 把数字转换成字母
JS 把数字转换成字母 2013-03-12 22:28:11 分类: JavaScript String.fromCharCode(addcount+65) 位运算alert(1<<0 ...
- hdu4757 可持续字典树
Tree Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Sub ...
- CF912D Fishes
题目链接:http://codeforces.com/contest/912/problem/D 题目大意: 在一个\(n \times m\)的网格中放鱼(每个网格只能放一条鱼),用一个\(r \t ...
- [开源] .Net orm FreeSql 1.5.0 最新版本(番号:好久不见)
废话开头 这篇文章是我有史以来编辑最长时间的,历时 4小时!!!原本我可以利用这 4小时编写一堆胶水代码,真心希望善良的您点个赞,谢谢了!! 很久很久没有写文章了,上一次还是在元旦发布 1.0 版本的 ...
- 项目工程化之git提交规范以及 CHANGELOG生成
事先声明,本文是参考了其他大神的博客之后自己尝试的记录,具体可以参考如下 链接 先说说git 提交规范把,这里基本都是这个工具 cz-customizable 1,安装 npm install cz- ...
- 如何利用CSS选择器抓取京东网商品信息
前几天小编分别利用Python正则表达式.BeautifulSoup.Xpath分别爬取了京东网商品信息,今天小编利用CSS选择器来为大家展示一下如何实现京东商品信息的精准匹配~~ CSS选择器 目前 ...
- 【JUC】如何理解线程池?第四种使用线程的方式
线程池的概念 线程池的主要工作的控制运行的线程的数量,处理过程种将任务放在队列,线程创建后再启动折现任务,如果线程数量超过了最大的数量,则超过部分的线程排队等待,直到其他线程执行完毕后,从队列种取出任 ...