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

perl module help

by janasec (Sexton)
on Apr 26, 2015 at 17:40 UTC ( [id://1124767]=perlquestion: print w/replies, xml ) Need Help??

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

hi I am learning to write automation for running some tests,to begin with I have written the following code.I need to know how I can create a perl module so I can make calls to check if a host is alive

#!/usr/bin/perl use strict; use warnings; use lib '/home/suse/junk/automation1/emulex'; use Config::Simple; use Net::Ping::External qw(ping); use 5.010; #myconf.cfg is a file with all hosts my $cfg = new Config::Simple('/home/suse/junk/automation1/emulex/mycon +f.cfg'); #accessing values my $host = $cfg->param("host1"); print "checking $host is reachable or not\n"; my $alive = ping(hostname => "$host", count => 5, size => 1024, timeou +t => 3); print "$host is alive!\n" if $alive or die"Could not ping host '$host' + ";

Replies are listed 'Best First'.
Re: perl module help
by davies (Prior) on Apr 26, 2015 at 17:57 UTC
Re: perl module help
by Old_Gray_Bear (Bishop) on Apr 26, 2015 at 18:30 UTC
    Instead of rolling your own framework, you might take a look at nagios.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: perl module help
by karlgoethebier (Abbot) on Apr 26, 2015 at 19:05 UTC

    Addendum to the advice given by Old_Gray_Bear:

    Take a look at Icinga and Icinga.

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-29 07:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found