Advice Please! monitor files on another network?

Networking/Security Forums -> Programming and More

Author: TheKingsterLocation: UK PostPosted: Tue Sep 17, 2002 11:28 am    Post subject: Advice Please! monitor files on another network?
    ----
Heres one to tangle your brains:

Picture a scenario -

I wish to be able to sit on my pc at work, with a webpage open, and monitor the existence of certain files on another network. The other network I have full admin access to via PcAnywhere\VNC. If one of them files goes missing, it will show on the webpage.

Now the only way I can think of doing this is by having a server side page, with some sort of vb app on their network I make that posts certain strings to the page to tell it the file exists. With it being server side I will see it everytime I refresh the page.

Good way to do this or not? Any alternatives?

Also, I have been trying to run urls from vb, using the shell command. If you do a start then run and type in a full url, it works fine, or iexplore.exe url is ok to, but:

shell "http://www.yahoo.com" and shell "iexplore.exe http://www.yahoo.com" dont work. Any ideas?

Any help appreciated

Author: Mongrel PostPosted: Tue Sep 17, 2002 12:50 pm    Post subject:
    ----
We use IPMonitor - http://www.deepmetrix.com/ipmonitor - for a similar application. It monitors the bulk of our network activity and calls our Cell Phone in case of problems. There is the ability to monitor File Change, report on Event Log activity (say you were auditiing the activity on these files) and a couple other file-related functions are buried within other functions. We use it to test FTP by authenticating to the server and looking for the existence of a file in a known location.

Author: enigmanLocation: Sydney PostPosted: Thu Oct 10, 2002 6:27 am    Post subject: You could try using Windows Script Host
    ----
If the machine you are wanting to monitor is a Windows box, you could always write a script using Windows Script Host and have it check for the presence of the file(s). If the file(s) isn't present have it insert the required text into a HTML file or into a text file. Have an ASP page insert the text from the text file into a HTML document. Assuming you aren't squeamish about having WSH active on a box and that the script is monitoring files on the one box.

Some sample VBScript code

Code:

Dim oFSO, oFile
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
If Not oFSO.FileExists("YourFileName") Then
  ' Create some text to insert into a HTML or text file
Else
  ' Do  nothing
End If

Set oFSO = Nothing


You could then call the script on the box via a schedule.

The whole thing could probably also be done using ASP and have the page refresh itself every few minutes.

Enigman
Thought of the day:
It's okay to call someone stupid; just don't prove it.

Author: browolf PostPosted: Thu Oct 10, 2002 11:56 am    Post subject:
    ----
if you're using wsh, instead of having the webpage u could just make it do "net send", and send you a alert windows when one of the files has gone.

Author: Jason PostPosted: Thu Oct 10, 2002 1:18 pm    Post subject: Expand...
    ----
with regards to launching webpages, try the command below:

"C:\Program Files\Internet Explorer\iexplore.exe" -nohome "www.yahoo.com"

No gaurentees it will work but worth a try.

The way the main problem is handled depends on your exact requirements, and tools availalbe to you. You mentioned you wish to monitor "files"? are they likely to go missing? or are do you just wish to keep tabs of when a server goes down? Assuming you are only monitoring files, see below:

I would agree with browolf and use a net send command. i have expanded the vbscript by enigman to do this:

Code:

Dim oFSO, oFile
Dim wshshell
Set wshshell=createobject("wscript.shell")
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")

If Not oFSO.FileExists("YourFileName") Then
 wshshell.run ("net send username One of your files has gone missing")
Else
  ' Do  nothing
End If

Set oFSO = Nothing


Explaination:
This is the full script which tests for the existance of the file name, and sends a notification if it is not there.

we assume you have netbios access to the file you want to check.

to make the script work on your system, change "username" in the net send statement to which ever user you log on as. also change "yourfilename" to the name of the file.

There is room for expanding this script:
1) send an email if the file is not there
2) log the event to a file or the system eventlog
3) automatically copy back a file if the one you are monitoring gets deleted.

to make sure the script is constently in action, you could:
1) modify the script to continiously loop
2) add a scheduled task to run the scipt every x mins.

Best of luck
Jason

Author: Jason PostPosted: Thu Oct 10, 2002 1:34 pm    Post subject:
    ----
With regards to sending an email by vb script, see the following KB article:
It describes sending emails via script.

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q197920

If this suits your needs better than the net send idea, me or another user (voulenters? Very Happy ) can build a combined script.

let us know.


J

Author: browolf PostPosted: Thu Oct 10, 2002 6:47 pm    Post subject:
    ----
or

you can get commandline emailers. i think the most well known one is called Blat.
(http://www.interlog.com/~tcharron/blat.html)

~Andy

Author: Jason PostPosted: Fri Oct 11, 2002 4:15 pm    Post subject:
    ----
To open an IE page from VB script, try the following code:

Code:

Dim ie
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "http://www.website.com"
ie.visible=1


J



Networking/Security Forums -> Programming and More


output generated using printer-friendly topic mod, All times are GMT + 2 Hours

Page 1 of 1

Powered by phpBB 2.0.x © 2001 phpBB Group