statWatch
statWatch - automatically get the statistics on a set of ports.
SYNOPSIS
statWatch sub-command options
DESCRIPTION
The statWatch command is used to create a group of ports and a list of statistics for the purpose of automatically retrieving all of the statistics in the list from the group of ports at the same time. Statistics are automatically delivered once per second. Statistics are then read using the statList command.
Multiple stat watches may be created, each with it's own ID. Each stat watch contains a list of ports and a list of statistics.
Note that the statName used in addStat and delStat is formed from the standard option name by prepending stat to the name and capitalizing the first letter of the option. (For example, for the option framesSent, the statName is statFramesSent.)
Refer to the Ixia Reference Guide for a list of which statistics are available for particular card modules and under particular circumstances.
STANDARD OPTIONS
none
COMMANDS
The statWatch command is invoked with the following sub-commands. If no sub-command is specified, returns a list of all sub-commands available.
statWatch addPort watchID chassisID cardID portID
Adds the indicated port to the list of ports in the stat watch whose ID is watchID. Specific errors are:
- The stat watch with ID watchID does not exists.
- The port is invalid
statWatch addStat watchID statName
Adds the indicated statistic to the list of statistics in the stat watch whose ID is watchID. Specific errors are:
- The stat watch with ID watchID does not exists.
statWatch addStatRate watchID statName
Adds the indicated statistic rate to the list of statistics in the stat watch whose ID is watchID. Specific errors are:
- The stat watch with ID watchID does not exists.
statWatch create watchID
Creates a new stat watch with ID watchID. Specific errors are:
- The stat watch with ID watchID already exists.
statWatch delPort watchID chassisID cardID portID
Deletes the indicated port from the list of ports in the stat watch whose ID is watchID. Specific errors are:
- The stat watch with ID watchID does not exists.
- The port is invalid
statWatch delStat watchID statName
Deletes the indicated statistic from the list of statistics in the stat watch whose ID is watchID. Specific errors are:
- The stat watch with ID watchID does not exists.
- The statName is not in the stat watch port list
statWatch delStatRate watchID statName
Deletes the indicated statistic rate from the list of statistics in the stat watch whose ID is watchID. Specific errors are:
- The stat watch with ID watchID does not exists.
- The statName is not in the stat watch port list
statWatch destroy watchID
Deletes the stat watch with ID watchID. Specific errors are:
- The stat watch with ID watchID does not exists.
statWatch start watchID
Starts watching the stat watch whose ID is watchID. The statistics in the stat watch are regularly delivered for all of the ports in the stat watch. The individual statistics may be read through use of the statList command. Specific errors are:
- The stat watch with ID watchID does not exists.
statWatch setDefault
Stops and destroys all of the stat watches.
statWatch stop watchID
Stops watching the stat watch whose ID is watchID. Specific errors are:
- The stat watch with ID watchID does not exists.
EXAMPLES
set portList { {1 1 1} {1 1 2}}
set statList {statFramesSent statFramesReceived}
set watchID 42
statWatch setDefault
# Create a watch with $watchID
if [statWatch create $watchID] {
errorMsg "Error creating watch $watchID"
}
# add ports to get stats on
foreach port $portList {
scan $port "%d %d %d" c l p
if [statWatch addPort $watchID $c $l $p] {
errorMsg "Error adding port $c $l $p to statWatch $watchID"
}
}
# Add the stats to the watch
foreach statItem $statList {
if [statWatch addStat $watchID $statItem] {
errorMsg "Error adding $statItem to statWatch $watchID"
}
if [statWatch addStatRate $watchID $statItem] {
errorMsg "Error adding $statItem to statWatch $watchID"
}
}
# Start the watch with $watchID
if {[statWatch start $watchID]} {
errorMsg "Error watching stats on statWatch $watchID"
}
# Look at the statistics once per second
for {set i 0} {$i <= 10} {incr i} {
logMsg "********** Polling $i of 10 ****************"
# Read the stats
statList setDefault
foreach port $portList {
scan $port "%d %d %d" c l p
logMsg "Port $c $l $p"
if {[statList get $c $l $p]} {
continue
}
logMsg "\tFrames transmitted: [statList cget -framesSent]"
logMsg "\tFrames received: \
[statList cget -framesReceived]"
if {[statList getRate $c $l $p]} {
continue
}
logMsg "\tTransmit rate: [statList cget -framesSent]"
logMsg "\tReceive rate: [statList cget -framesReceived]"
}
after 1000
}
# stop the watch
if [statWatch stop $watchID] {
errorMsg "Error stopping stats on statWatch $watchID"
}
# Destroy the watch
if [statWatch destroy $watchID] {
errorMsg "Error destroying watch $watchID"
}