CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Remote monitoring using multi-threading

 



guruk
New User

Mar 15, 2010, 9:37 AM

Post #1 of 2 (1709 views)
Remote monitoring using multi-threading Can't Post

Hi All,

I am writing a tool which remotely monitors the network devices and sends an alarm if the device is unreachable similar to an NMS.

I would ping the device or do an snmpwalk to the device and if there's no response, generate a trap using snmptrap and send it to a trap receiver.

Can I using the perl Threads module invoke a simultaneous ping/snmpwalk request to 100 or more devices and based on the response perform the action?

Please suggest any good way of achieving it.

Thanks in Advance

Guru


7stud
Enthusiast

Mar 18, 2010, 2:04 AM

Post #2 of 2 (1688 views)
Re: [guruk] Remote monitoring using multi-threading [In reply to] Can't Post

Why would you need to simultaneously test all 100 devices? You are going to be pinging them more than once right? Why can't you just use a while loop and poll each ip address in succession?


If for some reason that won't work for you, a thread strategy might be to put all the ip addresses in a Thread::Queue, and then use threads::shared to share the queue between all the threads. Then start 10 or so threads that execute the same function. The function would grab an ip address from the queue, then do the test on the ip address and sound an alarm if necessary. The final step would be to add the ip address to the end of the queue. A Thread::Queue is thread safe, so you don't have to worry about locks or anything like that.


(This post was edited by 7stud on Mar 18, 2010, 5:05 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives