云服务器网络怎么用smokeping
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了云服务器网络怎么用smokeping相关的知识,希望对你有一定的参考价值。
参考技术A 如何在windows下安装smokeping1)smokewhat?Smokeping(link)isanicelatencymeasurementtool,unfortunatelyitWASonlyavailableforlinux/unix…butafterthejump,you’llfindhowtomakeitworkunderMicrosoftWindows!SmokePingisadeluxelatencymeasurementtool.Itcanmeasure,storeanddisplaylatency,latencydistributionandpacketloss.SmokePingusesRRDtooltomaintainalongtermdata-storeandtodrawprettygraphs,givinguptotheminuteinformationonthestateofeachnetworkconnection2)你需要作的准备工作-perl(选择windows下的perl5.8.xxx的msi的包)perl非常的酷并且在使用的过程中你会发现他的功能非常强大-RRDsPerl的模块这个版本工作起来稳定,而且你可以免费的下载到最新的版本-fpingwindows版本的fping(感谢MichaelParson)-smokeping2.0.9这个版本工作起来稳定,而且你可以免费的下载到最新的版本-atexteditor(本人注:就是一个编辑器,可以使用记事本或者写字板或者dreamwave来代替,我在安装的过程中没有用到它,我感觉写字板足够用了,而且用起来老顺手的,呵呵,用习惯了)-awebserver(本人注:使用iis就可以了,作者本人用的是apache+php+mysql,开源免费,我用的是iis,感觉没什么区别)3)你不需要什么-银子所有的软件几乎都是免费的,作者原话(我们没有选用作者说到文本编辑器和web服务器,所以如果都是正版软件的话,是需要破费的:p)4)安装-安装ActivestatePerl-安装windows版本的RRDtool(解压然后运行install.cmd)-解压缩smokeping到c:\smokeping-2-0-8-解压缩windows版本的fping(请确认cygwin1.dll和fping在同一个目录下)到c:\smokeping-2.0.8\fping-安装web服务器,建立站点并指定站点根目录为c:\www5)更改a)改名-C:\smokeping-2.0.8\bin\smokeping.dist更改为smokeping.pl-C:\smokeping-2.0.8\bin\tSmoke.dist更改为tSmoke.plb)编辑C:\smokeping-2.0.8\bin\smokeping.pl添加(行5后):uselibqw(C:\smokeping-2.0.8\lib);替换(行9):Smokeping::main(”etc/config.dist”);替换为Smokeping::main(”C:/smokeping-2.0.8/etc/config.dist”);-C:\smokeping-2.0.8\bin\tSmoke.pl更改(行63):my$cfgfile=“etc/config.dist”;替换为my$cfgfile=“C:\smokeping-2.0.8\etc\config.dist”;-C:\smokeping-2.0.8\lib\Smokeping.pm替换(行14):useSys::Syslogqw(:DEFAULTsetlogsock);替换为#useSys::Syslogqw(:DEFAULTsetlogsock);替换(行21):$ENVLC_NUMERIC=’C';替换为#$ENVLC_NUMERIC=’C';替换(行22):POSIX::setlocale(&POSIX::LC_NUMERIC,”");替换为#POSIX::setlocale(&POSIX::LC_NUMERIC,”");替换(行2984):daemonize_me$cfg->Generalpiddir.”/smokeping.pid”;替换为#daemonize_me$cfg->Generalpiddir.”/smokeping.pid”;(jinni注:以下为apache的配置,我用的是iis,所以只建立了iis对perl程序的应用程序影射,略过不谈,不译)“-C:\wamp\Apache2\conf\httpd.confchange(line515):ScriptAlias/cgi-bin/“C:/wamp/Apache2/cgi-bin/”intoScriptAlias/cgi-bin/“c:/wamp/cgi/”change(line521):intoc)移动文件和改名-建立文件夹c:\www\cgi-C:\smokeping-2.0.8\htdocs\smokeping.cgi.dist到c:\wwww\cgi\smokeping.pld)编辑-c:\wwww\cgi\smokeping.pl替换(行1):#!/usr/sepp/bin/speedy-w替换为#!C:/Perl/bin/perl.exe-w替换(行5):uselibqw(/home/oetiker/data/projects/AADJ-smokeping/dist/lib);替换为uselibqw(C:\smokeping-2.0.8\lib);替换(行10):Smokeping::cgi(”/home/oetiker/data/projects/AADJ-smokeping/dist/etc/config”);替换为Smokeping::cgi(”C:/smokeping-2.0.8/etc/config.dist”);6)配置-建立文件夹c:\www\simgc:\smokeping-2.0.8\var-编辑配置文件(c:\smokeping-2.0.8\etc\config.dist)请寻找一下参数,然后做相应的更改owner=contact=mailhost=#sendmail=/usr/lib/sendmail<==Commentthislineimgcache=C:/www/simgimgurl=../simgdatadir=\smokeping-2.0.8/var#designateimplicitlyc:\smokeping-2.0.8\varpiddir=C:/smokeping-2.0.8/varcgiurl=.dist+FPingbinary=C:/smokeping-2.0.8/fping/fping.exetitle=remark=#googleisfordemonstrationalpurposeonly;pleaserefertosmokepinghelptosetyourowntargets+Googlemenu=Googletitle=GoogleConnectivityalerts=bigloss,someloss,startlosshost=google.fr7)测试-打开命令行,输入c:\smokeping-2.0.8\bin\smokeping.plok,没有错误信息(如果有错误信息,请检查5-a,5-b和6的步骤)-不要停止这个命令行,让他运行10-15分钟,然后访问smokeping.plok,确认没有错误信息显示(如果有,如果是cgi错误,请检查5-b,5-c,5-d和6的步骤,如果是RRD的错误,请检查5-d和6的步骤)现在关闭cmd.exe(控制台)窗口8)完成(jinni注)主要的工作已经做完,下来就是让持续运行的问题,我们可以利用windows的计划任务来完成这个步骤,具体的我就不再写了,我也不翻译了,我相信您一定可以完成使用smokeping监测机房网络质量
smokeping服务端测试:
1、调整防火墙的设置
[[email protected] ~]# /etc/init.d/iptables stop iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] [[email protected] ~]# chkconfig iptables off [[email protected] ~]# getenforce Enforcing [[email protected] ~]# setenforce 0 [[email protected] ~]# vim /etc/sysconfig/selinux 将“SELINUX=enforcing”改为“SELINUX=disabled”
2、修改yum安装源
[[email protected] ~]# vim /etc/sysconfig/selinux [[email protected] ~]# 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与依赖库
[[email protected] ~]# 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
[[email protected] ~]# tar zxvf smokeping-2.6.9.tar.gz [[email protected] ~]# cd smokeping-2.6.9 出现问题是因为需要安装perl的模块,所以运行下面内容即可 [[email protected] ~]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty [[email protected] ~]# ./configure --prefix=/usr/local/smokeping [[email protected] ~]# /usr/bin/gmake install
5、配置smokeping
[[email protected] smokeping-2.6.9]# cd /usr/local/smokeping/ [[email protected] smokeping]# mkdir -p var cache data [[email protected] smokeping]# touch /var/log/smokeping.log [[email protected] smokeping]# chown apache:apache var cache data [[email protected] smokeping]# chown apache:apache /var/log/smokeping.log [[email protected] smokeping]# ls bin cache data etc htdocs lib share thirdparty var [[email protected] smokeping]# cd /usr/local/smokeping/htdocs/ [[email protected] htdocs]# ls cropper smokeping.fcgi.dist [[email protected] htdocs]# cp -p smokeping.fcgi.dist /tmp/ [[email protected] htdocs]# mv smokeping.fcgi.dist smokeping.fcgi [[email protected] htdocs]# cd /usr/local/smokeping/etc/ [[email protected] etc]# ls basepage.html.dist examples smokeping_secrets.dist config.dist smokemail.dist tmail.dist [[email protected] etc]# cp -p config.dist /tmp/ [[email protected] etc]# mv config.dist config [[email protected] etc]# vim config 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 [[email protected] etc]# chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist 备注:修改密码文件权限
6、调整apache的配置
[[email protected] 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> [[email protected] etc]# cd /usr/local/smokeping/htdocs/ [[email protected] htdocs]# htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin New password: Re-type new password: Adding password for user admin
7、设置smokeping开机启动
[[email protected] etc]# echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local
8、添加smokeping开机脚本
在/etc/init.d目录下新建smokeping的文件,内容如下:
#!/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服务
[[email protected] init.d]# chmod +x smokeping
[[email protected] init.d]# /etc/init.d/smokeping start
Starting Smokeping: [ OK ]
[[email protected] 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里面开启中文支持并安装中文字体
[[email protected] htdocs]# vim /usr/local/smokeping/etc/config 如果需要在网页里展示中文,修改/usr/local/smokeping/etc/config文件 *** Presentation *** charset = utf-8 //注:在这里添加 [[email protected] htdocs]# yum -y install wqy*
11、添加监控信息,重启服务,使配置生效
[[email protected] htdocs]# vim /usr/local/smokeping/etc/config [[email protected] htdocs]# /etc/init.d/smokeping stop Stopping Smokeping: [ OK ] [[email protected] htdocs]# /etc/init.d/smokeping start Starting Smokeping: [ OK ] [[email protected] 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、其它资料
检查smokeping的配置文件
[[email protected] htdocs]# /usr/local/smokeping/bin/smokeping --check Configuration file ‘/usr/local/smokeping/bin/../etc/config‘ syntax OK. [[email protected] 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代表的是左边的菜单
13、监控显示界面
本文出自 “冰冻vs西瓜” 博客,请务必保留此出处http://molewan.blog.51cto.com/287340/1913395
以上是关于云服务器网络怎么用smokeping的主要内容,如果未能解决你的问题,请参考以下文章