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初学者也是一个难 ...
随机推荐
- 科技感满满,华为云DevCloud推出网页暗黑模式
近期,华为云DevCloud推出了暗黑模式,让用户在网页端也可以体验到桌面级应用才有的特性. 深色模式(Dark Mode),俗称暗黑模式.是近2年以来用户呼声最高的功能之一,一些国外顶级厂商都将 ...
- pyppteer下
目录 启动pyppteer 切图 获取响应头,响应头状态,cookies 获取当前页面标题 获取页面html 第一种:获取整个页面html 第二种:只获取文本 注入JS,控制上下滚动 选择器 获取元素 ...
- Centos7访问Win7/Win10系统中的共享文件
服务器挂在U盘: 1.先将U盘格式化为Fat格式或其他服务器能识别的格式. 2.使用fdisk -l,找到自己的U盘(根据盘大小) 3.新建一个文件夹(mkdir /mnt/usb)用于挂在数据 4. ...
- Python小技巧:如何批量更新已安装的库?
众所周知,升级某个库(假设为 xxx),可以用pip install --upgrade xxx 命令,或者简写成pip install -U xxx . 如果有多个库,可以依次写在 xxx 后面,以 ...
- SOFA入门
简介 scalable open financial architecture stack , 可扩展开放的金融架构栈: github: https://github.com/sofastack/so ...
- NO.2 TI开发环境的搭建 SDK+Code Composer Studio
首先我们要了解TI嵌入式开发环境 对于TI嵌入式开发,首先我们要下载SDK软件包,其次要准备编译环境Code Composer Studio. 对于SDK的下载,可以在官网浏览http://www.t ...
- 什么,容器太多操作不过来?我选择Docker Compose梭哈
接上一篇:面试官:你说你精通 Docker,那你来详细说说 Dockerfile 吧 一.容器之间通信 1.单向通信 1.1.什么意思 mysql和tomcat是两个独立的容器,但是tomcat需要和 ...
- [Objective-C] 003_内存管理
Objective-C内存管理,基本原理. 1.为什么要进行内存管理? 由于移动设备的内存极其有限,所以分配每个APP使用的内存也是有限制的,app运行时内存占用较多的话,系统就会发出内存警告,严重时 ...
- 01)原生php写一个小网站
PHP留言板说明 1.帮朋友做一个毕业设计,本科大学生,都不知道框架是什么...只能原生PHP写了. 2.这里主要是做一个学习笔记. 3.项目开始会杂乱无章,慢慢整理. 需求 (1)用户注册:用户实现 ...
- 04 . Nginx的Rewrite重写
Rewrite简介 # Rewrite对应URL Rewrite,即URL重写,就是把传入web的请求重定向到其他URL的过程. # 当运维遇到要重写情况时,往往是要程序员把重写规则写好后,发给你,你 ...