[#119] netdisco-do expirenodes (ND1 expirenodes & expire-nodes-subnet)
This commit is contained in:
		| @@ -1,10 +1,11 @@ | ||||
| 2.032000_001 - 2015-03-07 | ||||
| 2.032001 - 2015-03-24 | ||||
|  | ||||
|   [NEW FEATURES] | ||||
|  | ||||
|   * macsuck_unsupported setting to allow node gathering on delinquent switches | ||||
|   * netdisco-do -d accepts IP prefixes (subnet in CIDR format) | ||||
|   * [#110] rules for IP Phone and Wireless AP identification now configurable | ||||
|   * [#119] netdisco-do expirenodes (ND1 expirenodes & expire-nodes-subnet) | ||||
|  | ||||
|   [ENHANCEMENTS] | ||||
|  | ||||
|   | ||||
| @@ -312,7 +312,8 @@ Run an arpnip for all known devices. | ||||
|  | ||||
| Delete a device (specified with C<-d>). Pass a log message for the action in | ||||
| the C<-e> parameter. Optionally request for associated nodes to be archived | ||||
| (rather than deleted) by setting the C<-p> parameter to "C<yes>". | ||||
| (rather than deleted) by setting the C<-p> parameter to "C<yes>" (mnemonic: | ||||
| U<p>reserve). | ||||
|  | ||||
|  ~netdisco/bin/netdisco-do delete -d 192.0.2.1 | ||||
|  ~netdisco/bin/netdisco-do delete -d 192.0.2.1 -e 'older than the sun' | ||||
| @@ -343,6 +344,15 @@ Run an nbtstat for all known nodes. | ||||
|  | ||||
| Run Device and Node expiry actions according to configuration. | ||||
|  | ||||
| =head2 expirenodes | ||||
|  | ||||
| Archive nodes on the specified device. If you want to delete nodes, set the | ||||
| C<-e> parameter to "C<no>" (mnemonic: U<e>xpire). If you want to perform the | ||||
| action on a specific port, set the C<-p> parameter. | ||||
|  | ||||
|  ~netdisco/bin/netdisco-do expirenodes -d 192.0.2.1 | ||||
|  ~netdisco/bin/netdisco-do expirenodes -d 192.0.2.1 -p FastEthernet0/1 -e no | ||||
|  | ||||
| =head2 graph | ||||
|  | ||||
| Generate GrapgViz graphs for the largest cluster of devices. | ||||
|   | ||||
| @@ -52,4 +52,22 @@ sub expire { | ||||
|   return job_done("Checked expiry for all Devices and Nodes"); | ||||
| } | ||||
|  | ||||
| # expire nodes for a specific device | ||||
| sub expirenodes { | ||||
|   my ($self, $job) = @_; | ||||
|  | ||||
|   return job_error('Missing device') unless $job->device; | ||||
|  | ||||
|   schema('netdisco')->txn_do(sub { | ||||
|     schema('netdisco')->resultset('Node')->search({ | ||||
|       switch => $job->device->ip, | ||||
|       ($job->port ? (port => $job->port) : ()), | ||||
|     })->delete( | ||||
|       ($job->extra ? () : ({ archive_nodes => 1 })) | ||||
|     ); | ||||
|   }); | ||||
|  | ||||
|   return job_done("Expired nodes for ". $job->device->ip); | ||||
| } | ||||
|  | ||||
| 1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user