Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

A question for all the programmers out there

Thread Tools
 
Search this Thread
 
Old 31 May 2002, 11:13 AM
  #1  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Question

We have a utility running on all our network PC's. It generates a text file, but I have to manually connect to each workstation using it's UNC path to monitor the output of the file.

What I'd like to do is create a utility which can be installed as a service on each client (NT4). This utility will poll the text file every "x" number of minutes and listen on a available IP port.

I then want to create another management utility that will poll each of the clients (using it's IP address and the port number) querying what the value of the text file is.

What's the easiest way of achieving this? and what programming language do you suggest? VB?

Stefan
Old 31 May 2002, 11:42 AM
  #2  
Michael Robinson
Scooby Regular
 
Michael Robinson's Avatar
 
Join Date: May 2002
Posts: 831
Likes: 0
Received 0 Likes on 0 Posts
Post

We have something similar here at work and how it works is we right into the loggin script which then grabs the designated file (pc specs in our case) and passes them to a central point.
Old 31 May 2002, 11:48 AM
  #3  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

It's surely a 20 minute job, either use webservers or some SOAP app.

Steve.
Old 31 May 2002, 11:51 AM
  #4  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

Michael,

The workstations run an analysis tool. I need to poll the files every minute or so and not just when the user logs in. It doesn't need to be a live feed, but every 5-10 minutes would probably be sufficient.

The text file as a simple value showing how far the analysis has progressed. I need to monitor groups of workstations and how each group analysis is doing. I can then provide summary reports to the management.

The reason I need to use IP is that some workstations belong to completely seperate NT domains (with no trust relationships). Using UNC is VERY slow as it needs to authenticate when checking paths. A few will fail simply because the central workstation needs to have username/passwords entered manually.

I've been looking at ways around this for a few weeks and I think IP ports is the way to go.

Stefan
Old 31 May 2002, 11:52 AM
  #5  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

Steve,

If it's only a 20min job, then please explain yourself

Stefan
Old 31 May 2002, 11:57 AM
  #6  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

what about creating a null session share on the machine... (anybody can access these, without a trust relationship) or get the client machines to poll the server... that would be easier would it not?

or create an account on the server and do a net use \\server\share /user:domain\user

David
Old 31 May 2002, 12:02 PM
  #7  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Sure Set up webservers on each box you need to communicate with, some kind of other service (like cron on UNIX) to poll the webservers every X minutes and get the status of the file. You can transfer files, read/process whatever, all via HTTP. Or you can substitute webservers with some SOAP services to achieve the same effect. I'll write it for you if you like, but I'll charge you and it'll be in Perl

Steve.
Old 31 May 2002, 12:11 PM
  #8  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

Steve,

I only want to put a very small app on the workstations, so don't fancy sticking a webserver on each of them. Something nice and simlpe is all I'm after.

David,

UNC is far too slow, even using the NET USE commands with user authentication. I have some analysis reporting software nd it's using the UNC paths just now. Trouble is, it hangs for a couple of minutes whilst it validates the path. And to poll this every 5mins is a pain in the @rse.

Stefan
Old 31 May 2002, 12:14 PM
  #9  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

No problem, one little process waiting for a connection on a port of your choice is all you need.

Steve.
Old 31 May 2002, 12:27 PM
  #10  
SWRTWannabe
Scooby Regular
 
SWRTWannabe's Avatar
 
Join Date: Dec 2001
Posts: 4,227
Likes: 0
Received 0 Likes on 0 Posts
Post

I would say that services are best written using C / C++ (I am a C/C++ programmer, so I may be biased). A colleague did write a service in VB, but as far as I remember, it was a bit of a fudge.

What you are aiming to do sounds quite feasible, and if you need someone to write it, I'm available a reasonable rate
Old 31 May 2002, 12:31 PM
  #11  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

vb.net can create services easily and they can be multi threaded and dont have to be single appartment..

What about ftping the files then.

David
Old 31 May 2002, 12:41 PM
  #12  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

There's no point using FTP since a local copy of the files isn't required, and with HTTP you can request the file straight into a variable instead of copying it over, reading a file, and deleting it. You can write it in any language you like - it makes zero difference - unless you take maintainability, speed of development, and the fact that a C++ application that just sends a small text file smells of massive overkill (like implementing a webserver to do the job If you plan on integrating it later into something bigger then take that into consideration too, because that'll affect your language choice.

Steve.
Old 31 May 2002, 12:55 PM
  #13  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

FTP'ing is a possibility, but I'd rather leave the originals on the workstations. Once the analysis is complete, it does report the stats back to the central PC already, but I'd like the ability to monitor it in almost real-time (well, my interpretaion of the phrase).

I though it'd be cool to write some utils; might rekindle my programming days @ college.

Stefan
Old 31 May 2002, 01:02 PM
  #14  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

It will be "real time", in that each time a request is made, you'll get completely up-to-date information valid at the time of processing.

Steve.
Old 31 May 2002, 01:24 PM
  #15  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

Steve,

So for a complete novice like me, what products would I need to do this i.e. what get installed on the client & central workstation and what code would you suggest I use?

It's a pet-project, so something up-to-date would be ideal. So, don't go suggesting COBOL We've enough of those programmers here already

Stefan
Old 31 May 2002, 01:36 PM
  #16  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

I'd do it in Perl personally (I can also program in C, but Perl is perfect for this kind of job), so get yourself ActiveState Perl (www.activestate.com). You have a few options of course, it stinks of SOAP but you could do it with HTTP:aemon and LWP. If you're going to jump into this head first you might have a steep learning curve, but you'll learn a lot in the process.

You need a daemon (service) on each machine you want to query, it sits there listening on a port waiting for a connection. When one comes in it gets the requests and dumps the file down the open socket, the client disconnects and the daemon just sits there again waiting.

Your client can either run all the time (as another daemon/service) or you can just have it execute every X minutes, via a cron-like service which I'm sure there is one on Win32. It just makes a connection to each machine you want to query, grabs the data from each, stores it in a variable locally, and processes it. Simple as that.

The Perl code for the servers are about .. 20-odd lines give or take, but you'll need to install a couple of modules (SOAP::Lite has many, many dependencies whereas the HTTP:: modules will require a lot less), but the code to make an HTTP request is one line. Then you just do whatever you want to do with the data.

Steve.

God damn the UBB horse manure. The "Big smiley" should be "HTTP:: Daemon" without the space!


[Edited by stevencotton - 5/31/2002 1:38:47 PM]
Old 31 May 2002, 01:50 PM
  #17  
IWatkins
Scooby Regular
 
IWatkins's Avatar
 
Join Date: Mar 2000
Location: Gloucestershire, home of the lawnmower.
Posts: 4,531
Likes: 0
Received 0 Likes on 0 Posts
Post

Another option (assuming I understand the problem):

Install a small service on each 'client'. This service will read the file every X mins and extract the relevant bits. It then POSTs the info. to a ISAPI DLL hosted on a central webserver. The ISAPI DLL collates all the responses and creats a web page of details from all the 'clients'. You can look at this web page, whenever, as often as you like.

You would need something like IIS (webserver) on a central machine, the ISAPI DLL and then the service you would install on every 'client'.

This would make it extensible in the future, but may be slightly overkill / difficult if you are not familiar with quickly setting up IIS. The service and the ISAPI DLL would be very easy, and of course would be written in Delphi

Cheers

Ian
Old 31 May 2002, 01:52 PM
  #18  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

Steve,

Yeah the UBB code can be annoying. Knew want you meant though.

Your suggestions looks ideal and sound like just what I'm after.

I'm away to have a play

Oh, I've got a TV feed to my desktop PC, so I'm watching the France-Senegal games as I type

Stefan
Old 31 May 2002, 01:55 PM
  #19  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Except that's completely backwards, since you want the client requesting rather than the machines sending the data, you can't get data-on-demand that way. There's no reason why the client reqesting the data can't serve it's results up via HTTP, and you avoid the utter exploitable mess that is IIS

Steve.
Old 31 May 2002, 01:57 PM
  #20  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

Thanks Ian.

I'll look into that too.

Stefan
Old 31 May 2002, 02:03 PM
  #21  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

I suggested ftp, incase you didnt really want to do any programming...

David
Old 31 May 2002, 02:22 PM
  #22  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Wink

So your not a IIS fan then Steve?
Old 31 May 2002, 02:25 PM
  #23  
ozzy
Scooby Regular
Thread Starter
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

That's OK David.

I'm using the manual way just now and really would like to automate the whole process. I had a search around for some utilities that could have done this, but couldn't find any.

Looks like doing some code is the only way to get it done. I quiet enjoyed it in the past, so I'm more than happy to tinker

Stefan
Old 31 May 2002, 02:41 PM
  #24  
IWatkins
Scooby Regular
 
IWatkins's Avatar
 
Join Date: Mar 2000
Location: Gloucestershire, home of the lawnmower.
Posts: 4,531
Likes: 0
Received 0 Likes on 0 Posts
Post

Steve,
Nowt wrong with IIS, as long as you don't rely on it

Ozzy,
Another possible solution, see http://www.scoobynet.co.uk/bbs/threa...=100362&Page=2

Basically, write a service to check the file every X minutes. Write the value out using OutputDebugString and monitor it centrally with DebugView.

Cheers

Ian
Old 31 May 2002, 03:01 PM
  #25  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Hehe, I don't know why anyone bothers with IIS if it's just a webserver they're after, you have to be mad if you deploy it. Perhaps there was a need for it in the past, but Apache 2.0 is a native port and far superior in every way. Unless you just use IIS as some component of a larger Microsoft installation of course, in which case you're forced to because you don't have any other choice

If you want to learn something buzzwordy look at SOAP, because this is exactly the kind of thing it's designed for and managers love buzzwords. I like solutions that are platform independent, scalable and maintainable, so you could chuck all this on any machine you have, as long as there's a Perl interpreter (available for almost every OS) and a TCP/IP stack you're sorted.

Steve.
Old 31 May 2002, 04:25 PM
  #26  
Molds
Scooby Regular
 
Molds's Avatar
 
Join Date: Apr 2002
Location: Warwickshire, UK
Posts: 1,185
Likes: 0
Received 0 Likes on 0 Posts
Post

Create an ODBC data source for the file you are interested in.
Write yourself an ASP web page that uses the data source, then pick out the bits you want to display .
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
slimwiltaz
General Technical
20
09 October 2015 07:40 PM
IanG1983
Wheels, Tyres & Brakes
2
06 October 2015 03:08 PM
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM
Nick_Cat
Computer & Technology Related
2
26 September 2015 08:00 AM



Quick Reply: A question for all the programmers out there



All times are GMT +1. The time now is 10:31 PM.