NAME
Net::SNMP::Mixin::Util - helper class for Net::SNMP mixins
VERSION
Version 0.02
SYNOPSIS
A helper class for Net::SNMP mixins.
use Net::SNMP::Mixin::Util qw/idx2val hex2octet normalize_mac/;
EXPORTS
The following routines are exported by request:
- idx2val($var_bind_list, $base_oid, [$pre], [$tail])
-
convert a var_bind_list into a index => value form, removing the base_oid from oid.
e.g. if base_oid is '1.3.6.1.2.1.17.1.4.1.2', convert from:
'1.3.6.1.2.1.17.1.4.1.2.1' => 'foo' '1.3.6.1.2.1.17.1.4.1.2.2' => 'bar'
to:
'1' => 'foo' '2' => 'bar'
or if base_oid is '1.0.8802.4.1.1.12' and pre == 1 and tail == 2, convert from:
'1.0.8802.4.1.1.12.0.10.0.0.2.99.185' => 'foo', '1.0.8802.4.1.1.12.0.10.0.0.3.99.186' => 'bar', '1.0.8802.4.1.1.12.0.10.0.0.4.99.187' => 'baz', ^ ^ ^ ^ ^ ^ ^ |.....base_oid....|.|.index..|.tail.| |value| ^ pre ---------------|
to:
'10.0.0.2' => 'foo', '10.0.0.3' => 'bar', '10.0.0.4' => 'baz',
Returns the hash reference with index => value. Dies on error.
- hex2octet($hex_string)
-
Sometimes it's importend that the returned SNMP values were untranslated by Net::SNMP. If already translated, we must reconvert it to pure OCTET_STRINGs for some calculations. Returns the input parameter untranslated if it's no string in the form /^0x[0-9a-f]+$/i .
- normalize_mac($mac_address)
-
normalize MAC addresses to the IEEE form XX:XX:XX:XX:XX:XX
normalize the different formats like, x:xx:x:xx:Xx:xx to XX:XX:XX:XX:XX:XX or xxxxxx-xxxxxx to XX:XX:XX:XX:XX:XX or xx-xx-xx-xx-xx-xx to XX:XX:XX:XX:XX:XX or xxxx.xxxx.xxxx to XX:XX:XX:XX:XX:XX or 0x xxxxxxxxxxxx to XX:XX:XX:XX:XX:XX or plain packed '6C' to XX:XX:XX:XX:XX:XX
or returns undef for format errors.
REQUIREMENTS
BUGS
Please report any bugs or feature requests to bug-net-snmp-mixin at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-SNMP-Mixin. 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 Net::SNMP::Mixin::Util
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
COPYRIGHT & LICENSE
Copyright 2008 Karl Gaissmaier, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.