Ok, I got the SNMP working, thanks to Roman's suggestion to reset to factory
defaults... I've written a VBScript to monitor the statistics available from
the WAP11. I couldn't find where anyone had posted anything like this
before, so I though I'd send it along...

The output formatting could easily be changed to use this with MRTG, but I
don't have MRTG set up yet and so I haven't done it. It uses smtputil.exe to
query the WAP11, which (I think) is installed with Win2k by default. Change
the target, community, and OID to suit your needs... OIDs for wireless and
ethernet statistics and offsets are listed at the bottom.

(save text below with .vbs extension)
---------------------------------------------------------------------
option explicit

dim snmputil, snmpcmd, target, community, oid, oShell, oArgs, oArg
dim cData, BaseTX, BaseRX, BaseAckFailure

target = "192.168.0.250"
community = "public"
oid = ".1.3.6.1.4.1.410.1.2.3.1.0"
snmputil = "c:\winnt\system32\snmputil.exe"

snmpcmd = snmputil & " get " & target & " " & community & " " & oid
set oShell = wscript.CreateObject("wscript.shell")

'GetMatches polls the WAP11 and returns the HEX statistic values in a RegExp
Matches object.
Set cData = GetMatches()

'GetStat parses the HEX values and returns the Decimal value of the
statistic.
'Usage: GetStat(<Matches Object from GetMatches>, <offset of statistic you
want>)
'The offsets are listed below.
BaseTX = GetStat(cData, 0)
BaseRX = GetStat(cData,28)
BaseAckFailure = GetStat(cData,56)

'you can add your own output formatting here.
wscript.Echo("TX: " & BaseTX & " RX: " & BaseRX & " AckFailure: " &
BaseAckFailure)

Function GetMatches()
 Dim oExec, sStdOut, regEx, match, matches
 set oExec = oShell.Exec (snmpcmd)
 sStdOut = oExec.StdOut.ReadAll

 set regEx = new RegExp
 regEx.Pattern = "\<\w*\>"
 regEx.Global = True
 set Matches = regEx.Execute(sStdOut)
 Set GetMatches = Matches
End Function


Function GetStat(cMatches, offset)
 offset = offset + 3
 Dim i, hval
 For i = 0 to 3
  hval = hval & mid(cMatches(offset - i).value,4,2)
 Next
 GetStat = ConvertHex(hval)
End Function

Function ConvertHex(HexVal)
  Dim x, y, z, v
    For x = 1 To Len(HexVal)
      y = Mid(HexVal, ((Len(HexVal) - x) + 1), 1)
      On Error Resume Next
      v = CLng("&H" & y)
      If Err.Number <> 0 Then
        wscript.Echo("Invalid Hex Value")
        Exit Function
      End If
      On Error GoTo 0
      z = z + (v * 16 ^ (x - 1))
    Next
  ConvertHex = z
End Function

'   Offsets for OID .1.3.6.1.4.1.410.1.2.3.1.0 (Wireless Stats)
'0 UnicastTransmittedPackets;
'4 BroadcastTransmittedPacets;
'8 MulticastTransmittedPackets;
'12 TransmittedBeacon;
'16 TransmittedACK;
'20 TransmittedRTS;
'24 TransmittedCTS;
'28 UnicastReceivedPackets;
'32 BroadcastReceivedPackets;
'36 MulticastReceivedPackets;
'40 ReceivedBeacon;
'44 ReceivedACK;
'48 ReceivedRTS;
'52 ReceivedCTS;
'56 ACKFailure;
'60 CTSFailure;
'64 RetryPackets;
'68 ReceivedDuplicate;
'72 FailedPackets;
'76 AgedPackets;
'80 FCSError;
'84 InvalidPLCP;

'   Offsets for OID .1.3.6.1.4.1.410.1.1.7.1.0 (Ethernet RX Stats)
'       or OID .1.3.6.1.4.1.410.1.1.7.2.0 (Ethernet TX Stats)
'0  TotalPacketsRx;
'4  PacketCRCErrorRx;
'8  MulticastPacketRx;
'12 BroadcastPacketRx;
'16 ControlFramesRx;
'20 PauseFramesRx;
'24 UnknownOPCodeRx;
'28 AlignmentRxError;
'32 LengthOutOfRangeRx;
'36 CodeErrorRx;
'40 FalseCarrierRx;
'44 UndersizePacketsRx;
'48 OversizePacketsRx;
'52 TotalFragmentsRx;
'56 TotalJabberRx;

--
general wireless list, a bawug thing <http://www.bawug.org/>
[un]subscribe: http://lists.bawug.org/mailman/listinfo/wireless

Reply via email to