Jump to content

network statistics not working


Recommended Posts

I am looking to monitor network traffic bytes.

However ("Bytes received ..........: " & $aInfo[ 1]) is not incrementing.

It resolves to the computers 192.168.2.100 ip.

I am pinging both 127.0.0.1 and 192.168.2.100

LATER NOTE. IF 192.168.2.100 USED THEN BYTES READ INCREASES, BUT IS AT A CONTANT INTERVAL, REGARDLESS OF TRAFFIC.

SEE OTHERPOSTS BELOW

Edited by trademaid
Link to comment
Share on other sites

if ip is 127 .. or 192 168.. then the traffic is identical, rather than varying with network load.

here is the log and new code.

note how the numbers increment in 1298 intervals

15:24, 1298

15:25, 2596

15:26, 3894

15:27, 5192

15:28, 6490

15:29, 7788

15:30, 9086

15:31, 10384

15:32, 11682

15:33, 12980

;$computr="127.0.0.1"

;;$computr="192.168.2.1"

$computr="192.168.2.100"

;$computr="shuttle"

$bytes=0

$xfer=0

$oldxfer=0

#include <Math.au3>

$bytes=_Net_Share_StatisticsGetWrk ($computr)

$start1=$bytes[1]

$countr=$bytes[1]

;****_net_share_s

FileDelete("c:\test.txt")

For $i = 1 to 10 Step 1

; MsgBox(0, "Count down!", $i)

$bytes=_Net_Share_StatisticsGetWrk($computr)

;$start1=$bytes[1]

;MsgBox(0, "bytes=*=: " & $bytes[1],1,10)

;MsgBox(0, "xfer: " & $xfer,$i,1)

;ProgressOn("xfer Meter", "Increments every second", "0 percent")

;sleep(100)

$bytes=_Net_Share_StatisticsGetWrk($computr)

$countr=$bytes[1]

$xfer=$countr-$start1

;if $xfer >= $oldxfer then

MsgBox(0,"tp1" & $bytes[1] & " " & $computr, $xfer, 1)

;EndIf

$file = FileOpen("c:\test.txt", 1)

; Check if file opened for writing OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

;FileWrite($file, "Line1")

FileWrite($file, @min & ":" & @sec & ", " & $xfer & @CRLF)

;FileWrite($file, "Line2")

FileClose($file)

$oldxfer=$xfer

;#include <Math.au3>

$x = _Min(100, $xfer) ; returns 10

;ProgressSet($x,$xfer)

next

Link to comment
Share on other sites

  • 4 weeks later...

Does anyone have a fix for this?

I have used $rc=_Rundos("netstat -e > c:\temp\netstatoute.txt") with some success.

However the computer crashed after running this script every 2 seconds for a day or so.

I suspect a memory leak.

Comments anyone?

if ip is 127 .. or 192 168.. then the traffic is identical, rather than varying with network load.

here is the log and new code.

note how the numbers increment in 1298 intervals

15:24, 1298

15:25, 2596

15:26, 3894

15:27, 5192

15:28, 6490

15:29, 7788

15:30, 9086

15:31, 10384

15:32, 11682

15:33, 12980

;$computr="127.0.0.1"

;;$computr="192.168.2.1"

$computr="192.168.2.100"

;$computr="shuttle"

$bytes=0

$xfer=0

$oldxfer=0

#include <Math.au3>

$bytes=_Net_Share_StatisticsGetWrk ($computr)

$start1=$bytes[1]

$countr=$bytes[1]

;****_net_share_s

FileDelete("c:\test.txt")

For $i = 1 to 10 Step 1

; MsgBox(0, "Count down!", $i)

$bytes=_Net_Share_StatisticsGetWrk($computr)

;$start1=$bytes[1]

;MsgBox(0, "bytes=*=: " & $bytes[1],1,10)

;MsgBox(0, "xfer: " & $xfer,$i,1)

;ProgressOn("xfer Meter", "Increments every second", "0 percent")

;sleep(100)

$bytes=_Net_Share_StatisticsGetWrk($computr)

$countr=$bytes[1]

$xfer=$countr-$start1

;if $xfer >= $oldxfer then

MsgBox(0,"tp1" & $bytes[1] & " " & $computr, $xfer, 1)

;EndIf

$file = FileOpen("c:\test.txt", 1)

; Check if file opened for writing OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

;FileWrite($file, "Line1")

FileWrite($file, @min & ":" & @sec & ", " & $xfer & @CRLF)

;FileWrite($file, "Line2")

FileClose($file)

$oldxfer=$xfer

;#include <Math.au3>

$x = _Min(100, $xfer) ; returns 10

;ProgressSet($x,$xfer)

next

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...