NAME

App::Netsync::SNMP - SNMP framework

DESCRIPTION

This package contains functions for handling SNMP communications.

SYNOPSIS

use App::Netsync::SNMP;

App::Netsync::SNMP::configure({
    'SecName'   => 'your username here',
    'SecLevel'  => 'AuthPriv',
    'AuthProto' => 'SHA',
    'AuthPass'  => 'your password here',
    'PrivProto' => 'AES',
    'PrivPass'  => 'your key here',
},[
    'IF-MIB','ENTITY-MIB',  # standard
    'CISCO-STACK-MIB',      # Cisco
    'FOUNDRY-SN-AGENT-MIB', # Brocade
    'SEMI-MIB',             # HP
]);

my $ip      = '93.184.216.119';
my $session = App::Netsync::SNMP::Session $ip;

my $info1   = App::Netsync::SNMP::Info $ip;
my $info2   = App::Netsync::SNMP::Info $session;

my ($ifNames,$ifIIDs) = App::Netsync::SNMP::get1 ([
    ['.1.3.6.1.2.1.31.1.1.1.1' => 'ifName'],
    ['.1.3.6.1.2.1.2.2.1.2'    => 'ifDescr'],
],$session);

App::Netsync::SNMP::set ('ifAlias',$_,'Vote for Pedro',$session) foreach @$ifIIDs;

METHODS

configure

configure the operating environment

Arguments

( \%environment , \@MIBs )

environment

key-value pairs of environment configurations

Available Environment Settings

MIBdir

the location of necessary MIBs

default: /usr/share/<script name>/mib

See SNMP::Session documentation for more acceptable settings.

MIBs

a list of MIBs to load

Session

returns an SNMP::Session object.

Note: configure needs to be run first!

Arguments

( $ip )

ip

an IP address to connect to

Info

returns an SNMP::Info object

Note: configure needs to be run first!

Arguments

( $ip )

ip

an IP address to connect to OR an SNMP::Session

Note: The following snippets are equivalent:

App::Netsync::SNMP::Info $ip;
App::Netsync::SNMP::Info App::Netsync::SNMP::Session $ip;

get1

attempt to retrieve an OID from a provided list, stopping on success

Arguments

( \@OIDs , $ip )

OIDs

a prioritized list of OIDs to try and retreive

ip

an IP address to connect to or an SNMP::Session

set

attempt to set a new value on a device using SNMP

Arguments

( $OID , $IID , $value , $ip )

OID

the OID to write the value argument to

IID

the IID to write the value argument to

value

the value to write to OID.IID

ip

an IP address to connect to OR an SNMP::Session

AUTHOR

David Tucker, <dmtucker at ucsc.edu>

BUGS

Please report any bugs or feature requests to bug-netsync at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-Netsync. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc App::Netsync

You can also look for information at:

LICENSE

Copyright 2013 David Tucker.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.