Subversion Repositories sysadmin_scripts

Rev

Rev 66 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#! /usr/bin/env perl

# just a simple script for people more familiar with
# perl syntax than YAML. Modify %config below, then run
# this script. It will create the configuration file for
# you.
use strict;
use warnings;

use YAML::Tiny; # apt-get libyaml-tiny-perl under debian
use File::Spec; # find location of script so we can put storage in same directory
use File::Basename;


my %config = (
      # one or more switches and their corresponding
      # community name. Use v1 snmp only
      'switches' => {
         'DNS or IP' => {
            'community' => 'snmp community name',
            'portsToIgnore' => [port,numbers,to,ignore]
         },
         'DNS or IP' => {
            'community' => 'snmp community name',
            'portsToIgnore' => [port,numbers,to,ignore]
         }
      },
      # You must include at least one router.
      # this will be queried to resolve IP's to MAC 
      # using its arp table
      # put IP and community name into the hash
      'routers' =>  {
            'DNS or IP' => {
               'community' => 'snmp community name',
            },
            'DNS or IP' => {
               'community' => 'snmp community name',
            }
      }
   );

my $scriptDir = dirname( File::Spec->rel2abs( __FILE__ ) );
my $CONFIGFILE = $scriptDir . '/mapSwitches.config.yaml';

my $yaml = YAML::Tiny->new( \%config );
$yaml->write( $CONFIGFILE );