Here a pinging scanner for ZM ip cameras.
Posted: Wed Dec 30, 2009 9:32 pm
I hope it helps.
regards.[/code]
Code: Select all
#!/usr/bin/perl -wT
use Net::Ping;
use strict;
use DBI;
my $db="zm"; ## NOMBRE BASE DE DATOS
my $tabla="Monitors"; ## NOMBRE DE TABLA
my $usuario="zmuser"; ## USUARIO
my $password="zmpass"; ## CONTRASENA
my $dbh=DBI->connect("dbi:mysql:$db",$usuario,$password);
my $sth = $dbh->prepare(qq{
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX( `Host` , '.', 4 ),"@",-1) AS Host FROM $tabla where Enabled = "1"
});
$sth->execute();
while (my ($Host) = $sth->fetchrow_array() ){
my $p = Net::Ping->new();
if ($p->ping($Host)) {
print $Host." reachable\n";
}
else {
print $Host." unreachable\n";
}
$p->close();
}
$sth->finish();
$dbh->disconnect();