[SP-pm] Net::Ping::External Win/Unix

Esdras Neto esdras at gmail.com
Thu Mar 11 01:35:34 PST 2010


Críticas sempre são bem vindas :-)

O que acontece é que com esse plugin no Linux as vezes funciona, outras não.
E no windows após a execução do mesmo se o "Enter" não for pressionado ele
não vai adiante. Ele para depois que dou o primeiro Ping.

Vou começar a escrever usando outro plugin cros-plataform para ping, creio
que o Net::Ping seja mais estável.

O que acham?

2010/3/11 Otávio Fernandes <otaviof em gmail.com>

> 2010/3/10 Esdras Neto <esdras em gmail.com>:
> > Boa noite,
> >
> > To com umas dúvidas e o google não quer me ajudar :/
> >
> > Estou usando o modulo Net::Ping::External pois preciso fazer um script
> que
> > monitore a conexão com a internet que funcione tanto no Windows quanto no
> > Linux.
> >
> > O projeto é simples, monitorar um host externo se esse host parar de
> > responder testar com outros hosts e caso fique sem resposta muda a rota e
> > manda um email pros admin.
> >
> > Mas o net::ping::external parece nem sempre funcionar no Linux e no
> windows
> > ele pede interação. Alguem da uma luz? Segue o script. vlwz!
> >
> > while (<>) {
> >     $alive = ping(host => $HOST1, timeout => 4);
> >     print "$HOST1 is alive\n" if $alive;
> >
> >   if (!$alive) {
> >
> >    my $num_alive = 0;
> >    foreach (@hosts) {
> >      $alive = ping(hostname => $_, timeout => 3);
> >      print "$_ is alive!\n" if $alive;
> >      $num_alive++ if $alive;
> >
> >    }
> >
> >    print "$num_alive hosts are alive.\n";
> >    if ($num_alive == '0') {
> >
> >       my %mail = (
> >           To=>"$mail_destination",
> >           From=>"$from",
> >           Subject=>"Network Outage",
> >           Message=>"This is an automatic alert. The link is down.",
> >           smtp=>"$smtp_server",
> >           auth=>{user=>$from, pass=>$password, method=>'PLAIN'}
> >           );
> >
> >    sendmail(%mail) or die $Mail::Sendmail::error;
> >    }
> >
> >   }
> > sleep $TBP;
> > }
> >
> >
> >
> >
> > --
> > http://www.alvespassos.com
> > Sharing things that we cannot buy.
> > Mobile +353 (0)83 4005868
> >
> > _______________________________________________
> > SaoPaulo-pm mailing list
> > SaoPaulo-pm em pm.org
> > http://mail.pm.org/mailman/listinfo/saopaulo-pm
>
> Esdras,
>
> Você precisa ser mais específico sobre os problemas, com o que foi
> descrito fica difícil ir além de críticas ao seu código.
>
> Atenciosamente,
>
> --
> Otávio Fernandes <otaviof at gmail.com>
> http://blog.emresumo.com
> _______________________________________________
> SaoPaulo-pm mailing list
> SaoPaulo-pm em pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>



-- 
http://www.alvespassos.com
Sharing things that we cannot buy.
Mobile +353 (0)83 4005868
-------------- Pr?xima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20100311/9b9aeba9/attachment.html>


More information about the SaoPaulo-pm mailing list