netdisco-sshcollector - Collect ARP data for Netdisco from devices without full SNMP support
Collects ARP data for Netdisco from devices without full SNMP support. Currently, ARP tables can be retrieved from the following device classes:
App::Netdisco::SSHCollector::Platform::ACE - Cisco ACE (Application Control Engine)
App::Netdisco::SSHCollector::Platform::BigIP - F5 Networks BigIP
App::Netdisco::SSHCollector::Platform::IOS - Cisco IOS
App::Netdisco::SSHCollector::Platform::IOSXR - Cisco IOS XR
App::Netdisco::SSHCollector::Platform::PaloAlto - PaloAlto devices
The collected arp entries are then directly stored in the netdisco database.
The following should go into your Netdisco 2 configuration file, "~/environments/deployment.yml"
~/environments/deployment.yml
sshcollector
Data is collected from the machines specified in this setting. The format is a list of dictionaries. The keys ip, user, password, and platform are required. Optionally the hostname key can be used instead of the ip. For example:
ip
user
password
platform
hostname
sshcollector: - ip: '192.0.2.1' user: oliver password: letmein platform: IOS - hostname: 'core-router.example.com' user: oliver password: letmein platform: IOS
Platform is the final part of the classname to be instantiated to query the host, e.g. platform ACE will be queried using App::Netdisco::SSHCollector::Platform::ACE.
App::Netdisco::SSHCollector::Platform::ACE
If the password is "-", public key authentication will be attempted.
Additional device classes can be easily integrated just by adding and additonal class to the App::Netdisco::SSHCollector::Platform namespace. This class must implement an arpnip($hostname, $ssh) method which returns an array of hashrefs in the format
App::Netdisco::SSHCollector::Platform
arpnip($hostname, $ssh)
@result = ({ ip => IPADDR, mac => MACADDR }, ...)
The parameter $ssh is an active Net::OpenSSH connection to the host. Depending on the target system, it can be queried using simple methods like
$ssh
Net::OpenSSH
my @data = $ssh->capture("show whatever")
or automated via Expect - this is mostly useful for non-Linux appliances which don't support command execution via ssh:
my ($pty, $pid) = $ssh->open2pty or die "unable to run remote command"; my $expect = Expect->init($pty); my $prompt = qr/#/; my ($pos, $error, $match, $before, $after) = $expect->expect(10, -re, $prompt); $expect->send("terminal length 0\n"); # etc...
The returned IP and MAC addresses should be in a format that the respective inetaddr and macaddr datatypes in PostgreSQL can handle.
Copyright (C) 2013 by the Netdisco Project All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Netdisco Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE NETDISCO DEVELOPER TEAM BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Initial Version for Netdisco 1.x Copyright (C) 2013 by Christian Ramseyer (ramseyer@netnea.com) I hereby grant full ownership of the code to the Netdisco Project
To install App::Netdisco, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Netdisco
CPAN shell
perl -MCPAN -e shell install App::Netdisco
For more information on module installation, please visit the detailed CPAN module installation guide.