CentOS壓力測試最新工具Tsung安裝和圖形報表產生
一、安裝
安裝環境:
- LSBVersion::base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
- DistributorID:CentOS
- Description:CentOSrelease6.5(Final)
- Release:6.5
- Codename:Final
在安裝之前確保安裝了以下工具:
- yuminstallgcc-y
- yuminstallperl-y
- yuminstallunixODBC
- yuminstallunixODBC-devel
下載並安裝erlang[plain]view plaincopy
- #wgethttp://www.erlang.org/download/otp_src_R14B04.tar.gz
- #tar-zxvfotp_src_R14B04.tar.gz
- #cdotp_src_R14B04
- #./configure--prefix=/usr/local/erlang
- #make
- #makeinstall
注意:如果出現 "configure: error: No curses library functions found"錯誤,嘗試安裝:[plain]view plaincopy
- yuminstall-yncurses-devel
下載並安裝Tsung[plain]view plaincopy
- #wgethttp://tsung.erlang-projects.org/dist/tsung-1.4.2.tar.gz
- #tar-zxvftsung-1.4.2.tar.gz
- #cdtsung-1.4.2
- #./configure--prefix=/usr/local/tsung--with-erlang=/usr/local/erlang
- #make
- #makeinstall
下載並安裝perl Template,用於產生報告模版[plain]view plaincopy
- #wgethttp://cpan.org/modules/by-module/Template/Template-Toolkit-2.24.tar.gz
- #tar-zxvfTemplate-Toolkit-2.24.tar.gz
- #cdTemplate-Toolkit-2.24
- #perlMakefile.PL
- #make
- #maketest
- #makeinstall
下載並安裝gnuplot,用於聊天產生[plain]view plaincopy
- #yuminstall-ygnuplotgdlibpngzlib
注意:安裝成後添加erlang、tsung環境變數
[plain]view plaincopy
- #vim/etc/profile
- exportPATH=$PATH:$JAVA_HOME/bin:/usr/local/erlang/bin:/usr/local/tsung/bin:/usr/local/nginx/sbin:$PATH(修改自己實際變數)
- :x儲存,退出
- #source/etc/profile
- 不報錯則成功
- #tsung-v
- #erl-v
- 測試
二、使用在root檔案夾下建立.tsung目錄,用於存放log和xml配置,測試組態檔案可參考/usr/local/tsung/share/doc/tsung/examples/目錄下配置[plain]view plaincopy
- <prename="code"class="plain"style="color:rgb(51,51,51);font-size:13px;line-height:19.046875px;">#<spanstyle="font-family:SimSun;">mkdir~/.tsung</span>
[plain]view plaincopy
- <spanstyle="font-family:SimSun;">#cp/usr/local/tsung/share/doc/tsung/examples/http_simple.xml~/.tsung/tsung.xml</span>
運行,預設執行指令碼~/.tsung/tsung.xml配置[plain]view plaincopy
- #tsungstart
- StartingTsung
- "Logdirectoryis:/root/.tsung/log/20140817-1801"
更多命令:
[plain]view plaincopy
- Usage:tsung<options>start|stop|debug|status
- Options:
- -f<file>setconfigurationfile(defaultis~/.tsung/tsung.xml)
- (use-forstandardinput)
- -l<logdir>setlogdirectory(defaultis~/.tsung/log/YYYYMMDD-HHMM/)
- -i<id>setcontrollerid(defaultisempty)
- -r<command>setremoteconnector(defaultisssh)
- -senableerlangsmponclientnodes
- -p<max>setmaximumerlangprocessespervm(defaultis250000)
- -m<file>writemonitoringoutputonthisfile(defaultistsung.log)
- (use-forstandardoutput)
- -Fuselongnames(FQDN)forerlangnodes
- -wwarmupdelay(defaultis10sec)
- -vprintversioninformationandexit
- -6useIPv6forTsunginternalcommunications
- -hdisplaythishelpandexit
進入Log目錄下可以看到產生的報表資訊
[plain]view plaincopy
- #cd/root/.tsung/log/20140817-1801
[plain]view plaincopy
- #ls-a
- match.logtsung_1b.xmltsung_controller@iZ234cp44ihZ.logtsung.log
產生圖形報表,需要依賴項 gnuplot、perl5及template模板
[plain]view plaincopy
- #yum-yinstallperl5gnuplotlibtemplate-perl
進入需要產生圖形報表的Log目錄,如/root/.tsung/log/20140817-1801
[plain]view plaincopy
- #/usr/local/tsung/lib/tsung/bin/tsung_stats.pl
- creatingsubdirectorydata
- creatingsubdirectorygnuplot_scripts
- creatingsubdirectoryimages
- warn,lastinterval(0)notequaltothefirst,usethefirstone(10)
- NodataforEvent
- NodataforErrors
[plain]view plaincopy
- #ls
- datanuplot_scriptsimagesreport.htmltsung_controller@iZ234cp44ihZ.log
- gnuplot.loggraph.htmlmatch.logtsung_1b.xmltsung.log
架設一個Http伺服器開啟report.html就可以看到產生的報表了.