Thank you for the advices, I am new to the area of programming so maybe I did not explain my problem. When I am executing my code it prints on the terminal:
Problem with session get request: The OBJECT IDENTIFIER value "ARRAY(0
+x942c50)" is expected in dotted decimal notation.
While I was trying to debug my code, I put a print Dumper(\$session); so I could actually see in further analysis what is happenning. When I did that I saw on the terminal:
$VAR1 = \bless( {
'_translate' => 0,
'_security' => bless( {
'_error' => undef,
'_community' => 'public',
'_version' => 0
}, 'Net::SNMP::Security::Comm
+unity' ),
'_transport_argv' => [
'-retries',
'2',
'-hostname',
'127.0.0.1',
'-port',
'161',
'-maxmsgsize',
'1472',
'-domain',
'udp/ipv4',
'-timeout',
'3'
],
'_pdu' => undef,
'_callback' => undef,
'_nonblocking' => 0,
'_version' => 0,
'_transport' => bless( {
'_dest_name' => '�
+',
'_max_msg_size' => 1472,
'_sock_name' => '',
'_timeout' => 3,
'_error' => undef,
'_sock_hostname' => '',
'_dest_hostname' => '127.0
+.0.1',
'_socket' => bless( \*Symb
+ol::GEN0, 'IO::Socket' ),
'_retries' => 2
}, 'Net::SNMP::Transport::IP
+v4::UDP' ),
'_error' => undef,
'_context_engine_id' => undef,
'_context_name' => undef,
'_delay' => 0,
'_discovery_queue' => [],
'_hostname' => '127.0.0.1'
}, 'Net::SNMP' );
At this point I saw the funny characters. Based on experimentation I found the error. I did not know include the request:
push (@request, ($sysDescr,$sysUpTime));
$output = $session->get_request(
-varbindlist => [\@request] ,
);
When I removed the "\" it works just fine. I can not exaclty understand the error or the reason but based on what I have read is the reference on the hash.
Based on the documentation from CPAN
"This list is passed to the method as an array reference using the -varbindlist argument."
But I can not completely understand why if I remove the "\" it works.
Thanks in advance for your time,advices and assistance to my query |