Page 2 of 2 <12
Topic Options
#36756 - 2003-02-22 12:13 AM Re: Monitor Connectivity on My Own Network ?
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Richard,

you're right about PLAY [Wink]

AzzerShaw,

do you wish to be remembered every 60 secs that a machine is up or not. If not then the addresslist must be modified after the msg that the node was up. If addreslist = empty, all machines are up and the script may be exited...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#36757 - 2003-02-22 12:45 AM Re: Monitor Connectivity on My Own Network ?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Final changes (hopefully) [Smile]
code:
Break ON

; Set address list to all the hosts you want to monitor.
$asAddressList="130.11.21.1","10.0.0.2","steed.sgb.co.uk"

Dim $aiStatus[UBound($asAddressList)+1]

$iInterval=60 ; Number of seconds between checks
$sSound="c:\windows\media\chimes.wav" ; Path to sound to play

While "true"
$sMessage=""
For $iIndex=0 To Ubound($asAddressList)
$sAddress=$asAddressList[$iIndex]
$iStatus=$aiStatus[$iIndex]
If fnMonitorIP($sAddress)
If $iStatus
$sMessage=$sMessage+@TIME+" Address " + $sAddress + " is now unavailable." +@CRLF
EndIf
$aiStatus[$iIndex]=0
Else
If $iStatus=0
$sMessage=$sMessage+@TIME+" Address " + $sAddress + " is responding." +@CRLF
EndIf
$aiStatus[$iIndex]=1
EndIf
Next
If $sMessage <> ""
Play $sSound
$sMessage
$Null=MessageBox("$sMessage","Change in monitored station status",0,5)
EndIf
Sleep($iInterval)
Loop

Function fnMonitorIP($sAddress)
Shell '%COMSPEC% /C ping -n 1 ' + $sAddress + ' >/dev/null'
$fnMonitorIP=@ERROR
Return
EndFunction

This version works as before with the following changes:
  • The message and sound are only displayed once for each workstation as it comes onto the network.
  • An alert is displayed when a monitored workstation is removed from the network, and an alert will be subsequently displayed if it re-appears.
A history of the workstation connecting/disconnecting will be present on the console.

Top
#36758 - 2003-02-22 12:55 AM Re: Monitor Connectivity on My Own Network ?
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Nice...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#36759 - 2003-02-21 01:52 PM Re: Monitor Connectivity on My Own Network ?
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Aaghhh Hit a snag. If the laptop uses dhcp to remotley connect to the network, is there anyway i can use the computername instead of the ip address ? Its not coming up using dns

Why isnt everything ez ?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#36760 - 2003-02-21 01:58 PM Re: Monitor Connectivity on My Own Network ?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
How is the laptop getting it's DHCP assigned address?
Top
#36761 - 2003-02-21 02:54 PM Re: Monitor Connectivity on My Own Network ?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Look into the UDF Ping()

May help you a bit. Still need to know a little more about how the computer is connecting to your network.

Thanks
_________________________
Austin Henderson

Top
#36762 - 2003-02-21 03:01 PM Re: Monitor Connectivity on My Own Network ?
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
I have dhcp server for laptops on my network ?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#36763 - 2003-02-21 03:50 PM Re: Monitor Connectivity on My Own Network ?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I was looking for a little more specific information than that [Smile]

If you are using a modern BIND implementation with a modern DHCP server you should configure the DHCP server to update your DNS records by using DDNS (nsupdate) updates whenever an IP address is leased or released. If your clients are Win2K they can also be configured to register their names when they get a lease.

If the laptop PC is going to participate in WINS/NetBios and your DNS service is provided by NT you can configure it to use a sort of WINS passthrough, where the DNS service will use WINS for name resolution. Clunky and a bit crap but it works.

If the laptop is not going to register it's name in WINS or respond to NETBios broadcasts you are a bit stuffed.

If your DHCP servers are NT4.0 you can switch on logging. This will create log files in \winnt\system32\dhcp which record lease renewals ans assignments. You will need to parse this file looking for the relevant entries - here is a sample of the file:
code:
10,02/21/03,12:55:07,Assign,10.17.16.46,SGB-5938,0080640C96BC
11,02/21/03,12:56:53,Renew,10.17.20.21,SGB-07772,0000397100B9

As you can see, two machines (SGB-07772 and SGB-5938) have leased IP addresses, one a renewal and the other an assign.

There is also a DHCP query tool available in the NT resource kit which will dump the database.

If your DHCP servers are Cisco routers or Access serves or similar, you're on your own [Eek!]

Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1160 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.03 seconds in which 0.011 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org