SNMP::ToolBox - Set of SNMP-related utilities
Version 0.03
use SNMP::ToolBox; # sort a list of OIDs @oid_list = sort by_oid @oid_list; # OID-encode a string $idx = oid_encode($name);
This module contains a set of functions useful for writing SNMP-related programs and modules: by_oid, find_next_oid(), oid_encode().
by_oid
find_next_oid()
oid_encode()
The following functions are exported by default:
by_oid find_next_oid oid_encode
Sub-routine suitable for being used with sort for sorting OIDs. Two implementations are included in this module: a classical one, by splitting the OIDs and comparing each pair of components, and another, by evaluating the OIDs as Perl v-strings. The fastest one for the running version of Perl will be used.
sort
Example:
@oid_list = sort by_oid @oid_list;
Even though the implementations proposed in this module are pretty good, it is suggested to use Sort::Key::OID's oidsort() when possible, for it is roughly 40-50 times faster. Here is an example on how to always use the best function available:
Sort::Key::OID
oidsort()
use constant HAVE_SORT_KEY_OID => eval "use Sort::Key::OID 0.04 'oidsort'; 1" ? 1 : 0; @oid_list = HAVE_SORT_KEY_OID ? oidsort(@oid_list) : sort by_oid @oid_list;
Using a constant allows the Perl compiler to optimise away the dead code early.
Generic implementation of the algorithm to find the OID following a given one in an ordered list of OIDs. Typically needed for implementing a "getnext" feature in nearly any kind of server-side SNMP extension (pass_persist, SMUX, AgentX, etc).
Expects the list of OIDs as an arrayref, the OID to request against and an optional context. Returns the appropriate "next" OID or the string "NONE".
"NONE"
Arguments:
Exemple:
my $oid = $walk_base; while ($oid ne "NONE") { $oid = get_next_oid(\@oid_list, $oid, $walk_base); # ... }
Returns the OID-encoded equivalent of the string given in argument.
my $idx = oid_encode($name);
You can find documentation for this module with the perldoc command.
perldoc SNMP::ToolBox
You can also look for information at:
Search CPAN
http://search.cpan.org/dist/SNMP-ToolBox/
Meta CPAN
https://metacpan.org/release/SNMP-ToolBox
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/Public/Dist/Display.html?Name=SNMP-ToolBox
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/SNMP-ToolBox
CPAN Ratings
http://cpanratings.perl.org/d/SNMP-ToolBox
Please report any bugs or feature requests to bug-snmp-toolbox at rt.cpan.org, or through the web interface at https://rt.cpan.org/Public/Dist/Display.html?Name=SNMP-ToolBox. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-snmp-toolbox at rt.cpan.org
Sébastien Aperghis-Tramoni <sebastien at aperghis.net>
<sebastien at aperghis.net>
Copyright 2011 Sebastien Aperghis-Tramoni.
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.
To install SNMP::ToolBox, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SNMP::ToolBox
CPAN shell
perl -MCPAN -e shell install SNMP::ToolBox
For more information on module installation, please visit the detailed CPAN module installation guide.