Commit 4ca59177 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/snmpd: update show-pstats script

--update show-pstats script after transpose of wrsPstats into wrsPstatsTable
--update wrs-user-manual with information about possible usage of snmptable

Instead of using script show-pstats, snmptable can be used. For example:
snmptable -c public -v 2c switch_IP -m all -M $WRS_OUTPUT_DIR/build/buildroot-2011.11/output/build/netsnmp-5.6.1.1/mibs/:userspace/snmpd/ WR-SWITCH-MIB::wrsPstatsTable
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 365bf66b
......@@ -1360,6 +1360,63 @@ If everything goes well, you'll get a window like the following one:
@center @image{show-pstats, 10cm,, show-pstats}
Command @t{snmptable} can also be used to get simillar results:
@smallexample
snmptable -Cw 80 -c public -v 2c 192.168.1.10 -m all \
-M $WRS_OUTPUT_DIR/build/buildroot-2011.11/output/build/netsnmp-5.6.1.1/mibs/\
:userspace/snmpd/ WR-SWITCH-MIB::wrsPstatsTable
@end smallexample
Output is in text form and looks like:
@smallexample
SNMP table: WR-SWITCH-MIB::wrsPstatsTable
wrsPstatsPortName wrsPstatsTXUnderrun wrsPstatsRXOverrun wrsPstatsRXInvalidCode
wr0 0 0 0
wr1 0 0 0
wr2 0 0 0
wr3 0 0 0
wr4 0 0 0
wr5 0 0 0
wr6 0 0 0
wr7 0 0 0
wr8 0 0 0
wr9 0 0 0
wr10 0 0 0
wr11 0 0 0
wr12 0 0 0
wr13 0 0 0
wr14 0 0 0
wr15 0 0 0
wr16 0 0 0
wr17 0 0 0
SNMP table WR-SWITCH-MIB::wrsPstatsTable, part 2
wrsPstatsRXSyncLost wrsPstatsRXPauseFrames wrsPstatsRXPfilterDropped
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
(...)
@end smallexample
Unfortunately output due to the number of counters is very wide. Number of
characters per line can be limited by switch @t{Cw}, in example was set to 80.
@c ##########################################################################
@node Bugs and Troubleshooting
......
......@@ -2,7 +2,7 @@
# Allow user override
if [catch "set cmd \"\$env(SHOWPS_CMD)\""] {
set cmd "snmpwalk -c public -v 2c -On -Oq HOST .1.3.6.1.4.1.96.100.2.1"
set cmd "snmpwalk -c public -v 2c -On -Oq HOST .1.3.6.1.4.1.96.100.6.4.1"
}
if ![llength $argv] {
......@@ -21,13 +21,53 @@ proc updatew {wname} {
grid [label $wname.wr$i -text "WR$i" -fg blue] -row 0 -column $c
}
}
set labels {wrsPstatsPortName
wrsPstatsTXUnderrun
wrsPstatsRXOverrun
wrsPstatsRXInvalidCode
wrsPstatsRXSyncLost
wrsPstatsRXPauseFrames
wrsPstatsRXPfilterDropped
wrsPstatsRXPCSErrors
wrsPstatsRXGiantFrames
wrsPstatsRXRuntFrames
wrsPstatsRXCRCErrors
wrsPstatsRXPclass0
wrsPstatsRXPclass1
wrsPstatsRXPclass2
wrsPstatsRXPclass3
wrsPstatsRXPclass4
wrsPstatsRXPclass5
wrsPstatsRXPclass6
wrsPstatsRXPclass7
wrsPstatsTXFrames
wrsPstatsRXFrames
wrsPstatsRXDropRTUFull
wrsPstatsRXPrio0
wrsPstatsRXPrio1
wrsPstatsRXPrio2
wrsPstatsRXPrio3
wrsPstatsRXPrio4
wrsPstatsRXPrio5
wrsPstatsRXPrio6
wrsPstatsRXPrio7
wrsPstatsRTUValid
wrsPstatsRTUResponses
wrsPstatsRTUDropped
wrsPstatsFastMatchPriority
wrsPstatsFastMatchFastForward
wrsPstatsFastMatchNonForward
wrsPstatsFastMatchRespValid
wrsPstatsFullMatchRespValid
wrsPstatsForwarded
wrsPstatsTRURespValid
}
# open a file according to the command given
set F [open "| $w($wname:cmd)" r]
while {[gets $F str] > 0} {
foreach {oid value} $str {
# remove the leading part
regsub ".1.3.6.1.4.1.96.100.2.1." $oid "" oid
regsub ".1.3.6.1.4.1.96.100.6.4.1." $oid "" oid
# extract column and row
foreach {col row} [split $oid .] {
if ![string length $row] break
......@@ -38,10 +78,24 @@ proc updatew {wname} {
set width "-width 8"
if {$col == 1} {set width ""}
eval $name config -text \"$value\" $width
grid $name -row $row -column $col
set row1 [expr $row +1]
grid $name -row $col -column $row1
}
}
}
}
set n [llength $labels]
set row 0
while {$row < $n} {
set name $wname.1_${row}
if $new {
label $name
}
set counter_name [lindex $labels $row]
eval $name config -text \"$counter_name\"
set row1 [expr $row +2]
grid $name -row $row1 -column 1
incr row
}
if [catch "close $F" message] {
puts stderr "Error in snmpwalk for host $w($wname:host)"
puts stderr $message
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment