smokeping对网络进行监控

简介:

smokeping可以用来很好的检测网络状态和稳定性


1、调整防火墙的设置

1
2
3
4
5
6
7
8
9
10
[root@C65-A1 ~] # /etc/init.d/iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@C65-A1 ~] # chkconfig iptables off
[root@C65-A1 ~] # getenforce 
Enforcing
[root@C65-A1 ~] # setenforce 0
[root@C65-A1 ~] # vim /etc/sysconfig/selinux
将“SELINUX=enforcing”改为“SELINUX=disabled”

2、修改yum安装源

1
2
3
4
5
6
[root@C65-A1 ~] # vim /etc/sysconfig/selinux 
[root@C65-A1 ~] # rpm -Uvh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Retrieving http: //apt .sw.be /redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0 .5.3-1.el6.rf.x86_64.rpm
warning:  /var/tmp/rpm-tmp .7A2TOZ: Header V3 DSA /SHA1  Signature, key ID 6b8d79e6: NOKEY
Preparing...                 ########################################### [100%]
    1:rpmforge-release        ########################################### [100%]

3、安装rrdtool与依赖库

1
[root@C65-A1 ~] # 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

4、安装smokeping

1
2
3
4
5
6
[root@C65-A1 ~] # tar zxvf smokeping-2.6.9.tar.gz
[root@C65-A1 ~] # cd smokeping-2.6.9
出现问题是因为需要安装perl的模块,所以运行下面内容即可
[root@C65-A1 ~] # ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
[root@C65-A1 ~] # ./configure --prefix=/usr/local/smokeping
[root@C65-A1 ~] # /usr/bin/gmake install

5、配置smokeping

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@C65-A1 smokeping-2.6.9] # cd /usr/local/smokeping/
[root@C65-A1 smokeping] # mkdir -p var cache data
[root@C65-A1 smokeping] # touch /var/log/smokeping.log
[root@C65-A1 smokeping] # chown apache:apache var cache data
[root@C65-A1 smokeping] # chown apache:apache /var/log/smokeping.log 
[root@C65-A1 smokeping] # ls
bin  cache  data  etc  htdocs  lib  share  thirdparty  var
[root@C65-A1 smokeping] # cd /usr/local/smokeping/htdocs/
[root@C65-A1 htdocs] # ls
cropper  smokeping.fcgi.dist
[root@C65-A1 htdocs] # cp -p smokeping.fcgi.dist /tmp/
[root@C65-A1 htdocs] # mv smokeping.fcgi.dist smokeping.fcgi
[root@C65-A1 htdocs] # cd /usr/local/smokeping/etc/
[root@C65-A1 etc] # ls
basepage.html.dist  examples        smokeping_secrets.dist
config.dist         smokemail.dist  tmail.dist
[root@C65-A1 etc] # cp -p config.dist /tmp/
[root@C65-A1 etc] # mv config.dist config
[root@C65-A1 etc] # vim config
1
2
3
4
5
6
a. 将“cgiurl   = http: //some .url /smokeping .cgi”修改为“cgiurl   = http: //192 .168.1.14 /smokeping .cgi”
b. 将 *** Database *** 中的“step     = 300”修改为 "step     = 60" ,每分钟取样一次
       step     = 300
       pings    = 20
[root@C65-A1 etc] # chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
备注:修改密码文件权限

6、调整apache的配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@C65-A1 etc] # vim /etc/httpd/conf/httpd.conf
添加如下信息:
###set for smokeping###
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
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 >
[root@C65-A1 etc] # cd /usr/local/smokeping/htdocs/
[root@C65-A1 htdocs] # htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin
New password: 
Re- type  new password: 
Adding password  for  user admin

7、设置smokeping开机启动

1
[root@C65-A1 etc] # echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local

8、添加smokeping开机脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/etc/init .d目录下新建smokeing的文件,内容如下:
#!/bin/bash
  #
  # chkconfig: 2345 80 05
  # Description: Smokeping init.d script
  # Hacked by : jeff kang - http://www.jffnms.net
  # Get function from functions library
  /etc/init .d /functions
  # Start the service Smokeping
  start() {
  echo  -n  "Starting Smokeping: "
  /usr/local/smokeping/bin/smokeping  > /dev/null  2>&1
  ### Create the lock file ###
  touch  /var/lock/subsys/smokeping
  success $ "Smokeping startup"
  echo
  }
  # Restart the service Smokeping
  stop() {
  echo  -n  "Stopping Smokeping: "
  kill  -9 ` ps  ax |  grep  " /usr/local/smokeping/bin/smokeping"  grep  - v  grep  awk  '{ print $1 }' ` > /dev/null  2>&1
  ### Now, delete the lock file ###
  rm  -f  /var/lock/subsys/smokeping
  success $ "Smokeping shutdown"
  echo
  }
  ### main logic ###
  case  "$1"  in
  start)
  start
  ;;
  stop)
  stop
  ;;
  status)
  status Smokeping
  ;;
  restart|reload|condrestart)
  stop
  start
  ;;
  *)
  echo  $ "Usage: $0 {start|stop|restart|reload|status}"
  exit  1
  esac
  exit  0

9、开启smokeping服务

1
2
3
4
5
6
[root@C65-A1 init.d] # /etc/init.d/smokeping start
Starting Smokeping:                                        [  OK  ]
[root@C65-A1 init.d] # ps -ef | grep smokeping 
root       9670      1  0 17:42 ?        00:00:00  /usr/local/smokeping/bin/smokeping  [FPing]
root       9673   1264  0 17:42 pts /0     00:00:00  grep  smokeping
然后我们可以通过http: //192 .168.1.144 /smokeping .cgi,输入用户名和密码进入smokeping了

10、smokeping里面开启中文支持并安装中文字体

1
2
3
4
5
[root@C65-A1 htdocs] # vim /usr/local/smokeping/etc/config 
如果需要在网页里展示中文,修改 /usr/local/smokeping/etc/config 文件
*** Presentation ***
charset = utf-8  // 注:在这里添加
[root@C65-A1 htdocs] # yum -y install wqy*

11、添加监控信息,重启服务,使配置生效

1
2
3
4
5
6
7
8
[root@C65-A1 htdocs] # vim /usr/local/smokeping/etc/config 
[root@C65-A1 htdocs] # /etc/init.d/smokeping stop
Stopping Smokeping:                                        [  OK  ]
[root@C65-A1 htdocs] # /etc/init.d/smokeping start
Starting Smokeping:                                        [  OK  ]
[root@C65-A1 htdocs] # ps -ef | grep smokeping
root       9861      1  0 18:04 ?        00:00:00  /usr/local/smokeping/bin/smokeping  [FPing]
root       9864   1442  0 18:04 pts /1     00:00:00  grep  smokeping

12、其它资料

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
检查smokeping的配置文件
[root@C65-A1 htdocs] # /usr/local/smokeping/bin/smokeping --check
Configuration  file  '/usr/local/smokeping/bin/../etc/config'  syntax OK.
[root@C65-A1 htdocs] # /usr/local/smokeping/bin/smokeping --help
说明:
+ Gansu  // 注意,这里加号后面的必须是英文,不能是中文
menu = 甘肃
title = 甘肃
++ Daliang  // 同样,这里‘++’后面的必须是英文,+和++后面的内容是不会被现实的,只是起一个命名的作用。
menu =大梁
title =大梁:10.138.1.11
host = 10.138.1.11
alerts = someloss
一级、二级、三级目录的结构:
+ yiji
menu = 一级
title = 一级
++ erji
menu = 二级
title = 二级
+++ sanji
menu = sanji
title =sanji:10.138.16.54
host = 10.138.16.54
alerts = someloss
title代表的是右边图片显示的标题,memu代表的是左边的菜单









本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1764246,如需转载请自行联系原作者
目录
相关文章
|
10月前
|
传感器 编解码 监控
|
10月前
|
弹性计算 监控 数据可视化
ECS网络流量监控
ECS网络流量监控
421 2
|
10月前
|
移动开发 JSON 监控
网络协议解析:在员工上网监控软件中实现HTTP流量分析
随着企业对员工网络活动的监控需求不断增加,开发一套能够实现HTTP流量分析的网络协议解析系统变得愈发重要。本文将深入探讨如何在员工上网监控软件中实现HTTP流量分析,通过代码示例演示关键步骤。
310 0
|
10月前
|
监控 网络协议 Shell
【Shell 命令集合 网络通讯 】Linux 监控和记录网络中ARP(Address Resolution Protocol)活动 arpwatch命令 使用指南
【Shell 命令集合 网络通讯 】Linux 监控和记录网络中ARP(Address Resolution Protocol)活动 arpwatch命令 使用指南
236 0
|
4月前
|
监控 安全
公司上网监控:Mercury 在网络监控高级逻辑编程中的应用
在数字化办公环境中,公司对员工上网行为的监控至关重要。Mercury 作为一种强大的编程工具,展示了在公司上网监控领域的独特优势。本文介绍了使用 Mercury 实现网络连接监听、数据解析和日志记录的功能,帮助公司确保信息安全和工作效率。
132 51
|
3月前
|
运维 监控 安全
公司监控软件:SAS 数据分析引擎驱动网络异常精准检测
在数字化商业环境中,企业网络系统面临复杂威胁。SAS 数据分析引擎凭借高效处理能力,成为网络异常检测的关键技术。通过统计分析、时间序列分析等方法,SAS 帮助企业及时发现并处理异常流量,确保网络安全和业务连续性。
73 11
|
4月前
|
机器学习/深度学习 监控 数据可视化
企业上网监控:Kibana 在网络监控数据可视化
在网络监控中,Kibana 作为一款强大的数据可视化工具,与 Elasticsearch 配合使用,可处理大量日志数据,提供丰富的可视化组件,帮助企业高效管理网络活动,保障信息安全。通过索引模式和数据映射,Kibana 能够组织和分类原始数据,支持深入分析和异常检测,助力企业识别潜在安全威胁。
108 5
|
5月前
|
监控 安全 5G
|
8月前
|
监控 Ubuntu Unix
Linux |Nethogs 监控网络使用情况
Linux |Nethogs 监控网络使用情况
122 9
Linux |Nethogs 监控网络使用情况
|
7月前
|
Prometheus 监控 网络协议
在Linux中,如何监控网络服务的状态和性能?
在Linux中,如何监控网络服务的状态和性能?

热门文章

最新文章