Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Using Linux - To Gather info about NT Service

by gbrown@gdbrown.net (Acolyte)
on Oct 02, 2002 at 17:27 UTC ( [id://202332]=perlquestion: print w/replies, xml ) Need Help??

gbrown@gdbrown.net has asked for the wisdom of the Perl Monks concerning the following question:

Is there a perl module for monitoring / checking on the status of an NT service from a linux box? I am currently writing code in perl under Linux. I would like my linux box to check on the status of a NT service running on a NT box on the network. Any ideas? Thanks Jerry
  • Comment on Using Linux - To Gather info about NT Service

Replies are listed 'Best First'.
Re: Using Linux - To Gather info about NT Service
by jaldhar (Vicar) on Oct 02, 2002 at 18:54 UTC

    SNMP is the standard, open, cross platform way of doing such things. You can use the Net::SNMP module for this. For a specifically Windows oriented method, try Win32::Service.

    --
    જલધર

Re: Using Linux - To Gather info about NT Service
by Len (Friar) on Oct 02, 2002 at 19:21 UTC
    You have to write a service that is running on your windows box that can be queried by the linux server to get the service status information.

    There is a module Win32::PerfLib that can be used to access the Windows Performance Counter.

    I can suggest you to take a look at Netsaint.
    At our company we use this tool to monitor all the hosts and services in our network.

    Nsclient is an addon for Netsaint to get vital information from Windows NT/2000/XP servers (CPU load, memory usage, disk usage, service states, processes, and performance data). It includes a service which runs on the NT server and a plugin which is called from the monitoring box.

Re: Using Linux - To Gather info about NT Service
by AcidHawk (Vicar) on Oct 03, 2002 at 05:25 UTC

    This kinda depends on what you mean by status.

    I am involved in Enterprise management where we need to monitor all sorts of servers Unix/Linux/NT, Databases and applications etc. Typically we have a piece of sofware (or agent if you will) that will send SNMP traps to our "manager" server. This would involve writing a piece of code to evaluate whatever metrics you want to monitor and possibly set thresholds against. If these thresholds are exceeded you can send a trap with the relevant info. On the other hand you may need to poll the device to check on specific info. This could be in the form of a ping or an SNMP get.

    So if in status you mean "is it up/available on the network" it is a simple thing, use Net::Ping. However If you need more info about the OS or a process/application, things get a little more tricky, but nothing that can't be tackled without a little effort. :)

    Update: I found this link which you may find interesting A Networked Machine Management System

    -----
    Of all the things I've lost in my life, its my mind I miss the most.
Re: Using Linux - To Gather info about NT Service
by zakzebrowski (Curate) on Oct 03, 2002 at 10:55 UTC
    This may be off topic to your request, but depending on what you are doing, you may wish to keep an eye on the hosts project. While currently it is intended for use solely in the unix environment, it is a security test sweet that runs n tests against a computer in perl. From the presentation that I saw, it looks like they were investigating winnt, 2000 compatability. Thus, depending on your purposes, you may be able to borrow code or directly use that code in your project. However, I am unable to wager when it would or could be available...

    ----
    Zak
    "There is no room in this country for hyphenated Americanism" ~ Theodore Roosevelt (1915)
Re: Using Linux - To Gather info about NT Service
by enigmae (Pilgrim) on Oct 03, 2002 at 06:40 UTC
    In my win32 process/service programming experience from Unix, i have noticed some issues you might wanna know about. If you are trying to find services/processes on a windows terminal server there are some problems i have had to jerry-rig a script for. Monitoring processes using the win32::process type access methods only works on non-terminal_servers, for terminal servers it only returns 1 account either local system, or admin, or some other account. To get access to all the processes i had to write a c++ console program accessing the terminal services API to list processes and the appropriate users of those processes, if anyone is interested in this program/source for windows terminal server monitoring let me know. The differences in linux and windows is amazing reguarding administration of processes, services, etc... I hope windows becomes more like linux to ease these issues. Hope this wasn't too off-topic. -enigmae

      Did you try Win32::Lanman for querying the status of the services? The module contains functions for managing terminal servers so I'd think the service related functions would work OK as well.

      I do not have a terminal server (or better put ... anything being used as a terminal server) by hand, but I'd be very surprised if it did not work.

      Jenda

Re: Using Linux - To Gather info about NT Service
by elwarren (Priest) on Oct 03, 2002 at 15:55 UTC
    Take a look at dada's perl lab. He has done alot of work with Perl and Win32. On his site he has a script that lets you remotely control win32 services with a cgi interface. Maybe it's what you need or maybe it's just a good example of how to control services with perl.

    HTH

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2024-04-19 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found