Try adding debugging. For example:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dump::Streamer;
use Net::SNMP qw(DEBUG_ALL SNMP_TRAP_PORT);
my $OID = '1.3.6.1.4.1.9.9.513.1.1.1.1.2.0.23.223.167.189.192';
my ( $session, $error ) = Net::SNMP->session(
-hostname => shift || 'localhost',
-community => shift || 'private',
-version => 'snmpv2c',
-port => SNMP_TRAP_PORT,
-nonblocking => 1,
-debug => DEBUG_ALL,
);
if ( !defined $session ) {
printf "ERROR: %s.\n", $error;
exit 1;
}
my $result = $session->get_request( -varbindlist => [$OID], );
if ( !defined $result ) {
printf "ERROR: %s.\n", $session->error();
$session->close();
exit 1;
}
$session->close();
exit 0;