smokeping网络监控

183 篇文章 0 订阅
5 篇文章 0 订阅

简介:使用smokeping来监控idc机房的网络质量情况


一 安装smokeping

查看系统版本(注意:centos7按照此方法安装有问题。)

[root@localhost ~]# cat /etc/redhat-release 
CentOS release 6.8 (Final)

查看内核版本

[root@localhost ~]# uname -r
2.6.32-642.el6.x86_64

安装epel源

[root@localhost ~]# rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm

安装所依赖的软件包

[root@localhost ~]# 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-perl curl fping echoping  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 mod_fastcgi screen

下载软件包到指定位置

[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz

解压软件包

[root@localhost src]# tar zxf smokeping-2.6.9.tar.gz

进入软件目录

[root@localhost src]# cd smokeping-2.6.9

 

[root@localhost smokeping-2.6.9]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty

编译软件到/usr/local目录下

./configure --prefix=/usr/local/smokeping 

用gmake安装smokeping

[root@localhost smokeping-2.6.9]# gmake install

进入到smokeping目录下

[root@localhost smokeping-2.6.9]# cd /usr/local/smokeping/

创建三个目录

[root@localhost smokeping]# mkdir cache data var  

创建smokeping的日志文件

[root@localhost smokeping]# touch /var/log/smokeping.log

授权目录和日志文件的属主和属组为apache,因为web服务使用的是httpd,所以权限要改成apache

[root@localhost smokeping]# chown apache.apache cache/ data/ var/ /var/log/smokeping.log

创建相关配置文件

#fcgi文件

[root@localhost ~]# cp /usr/local/smokeping/htdocs/smokeping.fcgi.dist /usr/local/smokeping/htdocs/smokeping.fcgi

#主配置文件

[root@localhost ~]# cp /usr/local/smokeping/etc/config.dist /usr/local/smokeping/etc/config

修改配置文件

#指定cgi的url地址为本机

[root@localhost ~]# sed -i 's#cgiurl   = http://some.url/smokeping.cgi#cgiurl   = http://192.168.188.128/smokeping.cgi#g' /usr/local/smokeping/etc/config

#指定检测的时间为60秒

[root@localhost ~]# sed -i 's#300#60#g' /usr/local/smokeping/etc/config  

#指定ping的次数为60

[root@localhost ~]# sed -i 's#20#60#g' /usr/local/smokeping/etc/config

修改字符集和字体支持中文

[root@localhost ~]# vi /usr/local/smokeping/etc/config
*** Presentation ***
charset= utf-8

#第147行下边插入下边一行

[root@localhost ~]# vi /usr/local/smokeping/lib/Smokeping/Graphs.pm
            '--font TITLE:20:"WenQuanYi Zen Hei Mono"',

修改apache配置文件增加登录验证,用户名和密码都是smokeping

[root@localhost ~]# htpasswd -c /usr/local/smokeping/htdocs/htpasswd smokeping
New password: 
Re-type new password: 
Adding password for user smokeping

修改httpd.conf增加smokeping的web界面

在httpd.conf DocumentRoot "/var/www/html"下面添加如下内容

[root@localhost ~]# vi /etc/httpd/conf/httpd.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 "Smokeping"
AuthType Basic
AuthUserFile /usr/local/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi
</Directory>

启动服务以及访问smokeping

启动apache

[root@localhost ~]# /etc/init.d/httpd start

启动smokeping

[root@localhost ~]# /usr/local/smokeping/bin/smokeping
ERROR: /usr/local/smokeping/bin/../etc/config, line 109: ERROR: FPing 'binary' does not point to an executable

报错提示缺少fping

安装fping

[root@localhost ~]# yum install -y fping

再次启动smokeping

[root@localhost etc]# /usr/local/smokeping/bin/smokeping
ERROR: /usr/local/smokeping/bin/../etc/config, line 112: File '/usr/local/smokeping/etc/smokeping_secrets.dist' is world-readable or writable, refusing it

提示是权限的额问题

[root@localhost etc]# cd /usr/local/smokeping/etc/
[root@localhost etc]# ll
总用量 28
-rw-r--r--. 1 root root 2041 3月   3 18:43 basepage.html.dist
-rw-r--r--. 1 root root 2692 3月   3 19:13 config
-rw-r--r--. 1 root root 2672 3月   3 18:43 config.dist
drwxr-xr-x. 2 root root 4096 3月   3 18:43 examples
-rw-r--r--. 1 root root 1563 3月   3 18:43 smokemail.dist
-rw-r--r--. 1 root root   59 3月   3 18:43 smokeping_secrets.dist
-rw-r--r--. 1 root root 3815 3月   3 18:43 tmail.dist
[root@localhost etc]# chmod 400 /usr/local/smokeping/etc/smokeping_secrets.dist

再次启动smokeping

[root@localhost etc]# /usr/local/smokeping/bin/smokeping
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 ...

启动成功

 

用浏览器访问:http://ip/smokeping

 注:登录用户默认为smokeping,密码为刚刚设置的密码。 

 

二 添加监控节点

添加需要监控的网络节点

监控节点样例如下,注意+是第一层,++是第二层,+++ 是第三层:

[root@localhost ~]# vi /usr/local/smokeping/etc/config
+ 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 = 124.65.128.122 //此ip为主要测试ip
 
+++ 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

然后重新启动smokeping

[root@localhost ~]# ps -ef | grep smoke
root      10261      1  0 20:11 ?        00:00:00 /usr/local/smokeping/bin/smokeping [FPing]
root      10572   1839  0 20:55 pts/0    00:00:00 grep smoke
[root@localhost ~]# kill -9 10261
[root@localhost ~]# ps -ef | grep smoke
root      10574   1839  0 20:55 pts/0    00:00:00 grep smoke     
[root@localhost ~]# /usr/local/smokeping/bin/smokeping
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 ...

然后就可以看到监控图了



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值