8.4.7. tsung-1.0.dtd

tsung

结构:

<?xml version="1.0" encoding="utf-8" ?>
<!ELEMENT tsung (information?, clients, servers, monitoring?, load, options?, sessions)>

属性:

dumptraffic (true | false | light | protocol | protocol_local) "false"
backend     (text | json| rrdtool | fullstats) "text"
% : 调试时,需要重新编译->make debug
loglevel    (emergency|critical|error|warning|notice|info|debug) "notice"
version     NMTOKEN

dumptraffic==protocol:
% only implemented for HTTP
% 按下面格式log所有请求到CSV文件
#date;pid;id;http method;host;URL;HTTP status;size;duration;transaction;match;error;tag

information

结构:

% 主要用于说明
<!ELEMENT information (name|description|username|organisation)*>

servers

结构:

<!ELEMENT servers (server+)>
<!ELEMENT server EMPTY>
<!ATTLIST server
     host   NMTOKEN #REQUIRED
     port   NMTOKEN #REQUIRED
     weight NMTOKEN "1"
     type (ssl | tcp | udp | erlang | ssl6 | tcp6 | udp6 |bosh | bosh_ssl | websocket | websocket_ssl ) #REQUIRED>

client

结构:

<!ELEMENT clients (client+)>
<!ELEMENT client (ip*| iprange) >

属性:

cpu      NMTOKEN "1"
type     (machine | batch)  "machine"
host     NMTOKEN #IMPLIED
% 设定1个erlang vm能启动的最大用户数,当超过时,会启动新erlang vm去处理
% 可以设定到30000而不影响效率
maxusers NMTOKEN "800"
% 比重
weight   NMTOKEN "1"

% type==machine时: 可使用use_controller_vm属性
% use_controller_vm==true时(使用SMP): 属性cpu必须为1
use_controller_vm (true | false) "false"

% type==batch时: 需指定如下2属性
batch    (torque | pbs | lsf | oar) #IMPLIED
scan_intf NMTOKEN #IMPLIED

type==batch实例:

<client type="batch" batch="torque" maxusers="30000">
% 使用scan_intf
<client type="batch" batch="torque" scan_intf='eth0' maxusers="30000">

ip/iprange属性:

<!ELEMENT ip EMPTY>
<!ATTLIST ip
          value NMTOKEN #REQUIRED
          scan (true| false)  "false">

% 实例:
<ip scan="true" value="eth0"/>
<ip value="10.9.195.12"></ip>


<!ELEMENT iprange EMPTY>
<!ATTLIST iprange
          value NMTOKEN #REQUIRED
          version NMTOKEN  "v4">
% 实例:
<iprange value="192.168.3-20.30" version = "v4">

monitor

结构:

<!ELEMENT monitoring ( monitor+ )>
<!ELEMENT monitor ( snmp? | munin? | mysqladmin? )>
<!ATTLIST monitor
     host NMTOKEN #REQUIRED
     batch (true | false) "false"
     type (snmp | erlang | munin) "erlang">

mysqladmin属性:

<!ELEMENT mysqladmin EMPTY>
<!ATTLIST mysqladmin
     port  NMTOKEN "3306"
     username  NMTOKEN "root"
     password NMTOKEN #IMPLIED>

snmp属性:

<!ELEMENT snmp (oid)*>
<!ATTLIST snmp
     version   (v1 | v2) "v1"
     community NMTOKEN "public"
     port      NMTOKEN "161">

<!ELEMENT oid EMPTY>
<!ATTLIST oid
     value   NMTOKEN #REQUIRED
     name    NMTOKEN #REQUIRED
     type    NMTOKEN "sample"
     eval    CDATA   #IMPLIED>

munin属性:

<!ELEMENT munin EMPTY>
<!ATTLIST munin
     port      NMTOKEN "4949">

load

结构:

<!ELEMENT load (arrivalphase | user)+>
<!ATTLIST load
     duration NMTOKEN #IMPLIED
     unit     (hour | minute | second) "second"
     loop     NMTOKEN "0">

arrivalphase:

<!ELEMENT arrivalphase (users | session_setup)+>
<!ATTLIST arrivalphase
     duration NMTOKEN #REQUIRED
     phase    NMTOKEN #REQUIRED
     wait_all_sessions_end NMTOKEN "false"
     unit     (hour | minute | second | millisecond) #REQUIRED>

users:

<!ELEMENT users EMPTY>
<!ATTLIST users
     interarrival NMTOKEN #IMPLIED
     arrivalrate  NMTOKEN #IMPLIED
     unit (hour | minute | second) #REQUIRED
     maxnumber NMTOKEN #IMPLIED>

<!ELEMENT user EMPTY>
<!ATTLIST user
     start_time NMTOKEN #IMPLIED
     unit (hour | minute | second  | millisecond) "second"
     session      CDATA #REQUIRED>

options

结构:

<!ELEMENT options (option*)>
<!ELEMENT option (user_agent*)>
<!ATTLIST option
    name     NMTOKEN #REQUIRED
    override (true | false) #IMPLIED
    random   (true | false) #IMPLIED
    id       NMTOKEN #IMPLIED
    min      NMTOKEN #IMPLIED
    max      NMTOKEN #IMPLIED
    type     (ts_http | ts_jabber | ts_pgsql | ts_amqp) #IMPLIED
    value    CDATA #IMPLIED>


<!ELEMENT user_agent (#PCDATA)*>
<!ATTLIST user_agent
    probability NMTOKEN #REQUIRED>

set_option:

<!ELEMENT set_option (user_agent*| certificate)>
<!ATTLIST set_option
    name     NMTOKEN #REQUIRED
    id       NMTOKEN #IMPLIED
    min      NMTOKEN #IMPLIED
    max      NMTOKEN #IMPLIED
    type     (ts_http | ts_jabber | ts_pgsql) #IMPLIED
    value    CDATA #IMPLIED>

<!ELEMENT certificate EMPTY >
<!ATTLIST certificate
    cacertfile  CDATA #IMPLIED
    keyfile     CDATA #IMPLIED
    keypass     CDATA #IMPLIED
    certfile    CDATA #IMPLIED>

sessions

结构:

<!ELEMENT sessions (session+)>
<!ELEMENT session ( request | thinktime | transaction | setdynvars | for |
repeat | if | change_type | foreach | set_option | interaction | abort )*>
<!ATTLIST session
    name         CDATA #REQUIRED
    bidi         CDATA #IMPLIED
    persistent   (true | false) #IMPLIED
    probability   NMTOKEN #IMPLIED
    weight        NMTOKEN #IMPLIED
    type         (ts_jabber | ts_http | ts_raw | ts_pgsql | ts_ldap | ts_webdav |ts_mysql| ts_fs | ts_shell | ts_job | ts_websocket | ts_amqp | ts_mqtt) #REQUIRED>

<!ELEMENT session_setup EMPTY>
<!ATTLIST session_setup
    name         CDATA #REQUIRED
    probability  NMTOKEN #IMPLIED
    weight       NMTOKEN #IMPLIED>
% 说明: probability与weight是互斥的
% probability总数是100

abort:

<!ELEMENT abort EMPTY>
<!ATTLIST abort
          type (session|all) "session" >

interaction:

<!ELEMENT interaction EMPTY>
<!ATTLIST interaction
          action (send|receive) #REQUIRED
          id     CDATA #REQUIRED>

change_type:

<!ELEMENT change_type EMPTY>
<!ATTLIST change_type
     new_type         (ts_jabber | ts_http | ts_raw | ts_pgsql | ts_ldap | ts_webdav | ts_mysql | ts_fs | ts_shell | ts_job | ts_websocket | ts_amqp | ts_mqtt) #REQUIRED
     host CDATA #REQUIRED
     port CDATA #REQUIRED
     server_type NMTOKEN #REQUIRED
     store  ( true | false ) "false"
     restore ( true | false ) "false"
     bidi ( true | false ) "false" >

thinktime:

<!ELEMENT thinktime EMPTY>
<!ATTLIST thinktime
    random (true|false) "false"
    value  CDATA #IMPLIED
    min    NMTOKEN #IMPLIED
    max    NMTOKEN #IMPLIED >

transaction:

<!ELEMENT transaction (request | setdynvars | thinktime | for | repeat
          | if | foreach | interaction | abort )+>
<!ATTLIST transaction name NMTOKEN #REQUIRED>

子选项request

结构:

<!ELEMENT request ( match*, dyn_variable*, ( http | jabber | raw |
          pgsql | ldap | mysql |fs | shell | job | websocket | amqp | mqtt) )>
<!ATTLIST request
    subst (true|false|all_except_body) "false"
    tag   NMTOKEN "undefined" >

match:

<!ELEMENT match (#PCDATA)>
<!ATTLIST match
    do (continue|loop|abort|restart|log|dump|abort_test) "continue"
    when (match|nomatch) "match"
    subst (true|false) "false"
    loop_back   NMTOKEN "0"
    name NMTOKEN "-"
    max_loop    NMTOKEN "20"
    max_restart NMTOKEN "3"
    sleep_loop  NMTOKEN "5"
    apply_to_content  NMTOKEN "undefined"
    skip_headers      NMTOKEN "no" >

dyn_variable:

<!ELEMENT dyn_variable EMPTY >
<!ATTLIST dyn_variable
    name       CDATA #REQUIRED
    xpath      CDATA #IMPLIED
    re         CDATA #IMPLIED
    jsonpath   CDATA #IMPLIED
    pgsql_expr CDATA #IMPLIED
    regexp     CDATA #IMPLIED
    header     CDATA #IMPLIED
    decode     (html_entities | false) "false" >

子选项http

结构:

<!ELEMENT http (oauth?, www_authenticate?, soap?, http_header*, add_cookie*)>
<!ATTLIST http
    contents           CDATA #IMPLIED
    contents_from_file CDATA #IMPLIED
    content_type       CDATA #IMPLIED
    if_modified_since  CDATA #IMPLIED
    method             (GET | POST | PUT | PATCH | DELETE | HEAD | PROPFIND | PROPPATCH | COPY | MOVE | LOCK | UNLOCK | MKCOL | MKACTIVITY | OPTIONS | REPORT | VERSION-CONTROL | MERGE | CHECKOUT) "GET"
    url                CDATA #REQUIRED
    version            (1.0 | 1.1) "1.1" >

soap:

<!ELEMENT soap EMPTY >
<!ATTLIST soap action CDATA #REQUIRED >

http_header:

<!ELEMENT http_header EMPTY >
<!ATTLIST http_header
    name     CDATA #REQUIRED
    encoding CDATA #IMPLIED
    value    CDATA #IMPLIED >

add_cookie:

<!ELEMENT add_cookie EMPTY >
<!ATTLIST add_cookie
    key     CDATA #REQUIRED
    domain  CDATA #IMPLIED
    path    CDATA #IMPLIED
    value   CDATA #REQUIRED >

www_authenticate:

<!ELEMENT www_authenticate EMPTY >
<!ATTLIST www_authenticate
    passwd CDATA #REQUIRED
    userid CDATA #REQUIRED
    nonce  CDATA #IMPLIED
    opaque CDATA #IMPLIED
    cnonce  CDATA #IMPLIED
    nc CDATA #IMPLIED
    realm CDATA #IMPLIED
    qop CDATA #IMPLIED
    type (basic | digest) "basic" >

oauth:

<!ELEMENT oauth EMPTY >
<!ATTLIST oauth
    consumer_key CDATA #REQUIRED
    consumer_secret CDATA #REQUIRED
    access_token CDATA #IMPLIED
    access_token_secret CDATA #IMPLIED
    method  (HMAC-SHA1 | PLAINTEXT | RSA-SHA1) "HMAC-SHA1">

子选项jabber

结构:

<!ELEMENT jabber (xmpp_authenticate?) >
<!ATTLIST jabber
    ack         (global | local | no_ack | parse | bidi_ack) #REQUIRED
    destination (online | offline | random | unique | previous) "random"
    id          NMTOKEN #IMPLIED
    size        NMTOKEN "0"
    data        CDATA   #IMPLIED
    type        NMTOKEN #REQUIRED
    stamped     (true | false) "false"
    show        (away|chat|dnd|xa) "chat"
    status      CDATA   "Available"
    nick        CDATA #IMPLIED
    room        CDATA #IMPLIED
    group       CDATA #IMPLIED
    node        CDATA #IMPLIED
    send_version (true | false) "false"
    regexp      CDATA #IMPLIED
    resource    CDATA "tsung"
    node_type   CDATA #IMPLIED
    version     CDATA #IMPLIED
    cacertfile  CDATA #IMPLIED
    keyfile     CDATA #IMPLIED
    keypass     CDATA #IMPLIED
    certfile    CDATA #IMPLIED
    subid       CDATA #IMPLIED >

xmpp_authenticate:

<!ELEMENT xmpp_authenticate EMPTY >
<!ATTLIST xmpp_authenticate
    passwd   CDATA #REQUIRED
    username CDATA #REQUIRED >

子选项fs

结构:

<!ELEMENT fs EMPTY >
<!ATTLIST fs
    cmd
          (read|write|open|delete|stat|copy|read_chunk|write_chunk|close|make_dir|del_dir|make_symlink)  "write"
    path     CDATA   #IMPLIED
    size     CDATA   "1024"
    position CDATA   #IMPLIED
    mode     (read | write | append ) #IMPLIED
    dest     CDATA   #IMPLIED >

子选项shell

结构:

<!ELEMENT shell EMPTY >
<!ATTLIST shell
    cmd      CDATA   #REQUIRED
    args     CDATA   "" >

子选项job

结构:

<!ELEMENT job EMPTY >
<!ATTLIST job
    type     (oar|torque) "oar"
    req      (submit|delete|stat|suspend|resume|wait_jobs) #REQUIRED
    script   CDATA     #IMPLIED
    walltime CDATA     #IMPLIED
    duration CDATA     #IMPLIED
    jobid    CDATA     #IMPLIED
    resources CDATA    #IMPLIED
    nodes    CDATA   #IMPLIED
    queue    CDATA   #IMPLIED
    options  CDATA     #IMPLIED
    user     CDATA   #IMPLIED
    name     CDATA   "tsung"
    notify_port  CDATA   #IMPLIED
    notify_script  CDATA   #IMPLIED >

子选项pgsql

结构:

<!ELEMENT pgsql (#PCDATA) >
<!ATTLIST pgsql
    password     CDATA   #IMPLIED
    database     CDATA   #IMPLIED
    username     CDATA   #IMPLIED
    name_portal   CDATA   #IMPLIED
    name_prepared CDATA   #IMPLIED
    query         CDATA   #IMPLIED
    parameters    CDATA   #IMPLIED
    max_rows      CDATA   "0"
    formats       CDATA   #IMPLIED
    formats_results CDATA   #IMPLIED
    contents_from_file CDATA #IMPLIED
    type        (connect | authenticate | sql | close | bind | parse | cancel|call| sync | execute | describe | flush | copy | copydone| copyfail) #REQUIRED >

子选项mysql

结构:

<!ELEMENT mysql (#PCDATA) >
<!ATTLIST mysql
    password     CDATA   #IMPLIED
    database     CDATA   #IMPLIED
    username     CDATA   #IMPLIED
    type        (connect | authenticate | sql | close) #REQUIRED >

子选项raw

结构:

<!ELEMENT raw EMPTY >
<!ATTLIST raw
    ack         (global | local | no_ack) #REQUIRED
    datasize CDATA #IMPLIED
    data     CDATA #IMPLIED>

子选项ldap

结构:

<!ELEMENT ldap (attr* | modification*) >
<!ATTLIST ldap
    password    CDATA   #IMPLIED
    user        CDATA   #IMPLIED
    type        (bind | unbind | search | start_tls | add | modify ) #REQUIRED
    result_var  CDATA   #IMPLIED
    filter      CDATA   #IMPLIED
    base        CDATA   #IMPLIED
    scope       (singleLevel | baseObject | wholeSubtree) #IMPLIED
    cacertfile  CDATA   #IMPLIED
    keyfile     CDATA   #IMPLIED
    certfile    CDATA   #IMPLIED
    dn          CDATA   #IMPLIED >

子:

<!ELEMENT modification (attr*) >
<!ATTLIST modification
    type CDATA #REQUIRED>


<!ELEMENT attr (value+) >
<!ATTLIST attr
    type CDATA #REQUIRED>

<!ELEMENT value (#PCDATA) >

子选项websocket

结构:

<!ELEMENT websocket (#PCDATA) >
<!ATTLIST websocket
    type (connect | message | close) #REQUIRED
    ack  (no_ack | parse) #IMPLIED
    frame (binary | text) #IMPLIED
    origin CDATA ""
    subprotocols CDATA ""
    path CDATA "/" >

子选项amqp

结构:

<!ELEMENT amqp (#PCDATA) >
<!ATTLIST amqp
    type CDATA #REQUIRED
    vhost CDATA "/"
    channel CDATA "-1"
    exchange CDATA ""
    routing_key CDATA ""
    payload CDATA ""
    payload_size CDATA "100"
    prefetch_size CDATA "0"
    prefetch_count CDATA "0"
    persistent CDATA "false"
    queue CDATA ""
    timeout CDATA "1"
    ack CDATA "false" >

子选项mqtt

结构:

<!ELEMENT mqtt (#PCDATA) >
<!ATTLIST mqtt
    type CDATA #REQUIRED
    clean_start CDATA "false"
    keepalive CDATA "10"
    will_topic CDATA ""
    will_qos CDATA "0"
    will_msg CDATA ""
    will_retain CDATA "false"
    topic CDATA ""
    qos CDATA "0"
    retained CDATA "false"
    timeout CDATA "1"
    username CDATA ""
    password CDATA "" >

子选项setdynvars

结构:

<!ELEMENT setdynvars (var*) >
<!ATTLIST setdynvars
    sourcetype   (random_string | urandom_string | random_number |
          file | erlang | eval| jsonpath | value | server)  #REQUIRED
    callback     CDATA   #IMPLIED
    code         CDATA   #IMPLIED
    fileid       CDATA   #IMPLIED
    order        (iter | random ) #IMPLIED
    delimiter    CDATA   #IMPLIED
    length       CDATA   #IMPLIED
    start        CDATA   #IMPLIED
    end          CDATA   #IMPLIED
    from         CDATA   #IMPLIED
    jsonpath     CDATA   #IMPLIED
    value        CDATA   #IMPLIED >

子:

<!ELEMENT var (#PCDATA) >
<!ATTLIST var
    name CDATA #REQUIRED>

循环、判断语句

for:

<!ELEMENT for (request | thinktime | transaction | setdynvars | for |
          if | repeat | change_type | foreach | interaction | abort )+>
<!ATTLIST for
    var      CDATA      #REQUIRED
    from     CDATA      #REQUIRED
    to       CDATA      #REQUIRED
    incr     NMTOKEN   "1">

foreach:

<!ELEMENT foreach (request | thinktime | transaction | setdynvars | foreach |
          if | repeat | change_type | for  | interaction | abort )+>
<!ATTLIST foreach
    name     NMTOKEN    #REQUIRED
    in       NMTOKEN    #REQUIRED
    include    CDATA    #IMPLIED
    exclude    CDATA    #IMPLIED >

repeat:

<!ELEMENT repeat (request | thinktime | transaction | setdynvars | for | repeat
| while | if | until | change_type | foreach  | interaction | abort )+>
<!ATTLIST repeat
    name      NMTOKEN    #REQUIRED
    max_repeat  NMTOKEN   "20">

if:

<!ELEMENT if (request | thinktime | transaction | setdynvars | for | repeat
| while | if | until | change_type | foreach | interaction | abort )+>
<!ATTLIST if
    var       CDATA #REQUIRED
    eq        CDATA #IMPLIED
    neq       CDATA #IMPLIED
    gt        CDATA #IMPLIED
    gte       CDATA #IMPLIED
    lt        CDATA #IMPLIED
    lte       CDATA #IMPLIED >

while:

<!ELEMENT while EMPTY>
<!ATTLIST while
    var       CDATA #REQUIRED
    eq        CDATA #IMPLIED
    neq       CDATA #IMPLIED
    gt        CDATA #IMPLIED
    gte       CDATA #IMPLIED
    lt        CDATA #IMPLIED
    lte       CDATA #IMPLIED >

<!ELEMENT until EMPTY>
<!ATTLIST until
    var       CDATA #REQUIRED
    eq        CDATA #IMPLIED
    neq       CDATA #IMPLIED
    gt        CDATA #IMPLIED
    gte       CDATA #IMPLIED
    lt        CDATA #IMPLIED
    lte       CDATA #IMPLIED >