生产环境配置:
操作系统:CentOS 6.6
#并发连接程序从网上以下载好,然后上传到服务器
1.配置并发连接程序脚本及模板
[root@sky9896 tools]# rz
rz waiting to receive.
zmodem trl+C Transferring get_netstat_conn.zip...
[root@sky9896 tools]# unzip get_netstat_conn.zip
#把脚本复制到/cacti/scripts下
[root@sky9896 get_netstat_conn]# mv get_netstat_tcp.pl /var/www/html/cacti/scripts
[root@sky9896 scripts]# chmod 755get_netstat_tcp.pl
[root@sky9896 scripts]# perlget_netstat_tcp.pl 127.0.0.1 2c public 161 500
established:1 listen:0 timewait:7timeclose:0 finwait1:0 finwait2:0 synsent:0 synrecv:0 closewait:0
在cacti界面Import Templates项中导入cacti_graph_template_snmp_get_netstat_connection.xml模版文件
接下来可以在device设备中创建:
Webbench测试工具的使用
生产环境配置:
操作系统:CentOS 6.6
测试工具:webbench
任务:webbench模拟N个并发连接测试网站的负载能力。
1.安装配置过程:
[root@sky9896tools]# tar zxfv webbench-1.5.tar.gz
[1.安装配置过程:
[root@sky9896tools]# tar zxfv webbench-1.5.tar.gz
[root@sky9896tools]# cd webbench-1.5
[root@sky9896webbench-1.5]#
[root@sky9896webbench-1.5]# make && make install
出现下列错误:
错误1:
[root@sky9896webbench-1.5]# make && make install
ctags *.c
/bin/sh: ctags: command not found
make: [tags] Error 127 (ignored)
解决方式:
[root@sky9896webbench-1.5]#yum install ctags
错误2:
[root@sky9896webbench-1.5]# make && make install
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c:在函数‘alarm_handler’中:
webbench.c:77:警告:未使用的参数‘signal’
cc -Wall -ggdb -W -O -o webbench webbench.o
ctags *.c
root@sky9896tools]# cd webbench-1.5
[root@sky9896webbench-1.5]#
[root@sky9896webbench-1.5]# make && make install
出现下列错误:
错误1:
[root@sky9896webbench-1.5]# make && make install
ctags *.c
/bin/sh: ctags: command not found
make: [tags] Error 127 (ignored)
解决方式:
[root@sky9896webbench-1.5]#yum install ctags
错误2:
[root@sky9896webbench-1.5]# make && make install
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c:在函数‘alarm_handler’中:
webbench.c:77:警告:未使用的参数‘signal’
cc -Wall -ggdb -W -O -o webbench webbench.o
ctags *.c
解决方式:
[root@sky9896 webbench-1.5]# rm -f *.owebbench *~ core *.core tags # 清除安装时留下的文件
[root@sky9896 webbench-1.5]# ldconfig
[root@sky9896 webbench-1.5]# mkdir /usr/local/man
[root@sky9896 webbench-1.5]# make && make install
install -s webbench /usr/local/bin
install -m 644 webbench.1 /usr/local/man/man1
install -d /usr/local/share/doc/webbench
install -m 644 debian/copyright/usr/local/share/doc/webbench
install -m 644 debian/changelog/usr/local/share/doc/webbench
2.webbech测试及运行结果: #Linux服务端测试
[root@sky9896 webbench-1.5]# webbench -c 100 -t 20 http://117.40.239.9/bbs/index.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open SourceSoftware.
Benchmarking: GET http://117.40.239.9/bbs/index.php
100 clients, running 20 sec.
Speed=8115 pages/min, 28184 bytes/sec.
Requests: 2705 susceed, 0 failed.
测试结果:通过webbech压力测试,用cacti监控netstat不同网络状态并发连接数。在linux客户端测试500客户端连接服务器,用30秒时间访问该地址,服务器在瞬间的响应速度非常慢。
[root@localhost webbench-1.5]# webbench -c 500 -t 30 http://bbs.jxatei.net/bbs/forum.php
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open SourceSoftware.
Benchmarking: GET http://bbs.jxatei.net/bbs/forum.php
500 clients, running 30 sec.
Speed=1016 pages/min, 1001878 bytes/sec.
Requests: 463 susceed, 45 failed.
示意图如下: