You're visiting this page from <% $r->connection->client_ip %>. % if (!defined($arp)) { I can't find that IP address in my database. Possible reasons:
I found MAC address <% $arp->{mac} %> in use since <% $arp->{time_first} %>.
<%perl> #XXX copied from public_map.html $ports = sql_rows('node', ['mac','switch','port','active','oui','extract(epoch from time_first) as time_first', 'extract(epoch from time_last) as time_last'], {mac => $arp->{mac}}, undef, 'order by time_first desc limit 10' ); # for efficiency: build up a set of 'ip', and use a single sql_rows() # to get all of them. my %ipuniq = (); foreach my $port (@$ports) { $ipuniq{$port->{switch}} = 1; } #XXX could really use a variant of sql_column that returns hash refs for # multiple returns my $nameret = sql_rows('device', ['ip','dns','name','location'], {'ip' => [[keys %ipuniq]]}); my %namemap = (); foreach my $ret (@$nameret) { $namemap{$ret->{ip}}->{switchname}=$ret->{name} || $ret->{dns}; $namemap{$ret->{ip}}->{switchloc} = $ret->{location}; } foreach my $port (@$ports) { $port->{switchname} = $namemap{$port->{switch}}->{switchname} || ''; $port->{switchloc} = $namemap{$port->{switch}}->{switchloc} || ''; $port->{first} = scalar(localtime($port->{time_first})); $port->{last} = scalar(localtime($port->{time_last})); } # XXX We don't care about the locations here, we leave that to the # png generator. We just care which maps to display. my $mapret = sql_rows('device_port_location', ['image'], { 'ip' => [[keys %ipuniq]]}); my %maplist = (); foreach my $entry (@$mapret) { $maplist{$entry->{image}} = 1; } %perl> % if (@$ports) { This MAC address was seen on the following ports: