NAME

POE::Component::SNMP - event-driven SNMP interface

SYNOPSIS

use POE::Component::SNMP;

POE::Component::SNMP->create(
    hostname  => 'my.host.org',
    community => 'public',
);

$kernel->post( snmp => 'get',     'snmp_callback', -varbindlist => [$oid] );
$kernel->post( snmp => 'getnext', 'snmp_callback', -varbindlist => [$oid] );
$kernel->post( snmp => 'walk',    'snmp_callback', -baseoid => $base_oid );
$kernel->post( snmp => 'getbulk', 'snmp_callback', %snmp_args );

sub snmp_callback {
    my ($results, $error) = @{$_[ARG1]};

    if ($error) {
        warn "error: $error\n";
    }
    else {
        print "sysUptime: " . $results->{$system{sysUptime}} . "\n";
        print "sysLocation: " . $results->{$system{sysLocation}} . "\n";
    }
}

DESCRIPTION

This module is an event-driven SNMP interface for POE.

POE::Component::SNMP uses the Net::SNMP module written by David M. Town.

CREATING SNMP COMPONENTS

create - creates a POE::Component::SNMP session
POE::Component::SNMP->create(
    hostname  => $hostname,
    [community => $community,]
    [alias    => $alias,]
    [version  => $version,]
    [timeout  => $timeout,]
    [retries  => $retries,]
    [debug    => $debug,]
);

SNMP COMPONENT EVENTS

Most of the events accept a list of arguments, @snmp_args, which are passed directly to a Net::SNMP session. See the Net::SNMP documentation for more information on these arguments.

get
$kernel->post( snmp => 'get', 'snmp_callback', @snmp_args );

Send a SNMP get request event.

getnext
$kernel->post( snmp => 'getnext', 'snmp_callback', @snmp_args );

Send a SNMP getnext request event.

walk
$kernel->post( snmp => 'walk', 'snmp_callback', @snmp_args );

Send a SNMP walk request event.

getbulk
$kernel->post( snmp => 'getbulk', 'snmp_callback', @snmp_args );

Send a SNMP getbulk request event.

trap
$kernel->post( snmp => 'trap', @snmp_args );

Send a SNMPv1 trap request event.

inform
$kernel->post( snmp => 'inform', 'snmp_callback', @snmp_args );

Send a SNMP inform request event.

set
$kernel->post( snmp => 'set', @snmp_args );

Send a SNMP set request event.

finish
$kernel->post( snmp => 'finish' );

Shutdown the SNMP component.

dispatch (DEPRECATED)
$kernel->post( snmp => 'dispatch' );

DEPRECATED. Does nothing.

Before this module was fully integrated with POE's event processing, it was necessary to invoke its behavior by explicitly calling this method.

SEE ALSO

Net::SNMP
POE
POE::Session
POE::Kernel

AUTHOR

Originally by Todd Caine, <tcaine@eli.net>.

Adopted and maintained by Rob Bloodgood, <rob@exitexchange.com>.

COPYRIGHT AND LICENSE

Copyright 2003 by Todd Caine, 2004 by Rob Bloodgood.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.