/usr/share/doc/libsnmp-session-perl/examples/mtf.pl is in libsnmp-session-perl 1.14~git20130523.186a005-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #!/usr/bin/perl -w
#
# @@@ Modified to use an illegal OID
# @@@ (to check whether a correct error message is generated)
#
# Demonstration code for table walking
#
# This script should serve as an example of how to "correctly"
# traverse the rows of a table. This functionality is implemented in
# the map_table() subroutine. The example script displays a few
# columns of the RFC 1213 interface table and Cisco's locIfTable. The
# tables share the same index, so they can be handled by a single
# invocation of map_table().
require 5.003;
use strict;
use BER;
use SNMP_Session;
my $host = shift @ARGV || die;
my $community = shift @ARGV || die;
my $ifDescr = [1,3,6,1,2,1,2,2,1,2];
my $ifInOctets = [1,3,6,1,2,1,2,2,1,10];
my $ifOutOctets = [1,3,6,1,2,1,2,2,1,16];
my $locIfInBitsSec = [1,3,6,1,4,1,9,2,2,1,1,6];
# @@@
my $locIfOutBitsSec = [9,2,2,1,1,8];
# @@@
my $locIfDescr = [1,3,6,1,4,1,9,2,2,1,1,28];
sub out_interface {
my ($index, $descr, $in, $out, $comment) = @_;
grep (defined $_ && ($_=pretty_print $_),
($descr, $in, $out, $comment));
printf "%2d %-24s %10s %10s %s\n",
$index,
defined $descr ? $descr : '',
defined $in ? $in/1000.0 : '-',
defined $out ? $out/1000.0 : '-',
defined $comment ? $comment : '';
}
my $session = SNMP_Session->open ($host, $community, 161)
|| die "Opening SNMP_Session";
$session->map_table ([$ifDescr,$locIfInBitsSec,$locIfOutBitsSec,$locIfDescr],
\&out_interface);
1;
|