需求:openfire tsung测试时监控被测机的运行状态
原料:centos 6.4,openfire 3.9.1,tsung 1.5, net-snmp 5.5-50
step1:安装net-snmp
yum -y install net-snmp
yum -y install net-snmp-utils
yum -y install net-snmp-libs
yum -y install net-snmp-devel
编辑/etc/snmp/snmpd.confg
1.在此位置增加红色行,可以支持查看cpu,内存等信息
####
# Third, create a view for us to let the group have rights to:
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .1
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
2.在此代码附近
###############################################################################
# Process checks.
#
# The following are examples of how to use the agent to check for
# processes running on the host. The syntax looks something like:
将下列行的#号注释去掉
#proc mountd
#proc ntalkd 4
3.在此代码附近
###############################################################################
# Executables/scripts
#
#
# You can also have programs run by the agent that return a single
# line of output and an exit code. Here are two examples.
将下列行的#号注释去掉
#exec echotest /bin/echo hello world
step2:tsung脚本增加监控节点
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<clients>
<client host="localhost" use_controller_vm="true" maxusers="900"></client>
</clients>
<!-- Server side setup -->
<servers>
<server host="127.0.0.1" port="5222" type="tcp"></server>
</servers>
<monitoring>
<monitor host="192.168.80.128" type="snmp">
<snmp version="v2" >
<!-- tsung 官网的代码,看不懂 -->
<!-- <oid value="1.3.6.1.4.1.42.2.145.3.163.1.1.2.11.0" name="heapused" type="sample" eval="fun(X)-> X/100 end. "></oid> -->
<!-- 使用自己定义的 -->
<oid value="1.3.6.1.4.1.2021.11.5.0" name="ssIOSend" type="sample"></oid>
<oid value="1.3.6.1.4.1.2021.11.6.0" name="ssIOReceive" type="sample"></oid>
<oid value="1.3.6.1.4.1.2021.4.6.0" name="ramUsed" type="sample"></oid>
<oid value="1.3.6.1.2.1.4.9" name="ipInDelivers" type="sample"></oid>
</snmp>
</monitor>
</monitoring>
<load>
<arrivalphase phase="1" duration="1" unit="minute">
<users maxnumber="900" interarrival="0.002" unit="second"></users>
</arrivalphase>
</load>
<!-- JABBER parameters -->
<!-- to synchronise users, use a global acknoledgement -->
<options>
<option type="ts_jabber" name="global_number" value="100"></option>
<option type="ts_jabber" name="userid_max" value="900"></option>
<option type="ts_jabber" name="domain" value="floatant"></option>
<option type="ts_jabber" name="username" value="tsung"></option>
<option type="ts_jabber" name="passwd" value="tsung"></option>
</options>
<sessions>
<session probability="100" name="jabber-example" type="ts_jabber">
<request>
<jabber type="connect" ack="no_ack"></jabber>
</request>
<thinktime value="2"></thinktime>
<transaction name="authenticate">
<request>
<jabber type="auth_get" ack="local"></jabber>
</request>
<request>
<jabber type="auth_set_plain" ack="local"></jabber>
</request>
</transaction>
<request>
<jabber type="presence:initial" ack="no_ack"/>
</request>
<thinktime value="2"></thinktime>
<transaction name="roster">
<request>
<jabber type="iq:roster:get" ack="local"></jabber>
</request>
</transaction>
<thinktime value="30"></thinktime>
<transaction name="online">
<request>
<jabber type="chat" ack="no_ack" size="16" destination="online"></jabber>
</request>
</transaction>
<thinktime value="30"></thinktime>
<transaction name="offline">
<request>
<jabber type="chat" ack="no_ack" size="56" destination="offline"></jabber>
</request>
</transaction>
<thinktime value="30"></thinktime>
<transaction name="close">
<request>
<jabber type="close" ack="no_ack"></jabber>
</request>
</transaction>
</session>
</sessions>
</tsung>
附linux snmp OID的链接 http://www.haiyun.me/archives/linux-snmp-oid.html
完成