设为首页 收藏本站
查看: 2125|回复: 1

[经验分享] smokeping对网络进行监控

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-4-18 10:17:42 | 显示全部楼层 |阅读模式
smokeping可以用来很好的检测网络状态和稳定性


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



2、修改yum安装源

1
2
3
4
5
6
[iyunv@C65-A1 ~]# vim /etc/sysconfig/selinux
[iyunv@C65-A1 ~]# rpm -Uvh http://apt.sw.be/redhat/el6/en/x ... 1.el6.rf.x86_64.rpm
Retrieving http://apt.sw.be/redhat/el6/en/x ... 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
[iyunv@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
[iyunv@C65-A1 ~]# tar zxvf smokeping-2.6.9.tar.gz
[iyunv@C65-A1 ~]# cd smokeping-2.6.9
出现问题是因为需要安装perl的模块,所以运行下面内容即可
[iyunv@C65-A1 ~]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
[iyunv@C65-A1 ~]# ./configure --prefix=/usr/local/smokeping
[iyunv@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
[iyunv@C65-A1 smokeping-2.6.9]# cd /usr/local/smokeping/
[iyunv@C65-A1 smokeping]# mkdir -p var cache data
[iyunv@C65-A1 smokeping]# touch /var/log/smokeping.log
[iyunv@C65-A1 smokeping]# chown apache:apache var cache data
[iyunv@C65-A1 smokeping]# chown apache:apache /var/log/smokeping.log
[iyunv@C65-A1 smokeping]# ls
bin  cache  data  etc  htdocs  lib  share  thirdparty  var
[iyunv@C65-A1 smokeping]# cd /usr/local/smokeping/htdocs/
[iyunv@C65-A1 htdocs]# ls
cropper  smokeping.fcgi.dist
[iyunv@C65-A1 htdocs]# cp -p smokeping.fcgi.dist /tmp/
[iyunv@C65-A1 htdocs]# mv smokeping.fcgi.dist smokeping.fcgi
[iyunv@C65-A1 htdocs]# cd /usr/local/smokeping/etc/
[iyunv@C65-A1 etc]# ls
basepage.html.dist  examples        smokeping_secrets.dist
config.dist         smokemail.dist  tmail.dist
[iyunv@C65-A1 etc]# cp -p config.dist /tmp/
[iyunv@C65-A1 etc]# mv config.dist config
[iyunv@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
[iyunv@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
[iyunv@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>
[iyunv@C65-A1 etc]# cd /usr/local/smokeping/htdocs/
[iyunv@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
[iyunv@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
[iyunv@C65-A1 init.d]# /etc/init.d/smokeping start
Starting Smokeping:                                        [  OK  ]
[iyunv@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
[iyunv@C65-A1 htdocs]# vim /usr/local/smokeping/etc/config
如果需要在网页里展示中文,修改/usr/local/smokeping/etc/config文件
*** Presentation ***
charset = utf-8 //注:在这里添加
[iyunv@C65-A1 htdocs]# yum -y install wqy*




11、添加监控信息,重启服务,使配置生效
1
2
3
4
5
6
7
8
[iyunv@C65-A1 htdocs]# vim /usr/local/smokeping/etc/config
[iyunv@C65-A1 htdocs]# /etc/init.d/smokeping stop
Stopping Smokeping:                                        [  OK  ]
[iyunv@C65-A1 htdocs]# /etc/init.d/smokeping start
Starting Smokeping:                                        [  OK  ]
[iyunv@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的配置文件
[iyunv@C65-A1 htdocs]# /usr/local/smokeping/bin/smokeping --check
Configuration file '/usr/local/smokeping/bin/../etc/config' syntax OK.
[iyunv@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代表的是左边的菜单






运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-205525-1-1.html 上篇帖子: smokeping slave模式没数据 下篇帖子: Centos6.5 或6.x 5.x搭建smokeping 监控 网络
累计签到:3 天
连续签到:1 天
发表于 2016-5-7 16:29:54 | 显示全部楼层
请教一下,我做的监控,添加完节点ip 出现ERROR: opening '/usr/local/smokeping/data/CNC/beijing.rrd': No such file or directory错误,这个应该怎么解决呢?

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表