Centos 7.2安装smokeping 2.6.11

阅读(1,647)

一:Smokeping 是rrdtool 的作者Tobi Oetiker 的作品,是用Perl 写的,主要是监视网络性能,包括常规的ping,用echoping监控www 服务器性能,监视dns 查询性能,监视ssh 性能等,底层也是rrdtool做支持,特点是画的图非常漂亮,网络丢包和延迟用颜色和阴影来表示,本文介绍如何在Centos 7.2下安装当前最新版的smokeping 2.6.11。

#官方地址:http://oss.oetiker.ch/smokeping/

#官方安装文档:http://oss.oetiker.ch/smokeping/doc/smokeping_install.en.html

1.1解决系统环境:

# yum install ntpdate -y #安装同步时间工具
# ntpdate times.aliyun.com #和阿里云时间服务器同步时间
# 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 perl-CGI-SpeedyCGI perl-Sys-Syslog popt-devel libidn-devel fping 

1.2:从官网下载smokeping并安装:

# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz
# tar xvf smokeping-2.6.11.tar.gz 
# cd smokeping-2.6.11/    
# ./setup/build-perl-modules.sh  /usr/local/smokeping/thirdparty
# ./configure --prefix=/usr/local/smokeping
# /usr/bin/gmake install

1.3:修改配置文件:

# cd /usr/local/smokeping/
# mkdir -pv  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
# cp  smokeping.fcgi.dist smokeping.fcgi
# cd /usr/local/smokeping/etc
# cp config.dist config

1.4:修改apache配置文件:

# vim /etc/httpd/conf/httpd.conf

#<Directory "/var/www/html">  #注释后改为下一行内容
<Directory "/usr/local/smokeping">

1.5:新增一个配置文件:
# vim /etc/httpd/conf.d/someking.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>

 1.6:重启httpd:

# systemctl  restart  httpd

1.7:访问服务器的someking 界面:如果提示没有权限,可以将文件的属主和属组改为apache用户即可:

#在没有做配置之前是没有数据的,如下界面:

 

1.8:配置smokeping:

1.8.1:编辑配置文件# vim /usr/local/smokeping/etc/config 

#cgiurl   = http://some.url/smokeping.cgi #改为下面一行
cgiurl   = http://42.159.142.16/smokeping.cgi #IP为本机的IP 
#修改数据采集时间和间隔,单位为秒
#step     = 300
#pings    = 20
step     = 60
pings    = 60
######################### #Test数据删除
+ Test    
menu= Targets
#parents = owner:/Test/James location:/

++ James

menu = James
title =James
alerts = someloss
slaves = boomer slave2
host = james.address

++ MultiHost

menu = Multihost
title = James and James as seen from Boomer
host = /Test/James /Test/James~boomer 
################### #删除到这里

#添加如下内容:
+ Other
menu = 三大网络监控
title = 监控统计
++ dianxin
menu = 电信网络监控
title = 电信网络监控列表
+++ 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 = 联通网络监控列表
+++ 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 = 移动网络监控列表
+++ 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

#注意这里的语法,+是第一层,++是第二层,+++ 是第三层,添加监控节点一定要按照此规范

 1.9:解决中文显示问题并启动smokeping:

1.9.1:编辑配置文件并安装字体:

#yum -y install wqy-zenhei-font  #安装字体

# vim /usr/local/smokeping/etc/config 

*** Presentation ***
charset = utf-8 #添加此行
template = /usr/local/smokeping/etc/basepage.html.dist

1.9.2:应用字体并启动smokeping: 

# vim /usr/local/smokeping//lib/Smokeping/Graphs.pm 

‘–font TITLE:20″”‘,  #添加此行内容到配置文件

   
1.9.3: 启动smokeping:

/usr/local/smokeping/bin/smokeping #启动
/usr/local/smokeping/bin/smokeping   --restart    #重启
/usr/local/smokeping/bin/smokeping     --reload  #重读配置文件

 1.10:等一端时间之后查看界面是否有数据:

 

1.11:当前版本:
 

 二:关于登陆验证:

此页面不能随意被访问,因此要设置登陆用户验证,方式如下:

2.1:生成密码文件:

# htpasswd -c /usr/local/smokeping/htdocs/htpasswd jack 

New password: 
Re-type new password: 
Adding password for user jack

2.2:编辑apache配置文件,实现登陆验证:

# vim /etc/httpd/conf.d/someking.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  
AuthName "Auth login" #验证提示信息
AuthType Basic #验证方式
AuthUserFile /usr/local/smokeping/htdocs/htpasswd #文件路径
Require valid-user #用户验证
DirectoryIndex smokeping.fcgi
</Directory>

#重启httpd:
# systemctl  restart httpd 

2.3:测试:

2.3.1:重新打开页面
 

2.3.1:输入正确的用户名密码即可通过验证查看页面了:
 

2.3:验证之后就可以正常查看页面了:

 


Warning: count(): Parameter must be an array or an object that implements Countable in /home/nginx/wordpress/wp-includes/class-wp-comment-query.php on line 405

发表评论

邮箱地址不会被公开。 必填项已用*标注