App-Netsync

 view release on metacpan or  search on metacpan

script/netsync  view on Meta::CPAN

#!perl

=head1 NAME

netsync - network/database synchronization utility

=head1 DESCRIPTION

This tool can discover a network and synchronize it with a database.

=head1 SYNOPSIS

 -h --help   Help. Print usage and options.
 -V          Version. Print build information.
 -v          Verbose. Print everything.
 -q          Quiet. Print nothing.
 -c .ini     Config. Specify a configuration file.
 -p #        Probe. There are 2 Probe levels:
               1: Probe the network for active nodes.
               2: Probe the database for those nodes.
 -D          DNS. Use your the Domain Name System to retrieve relevant nodes.
 -m pattern  Match. Only process nodes with hostnames matching the pattern.
 -d .csv     Database. Specify an RFC4180-compliant database file.
 -a          Automatch. Enable interface auto-matching.
 -u          Update. Send interface-specific information to network nodes.
 nodes       Nodes. Nodes. Specify an RFC1035-compliant list of relevant nodes.

=head1 EXAMPLES

 $ netsync -Dm "host[0-9]+" -au

Z<>

 $ netsync -Dm "host[0-9]+" -p1
 > configuring (using /etc/netsync/netsync.ini)... done
 > discovering (using DNS)...  778 nodes (47 skipped), 796 devices (12 stacks)

 $ netsync -ap2 /var/cache/netsync/active.txt
 > configuring (using /etc/netsync/netsync.ini)... done
 > discovering (using /var/cache/netsync/active.txt)...  778 nodes, 796 devices (12 stacks)
 > identifying (using DBMS)...  664 synchronized (2389 conflicts)

 $ netsync -d /var/cache/netsync/synced.csv -a /var/cache/netsync/active.txt
 configuring (using /etc/netsync/netsync.ini)... done
 discovering (using /var/cache/netsync/active.txt)...  778 nodes, 796 devices (12 stacks)
 identifying (using /var/cache/netsync/synced.csv)...  796 synchronized

=cut


use autodie; #XXX Is autodie adequate?
#use diagnostics;
use strict;
use warnings;
use feature 'say';

use File::Basename;
use Getopt::Std;
use Pod::Usage;
use version;

use App::Netsync;
use App::Netsync::Configurator;
use App::Netsync::Scribe ('note');

our ($SCRIPT,$VERSION);
our %config;


BEGIN {
    ($SCRIPT)  = ($0);
    ($VERSION) = version->declare('v4.0.0');

    $Getopt::Std::STANDARD_HELP_VERSION = 1;
    $| = 1;

    $config{'Options'}   = 'c:p:Dm:d:au';
    $config{'Arguments'} = '[nodes]';
}


sub VERSION_MESSAGE {
    say 'Perl v'.$];
    say $SCRIPT.' '.$VERSION;

    say 'App::Netsync               '.$App::Netsync::VERSION;
    say 'App::Netsync::Configurator '.$App::Netsync::Configurator::VERSION;
    say 'App::Netsync::Network      '.$App::Netsync::Network::VERSION;
    say 'App::Netsync::Scribe       '.$App::Netsync::Scribe::VERSION;
    say 'App::Netsync::SNMP         '.$App::Netsync::SNMP::VERSION;
    say '[Core Modules]';
    say '   File::Basename v'.$File::Basename::VERSION;
    say ' Getopt::Std      v'.$Getopt::Std::VERSION;
    say '    Pod::Usage    v'.$Pod::Usage::VERSION;
    say '  POSIX           v'.$POSIX::VERSION;
    say ' Scalar::Util     v'.$Scalar::Util::VERSION;
    say '[CPAN Modules]';
    say ' Config::Simple v'.$Config::Simple::VERSION;
    say '    DBI         v'.$DBI::VERSION;
    say '    Net::DNS    v'.$Net::DNS::VERSION;
    say '   SNMP         v'.$SNMP::VERSION;
    say '   SNMP::Info   v'.$SNMP::Info::VERSION;
    say '   Text::CSV    v'.$Text::CSV::VERSION;
}




( run in 0.890 second using v1.01-cache-2.11-cpan-39bf76dae61 )