NAME

Net::SNMP::QueryEngine::AnyEvent - multiplexing SNMP query engine client using AnyEvent

VERSION

Version 0.06

SYNOPSIS

This is an AnyEvent-flavored Perl client for snmp-query-engine, a multiplexing SNMP query engine.

    use Net::SNMP::QueryEngine::AnyEvent;

    my $sqe = Net::SNMP::QueryEngine::AnyEvent->new;

    $sqe->setopt("127.0.0.1", 161, { community => "meow" }, sub {});
	$sqe->when_done("127.0.0.1", 161, sub { print "done with localhost\n" });

    $sqe->gettable("127.0.0.1", 161, "1.3.6.1.2.1.1", sub {
      my ($h, $ok, $r) = @_;
      for my $t (@$r) {
        print "$t->[0] => $t->[1]\n";
      }
    });

    $sqe->get("127.0.0.1", 161,
      ["1.3.6.1.2.1.1.5.0", "1.3.6.1.2.1.25.1.1.0"],
      sub {
        my ($h, $ok, $r) = @_;
        print "Hostname: $r->[0][1]\n";
        print "Uptime  : $r->[1][1]\n";
    });

    $sqe->wait;

METHODS

new

Constructor. Takes the same arguments as the constructor of the base class, AnyEvent::Handle::new, but always overrides "on_read" callback.

By default, connects to snmp-query-engine listening on localhost, port 7667. Override this by specifying a "connect" argument.

when_done

Execute provided callback when there are no unfinished get or gettable queries towards a specified host:port.

wait

Enters event loop until there are no unanswered queries. Can be called multiple times.

setopt

Performs setopt request.

getopt

Performs getopt request.

get

Performs get request for arbitrary number of OIDs.

gettable

Performs gettable request.

info

Performs info request.

dest_info

Performs dest_info request.

AUTHOR

Anton Berezin, <tobez at tobez.org>

BUGS

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

SEE ALSO

The snmp-query-engine daemon can be found on github at https://github.com/tobez/snmp-query-engine.

SUPPORT

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

perldoc Net::SNMP::QueryEngine::AnyEvent

You can also look for information at:

ACKNOWLEDGEMENTS

This work is in part sponsored by Telia Denmark.

LICENSE AND COPYRIGHT

Copyright (c) 2012-2015, Anton Berezin "<tobez@tobez.org>". All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. 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.

THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR OR CONTRIBUTORS 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.