refactor nbtstat to group probes by device

This commit is contained in:
Oliver Gorwits
2014-03-25 21:04:27 +00:00
parent ac97d92ef1
commit 563f6d3a86
8 changed files with 70 additions and 73 deletions

View File

@@ -5,7 +5,6 @@ use Dancer::Plugin::DBIC 'schema';
use App::Netdisco::Util::Node 'check_mac';
use NetAddr::IP::Lite ':lower';
use Time::HiRes 'gettimeofday';
use Net::NBName;
use base 'Exporter';
@@ -36,8 +35,7 @@ Returns whether a node is answering netbios calls or not.
=cut
sub do_nbtstat {
my $host = shift;
my ($host, $now) = @_;
my $ip = NetAddr::IP::Lite->new($host) or return;
unless ( $ip->version() == 4 ) {
@@ -46,7 +44,6 @@ sub do_nbtstat {
}
my $nb = Net::NBName->new;
my $ns = $nb->node_status( $ip->addr );
# Check for NetBIOS Info
@@ -55,7 +52,7 @@ sub do_nbtstat {
my $nbname = _filter_nbname( $ip->addr, $ns );
if ($nbname) {
store_nbt($nbname);
store_nbt($nbname, $now);
}
return 1;