对于4.X的用户而言,可以直接运行该程序。
对于3.X或老版本用户而言,需要首先安装argparse模块。
在Zenoss用户下执行安装。
点击(此处)折叠或打开
- $ wget -c http://argparse.googlecode.com/files/argparse-1.2.1.tar.gz
- $ tar zxvf argparse-1.2.1.tar.gz
- $ cd argparse-1.2.1
- $ python setup.py install
点击(此处)折叠或打开
- $ chmod +x rrdpound3.py
点击(此处)折叠或打开
- $ ./rrdpound3.py -h
- usage: rrdpound3.py [-h] [--cycles CYCLES] [--cycle-time CYCLE_TIME]
- [--device-count DEVICE_COUNT]
- [--device-datapoints DEVICE_DATAPOINTS]
- [--component-count COMPONENT_COUNT]
- [--component-datapoints COMPONENT_DATAPOINTS]
- [--processes PROCESSES] [--perf-path PERF_PATH]
- optional arguments:
- -h, --help show this help message and exit
- --cycles CYCLES Number of times to run benchmark [10] #测试次数
- --cycle-time CYCLE_TIME
- Data collection interval [10] #数据收集间隔
- --device-count DEVICE_COUNT
- Number of devices to simulate #模拟被监控设备数量
- --device-datapoints DEVICE_DATAPOINTS
- Number of datapoints per device [10] #模拟一台设备中Graph所需的数据点(主机类数据点)
- --component-count COMPONENT_COUNT
- Number of components per device [50] #模拟一台设备包含的组件个数
- --component-datapoints COMPONENT_DATAPOINTS
- Number of datapoints per component [7] #模拟每个组件所需的数据点(组件数据点)
- --processes PROCESSES
- Number of datapoints per component [1] #这里的提示错了,应该是处理测试的进程数
- --perf-path PERF_PATH
- Path to the perform the test on
- [/opt/zenoss/perf/perftest] #测试性能所需目录。实际上是在/opt/zenoss/perf下再建立目录。
一台设备所有数据点=“--device-datapoints”+“--component-count”*“--component-datapoints”
再乘以“--device-count”就可以模拟出一台监控服务器可以承担的数量。
根据实际环境,我们做出如下测试:
点击(此处)折叠或打开
- ./rrdpound3.py --cycle-time 300 --device-count 1000 --device-datapoints=10 --component-count=5 --component-datapoints=6 --perf-path perftest
- cycles: 10
- cycle time: 300
- device count: 1000
- datapoints per device 10
- component count: 5
- datapoints per device: 6
- processes: 1
- perf path: perftest
- 35.996 (1111.225/sec)
- 7.183 (5568.505/sec)
- 6.977 (5733.392/sec)
- 6.413 (6237.008/sec)
- 6.925 (5776.187/sec)
- 6.928 (5773.313/sec)
- 95.893 (417.132/sec)
- 13.605 (2940.000/sec)
- 6.937 (5765.876/sec)
- 7.022 (5696.384/sec)
再来看看实际800台设备的运行情况:
点击(此处)折叠或打开
- # find /opt/zenoss/perf/Devices/ -type f -name *.rrd |wc -l
- 36239
- # more /opt/zenoss/log/zenperfsnmp.log |grep 'Cycle lasted '
- 2012-08-27 09:12:25,635 INFO zen.zenperfsnmp: Cycle lasted 18.69 seconds
- 2012-08-27 09:17:25,492 INFO zen.zenperfsnmp: Cycle lasted 18.55 seconds
- 2012-08-27 09:22:25,475 INFO zen.zenperfsnmp: Cycle lasted 18.53 seconds
- 2012-08-27 09:27:18,697 INFO zen.zenperfsnmp: Cycle lasted 11.76 seconds
- 2012-08-27 09:32:18,377 INFO zen.zenperfsnmp: Cycle lasted 11.43 seconds
- 2012-08-27 09:37:20,884 INFO zen.zenperfsnmp: Cycle lasted 13.90 seconds
- 2012-08-27 09:42:19,341 INFO zen.zenperfsnmp: Cycle lasted 12.40 seconds
测试结果与实际平台比较接近。