Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Solution to broken Net::Ping

by solignis (Initiate)
on Dec 16, 2011 at 09:16 UTC ( [id://943917]=note: print w/replies, xml ) Need Help??


in reply to Re: Solution to broken Net::Ping
in thread Solution to broken Net::Ping

I am aware that certain hosts are not always pingable.

After a little RTFM it works now (what a surprise).

Based on the above it looks like I need to create 2 ping tests (1 for icmp, 1 for tcp port test). Would it be cleaner to create the first object then undef it and recreate the object with the new options? or just create 2 different objects and destroy them after their very short lifespan?

Thank you for your help

Replies are listed 'Best First'.
Re^3: Solution to broken Net::Ping
by Anonymous Monk on Dec 16, 2011 at 09:29 UTC

    Since I don't see an official way to change protocol choice after the fact, I recommend limiting scope with functions, however many you need , maybe

    sub MahPing { my ( $host ) = @_; for my $proto ( qw/ tcp icmp syn / ){ return !!1 if Net::Ping->new( $proto, 5 ) ->ping( $host ); } return !!0; }
Re^3: Solution to broken Net::Ping
by thargas (Deacon) on Dec 16, 2011 at 14:33 UTC

    If you're concerned about performance, Benchmark it, not against some production host. What works for me under my current environment, may not be the best way for you under your constraints. A general solution to monitoring availability of hosts is non-trivial. And make sure you're not optimizing prematurely.

    The last time I was mucking about with ping, it was on a large scale internal network and I ended up using SNMP gets instead. If you usage needs to be efficient, you might want to look at Net::SNMP as well.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-19 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found