[#159] Macsuck archive behaviour same as ND1 (unseen nodes remain active)

This commit is contained in:
Oliver Gorwits
2014-11-14 23:55:25 +00:00
parent a308d1a177
commit 1f7fe169ec
4 changed files with 26 additions and 4 deletions

View File

@@ -112,10 +112,15 @@ sub do_macsuck {
$ip, $total_nodes;
# a use for $now ... need to archive dissapeared nodes
my $archived = schema('netdisco')->resultset('Node')->search({
switch => $ip,
time_last => { '<' => \$now },
})->update({ active => \'false' });
my $archived = 0;
if (setting('node_freshness')) {
$archived = schema('netdisco')->resultset('Node')->search({
switch => $ip,
time_last => \[ "< ($now - ?::interval)",
setting('node_freshness') .' minutes' ],
})->update({ active => \'false' });
}
debug sprintf ' [%s] macsuck - removed %d fwd table entries to archive',
$ip, $archived;

View File

@@ -741,6 +741,21 @@ Value: Number. Default: 1.
Seconds nbtstat will wait for a response before time out. Accepts fractional
seconds as well as integers.
=head3 C<node_freshness>
Value: Number of Minutes. Default: 0
Controls the behaviour of Netdisco when a node (workstation, printer, etc) has
disappeared from the network (device MAC address tables).
If set to 0, the default, nodes will remain on the last-seen switch port until
"C<expire_nodes>" days have passed (when they'll be deleted if you run the
Expire job). This is the same behaviour as Netdisco 1.
Set to a number of minutes to enforce some kind of ageing on this data. For
example you could set to 60 to match the default macsuck schedule, meaning
nodes are archived if they're not in the device tables at the time of polling.
=head3 C<expire_devices>
Value: Number of Days. Default: 60