From 1d0ec0bed04ca853c78acb4dc125c452b7ff3ac2 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 21 Jul 2014 21:57:59 +0000 Subject: [PATCH] Add 'graph' option to netdisco-do --- Netdisco/Changes | 4 ++++ Netdisco/bin/netdisco-do | 10 ++++++++++ Netdisco/lib/App/Netdisco/Util/Graph.pm | 10 +++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index c1f71100..b84785d4 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,5 +1,9 @@ 2.028006 - 2014-07-21 + [ENHANCEMENTS] + + * Add 'graph' option to netdisco-do + [BUG FIXES] * DNS Mismatch report incorrectly trimmed domain_suffix diff --git a/Netdisco/bin/netdisco-do b/Netdisco/bin/netdisco-do index 85feea73..34a1a52d 100755 --- a/Netdisco/bin/netdisco-do +++ b/Netdisco/bin/netdisco-do @@ -81,6 +81,12 @@ if (!length $action) { with 'App::Netdisco::Daemon::Worker::Poller::Expiry'; with 'App::Netdisco::Daemon::Worker::Interactive::DeviceActions'; with 'App::Netdisco::Daemon::Worker::Interactive::PortActions'; + + use App::Netdisco::Util::Graph (); + sub graph { + App::Netdisco::Util::Graph::graph(); + return ('done', 'Generated graph data.'); + } } my $worker = MyWorker->new(); @@ -152,6 +158,10 @@ Run an arpnip on the device (specified with C<-d>). Run an nbtstat on the node (specified with C<-d>). +=head2 graph + +Generate GrapgViz graphs for the largest cluster of devices. + =head2 set_location Set the SNMP location field on the device (specified with C<-d>). Pass the diff --git a/Netdisco/lib/App/Netdisco/Util/Graph.pm b/Netdisco/lib/App/Netdisco/Util/Graph.pm index 90d5008c..ba5c2747 100644 --- a/Netdisco/lib/App/Netdisco/Util/Graph.pm +++ b/Netdisco/lib/App/Netdisco/Util/Graph.pm @@ -49,10 +49,14 @@ all subroutines. =head1 EXPORT +=over 4 + =item graph() Creates netmap of network. +=back + =cut sub graph { @@ -113,6 +117,8 @@ sub graph { =head1 EXPORT_OK +=over 4 + =item graph_each($graph_obj, $name) Generates subgraph. Does actual GraphViz calls. @@ -350,7 +356,7 @@ sub graph_addnode { return $rv; } -=head2 make_graph() +=item make_graph() Returns C object that represents the discovered network. @@ -360,6 +366,8 @@ vertex. Nodes without topology information are not included. +=back + =cut sub make_graph {