Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Network Programming between Linux/NT

by Tuna (Friar)
on Jul 08, 2001 at 01:20 UTC ( [id://94770]=perlquestion: print w/replies, xml ) Need Help??

Tuna has asked for the wisdom of the Perl Monks concerning the following question:

I am running a network monitoring server on Linux, and am writing several programs to monitor events/conditions on servers in our NT domains. These programs will include reading file contents, file attributes, such as size, as well as making system calls. What would be the best way to access a server on an NT network from a Linux box? I could mount the shares using SAMBA to get simple file access, but I need to make system calls, and I don't that will work with SAMBA. SNMP would take care of some of the info I will monitor, but not all.

Replies are listed 'Best First'.
Re: Network Programming between Linux/NT
by andreychek (Parson) on Jul 08, 2001 at 02:44 UTC
    Doing remote system calls via SAMBA would be a bit tricky, I think you're correct in that SAMBA isn't really designed for that sort of thing.

    You aren't the first to run across this issue though. There are a few other cross platform applications that do similar things to what you are attempting to accomplish. One in particular that I have in mind is called Big Brother. It can monitor various operating systems, including Linux and NT, from one central location. What they do is install a daemon (or service in the NT world) on each of the computers that need to be monitored. These daemons handle the the calls that can't be determined remotely.. ie, current disk usage, cpu usage, bandwidth utilization, etc.

    They seem to have designed it well, in that it is reasonably simple to create a plug-in for it. If you don't want to spend the time creating this system yourself, you could always consider using Big Brother, and creating a plug-in for the functionality you wish to have. If it doesn't do what you want, you could always use it's system as an example.

    They developed their own protocol (I believe) for the system to communicate with all the remote daemons it was monitoring. If you don't end up just creating a Big Brother plug-in, another method for creating such a beast would be to use SOAP or RPC, if you're boxes will have a web server running on them.

    If you don't have a webserver, or you want to communicate via another network protocol, there is an excellent book on the subject called Network Programming with Perl by Lincoln Stein. Good luck!
    -Eric
Re: Network Programming between Linux/NT
by jepri (Parson) on Jul 08, 2001 at 03:57 UTC
    You are looking for a class of functions called RPCs (Remote Procedure Calls). You call a function on one machine and it is executed on another machine. There are different implementations. I've been wowed by SOAP, CORBA:: is well known, and there are other ones likes like XML-RPC and Suns RPC to investigate as well.

    All these code libraries make RPCs easier than the alternative, which is to write your own TCP/IP server daemon and client.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

Re: Network Programming between Linux/NT
by joefission (Monk) on Jul 08, 2001 at 09:07 UTC
    The problem, if I'm reading this correctly, is that you can't make system calls on NT from Linux.
    Services can be added to NT to make it accessible from Linux, to varying degrees, such as SAMBA, SNMP, and WBEM.
    andreychek has an excellent suggestion for other services. What they all have in common is providing a proxy to the Linux machine to manage an NT machine.

    The most flexible (and probably has the greatest potential of danger) seems to be web-based management. Have an NT machine serve cgi scripts to manage other NT systems. No one can write enough here to talk about all of the security issues in implementing. No one knows enough and besides, who would want to read it here anyway?

    In the spirit of TMTOWTDI, use CGI.pm to create your web-based administration on an NT machine, use Win32::AdminMisc, and the slew of modules available to provide remote administration of win32 machines. This will allow you to perform enterprise-level monitoring.

    If you are only concerned with access to individual boxes, rsh (as John M. Dlugosz stated earlier), telnet, ssh, and vnc can be used to bridge NT and Linux.

      What you are suggesting may be a good idea, but the questioner specifically said that he wanted to administer NT boxes from a Linux box. Maybe he doesn't wish to run a webserver on one of his NT boxes. Maybe he doesn't want to shell out for an extra NT license for the administrator box.
        Everyone agrees that you cannot administer an NT machine with Linux "out of the box", yes? You have to add some glue code. That glue code is going to receive requests over the network, whether it is BigBrother, Monitor, SNMP, or god forbid a webserver. I don't see why an existing NT server or workstation cannot be used for this. Although you can justify buying more licenses, there is no reason for it.

        The webserver option I proposed may not be acceptable in this environment, but it meets the requirement given: the ability to execute system calls against/on NT from Linux.

Re: Network Programming between Linux/NT
by John M. Dlugosz (Monsignor) on Jul 08, 2001 at 01:23 UTC
    Perhaps you could run a script on the remote machine to gather Performance Metrics using the native interfaces, and then pipe that to your local box. Rsh, perhaps, or a NT Service.
Re: Network Programming between Linux/NT
by cleen (Pilgrim) on Jul 09, 2001 at 01:08 UTC
    If I am correct there is an implintation of openssh for win32 variants. Use remote calls using ssh -l user 'command to execute'

    also newer nt variants including win2k include a simple telnetd which can be switched on manually in your services.
Re: Network Programming between Linux/NT
by nietzel (Novice) on Jul 09, 2001 at 01:12 UTC
    Probably the most traditional way of performing these tasks is to have a service run on NT that gathers your stats and updates SNMP with the data.

    Your Linux box would then communicate to the SNMP service and retrieve the information.

    Most commercial products like HP OpenView, Tivoli, CA Network IT (use to be TNG) are all applications that retrieve data via SNMP and MIB's and store that data in their own database.

    However there is a new player that has some new nice ideas that none of the above mentioned commercial products have done. All of the applications above monitor a system i.e. processor usage, memory usage, disk I/O's, etc... but this company developed a utility that monitors services or applications and reports there status as well as system stats. The company and product are called "Net IQ". This product truly does add new ideas to monitoring software.

    When developing a monitoring stats app I think it is all the same if you use SNMP, MIB's, or just plane-jane files as long as all the info gets to the same place! Just remember its what your monitoring that counts and it is that which you should be concentrating on.

    Earle

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://94770]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-05-29 05:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found