Merge branch 'master' into og-autoload
This commit is contained in:
		| @@ -81,6 +81,19 @@ 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 Module::Load (); | ||||
|   eval { Module::Load::load 'App::Netdisco::Util::Graph' }; | ||||
|   sub graph { | ||||
|     App::Netdisco::Util::Graph::graph(); | ||||
|     return ('done', 'Generated graph data.'); | ||||
|   } | ||||
|  | ||||
|   use App::Netdisco::Util::NodeMonitor (); | ||||
|   sub monitor { | ||||
|     App::Netdisco::Util::NodeMonitor::monitor(); | ||||
|     return ('done', 'Generated monitor data.'); | ||||
|   } | ||||
| } | ||||
| my $worker = MyWorker->new(); | ||||
|  | ||||
| @@ -152,6 +165,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 | ||||
|   | ||||
| @@ -43,15 +43,22 @@ use Dancer::Plugin::DBIC 'schema'; | ||||
| use App::Netdisco::Util::Permission ':all'; | ||||
|  | ||||
| my $settings = setting( 'rancid' ); | ||||
| my $domain_suffix = setting( 'domain_suffix' ) || ''; | ||||
| my $delimiter = $settings->{ 'delimiter' } || ':'; | ||||
| my $down_age = $settings->{ 'down_age' } || '1 day'; | ||||
| my $rancidhome = $settings->{ 'rancid_home' } || '/var/lib/rancid'; | ||||
| my $config_vendormap = $settings->{ 'vendormap' } || {}; | ||||
|  | ||||
| my $by_ip = {}; | ||||
| foreach my $g (@{$settings->{ 'by_ip' }}) { | ||||
|   $by_ip->{$g} = 1; | ||||
| } | ||||
|  | ||||
| my $by_hostname = {}; | ||||
| foreach my $g (@{$settings->{ 'by_hostname' }}) { | ||||
|   $by_hostname->{$g} = 1; | ||||
| } | ||||
|  | ||||
| my @devices = schema('netdisco')->resultset('Device')->search({}, | ||||
|   { | ||||
|     '+columns' => { | ||||
| @@ -92,13 +99,16 @@ foreach my $group (keys %$list) { | ||||
|       $vendor = $VENDORMAP{$vendormodel} || $VENDORMAP{$vendor}; | ||||
|     } | ||||
|     if ( $config_vendormap->{$vendor} or $config_vendormap->{$vendormodel} ) { | ||||
|       $vendor = $config_vendormap{$vendormodel} || $config_vendormap{$vendor}; | ||||
|       $vendor = $config_vendormap->{$vendormodel} || $config_vendormap->{$vendor}; | ||||
|     } | ||||
|     if ($by_ip->{$group}) { | ||||
|       $name = $dev->ip; | ||||
|     } else { | ||||
|       $name = ($dev->dns || $dev->name); | ||||
|     } | ||||
|     if ($by_hostname->{$group}) { | ||||
|       $name =~ s/$domain_suffix$//; | ||||
|     } | ||||
|     printf ROUTER "%s$delimiter%s$delimiter%s\n", $name, $vendor, | ||||
|       $dev->get_column( 'old' ) ? "down" : "up"; | ||||
|   } | ||||
| @@ -119,6 +129,7 @@ This script requires some configuration to be added to your Netdisco | ||||
|    down_age:     '1 day' | ||||
|    delimiter:    ':' | ||||
|    by_ip:        [ other ] | ||||
|    by_hostname:  [ other2 ] | ||||
|    groups: | ||||
|      switch:     [ 'name:.*[Ss][Ww].*' ] | ||||
|      rtr:        [ 'name:[rR]tr.*' ] | ||||
| @@ -172,6 +183,12 @@ Netdisco's "C<*_only>" settings, and accepts IP, prefix, device property. | ||||
| List of RANCID Groups which will have Device IPs written to the RANCID | ||||
| configuration file, instead of DNS or SNMP host names. | ||||
|  | ||||
| =head2 C<by_hostname> | ||||
|  | ||||
| List of RANCID Groups which will have Device Hostname written to the RANCID | ||||
| configuration file, instead of FQDN. This is done simply by stripping the | ||||
| C<domain_suffix> configuration item from the FQDN. | ||||
|  | ||||
| =head1 SEE ALSO | ||||
|  | ||||
| =over 4 | ||||
|   | ||||
| @@ -31,6 +31,7 @@ my $home = ($ENV{NETDISCO_HOME} || $ENV{HOME}); | ||||
| set(session_dir => dir($home, 'netdisco-web-sessions')->stringify); | ||||
|  | ||||
| set plack_middlewares => [ | ||||
|   ['Plack::Middleware::ReverseProxy'], | ||||
|   [ Expires => ( | ||||
|       content_type => [qr{^application/javascript}, qr{^text/css}, qr{image}, qr{font}], | ||||
|       expires => 'access plus 1 day', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user