How would I parse this output to html and only include the last word after the => ?
using the following code?
Code:
See attached script
Output:
1.3.6.1.4.1.9.10.19.1.3.1.1.3.96908838.0 => fac922
1.3.6.1.4.1.9.10.19.1.3.1.1.3.97214883.0 => fac972
1.3.6.1.4.1.9.10.19.1.3.1.1.3.97299103.0 => fac590
1.3.6.1.4.1.9.10.19.1.3.1.1.3.97475922.0 => fac172
1.3.6.1.4.1.9.10.19.1.3.1.1.3.97498052.0 => fac402
1.3.6.1.4.1.9.10.19.1.3.1.1.3.97904146.0 => fac625
1.3.6.1.4.1.9.10.19.1.3.1.1.3.98010825.0 => fac594
===
Mike Singleton CCNA, CNE, MCSE
Network Analyst
(253) 272-1916 x1259
(253) 405-1968 (cellular)
[EMAIL PROTECTED]
DaVita Inc.
#! c:/perl/bin/perl
use strict;
use Carp;
use Net::SNMP qw(:snmp);
my ($session, $error) = Net::SNMP->session(
-version => 'snmpv2c',
-nonblocking => 1,
-hostname => shift || 'x.x.x.x',
-community => shift || 'public',
-port => shift || 161
);
if (!defined($session)) {
printf("ERROR: %s.\n", $error);
exit 1;
}
my $ifTable = '1.3.6.1.4.1.9.10.19.1.3.1.1.3';
my $result = $session->get_bulk_request(
-callback => [\&table_cb, {}],
-maxrepetitions => 10,
-varbindlist => [$ifTable]
);
if (!defined($result)) {
printf("ERROR: %s.\n", $session->error);
$session->close;
exit 1;
}
snmp_dispatcher();
$session->close;
exit 0;
sub table_cb
{
my ($session, $table) = @_;
if (!defined($session->var_bind_list)) {
printf("ERROR: %s\n", $session->error);
} else {
# Loop through each of the OIDs in the response and assign
# the key/value pairs to the anonymous hash that is passed
# to the callback. Make sure that we are still in the table
# before assigning the key/values.
my $next;
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) {
if (!oid_base_match($ifTable, $oid)) {
$next = undef;
last;
}
$next = $oid;
$table->{$oid} = $session->var_bind_list->{$oid};
}
# If $next is defined we need to send another request
# to get more of the table.
if (defined($next)) {
$result = $session->get_bulk_request(
-callback => [\&table_cb, $table],
-maxrepetitions => 10,
-varbindlist => [$next]
);
if (!defined($result)) {
printf("ERROR: %s\n", $session->error);
}
} else {
# We are no longer in the table, so print the results.
foreach my $oid (oid_lex_sort(keys(%{$table}))) {
printf("%s => %s\n", $oid, $table->{$oid});
}
}
}
}