Perform synchronous SNMP GET requests

This section of the SNMP GET access example Perl script sets up the logic to run the synchronous SNMP GET requests. Use this part of the example script as a guide to writing code that makes use of some of the synchronous SNMP GET requests in client/server Perl scripts that retrieve SNMP information.

The SNMP GET access example Perl script sets up the logic and runs the synchronous SNMP GET requests as follows:


 sub SyncTests {

 print "$Ttype: call SnmpGetNext($nodeIP, NULL, ifDescr)\n"; 1
 my ($vap) = $snmp->SnmpGetNext($nodeIP, "", "ifDescr") or
 die "SnmpGetNext on ifDescr table for '$node' failed";

 foreach my $varop (@{ $vap })
 {
 	PrintVarOp($varop);
 }

 print "$Ttype: call SnmpGet($nodeIP, NULL, ifDescr,1)\n"; 2
 $vap = $snmp->SnmpGet($nodeIP, "", "ifDescr",1) or
 die "SnmpGetNext on ifDescr table for '$node' failed";

 PrintVarOp($vap);

 print "$Ttype: call SnmpGetBulk($nodeIP, NULL,\@oids,8,100)\n";
 my @oids=('sysDescr', 'sysContact', 'sysUpTime', 'ipInReceives',
'ipOutRequests', 'ipOutDiscards', 'ipForwDatagrams',
'tcpCurrEstab', 'ifDescr');

 ($vap) = $snmp->SnmpGetBulk($nodeIP, "", \@oids, 8, 100); 3
 foreach my $varop (@{ $vap })
 {
 	PrintVarOp($varop);
 }
 }

The following list explains specific numbered items in the previously listed section of the SNMP GET access Perl script example:

  1. Performs an SNMP GETNEXT synchronous request (by calling the SnmpGetNext method).
  2. Performs an SNMP GET synchronous request (by calling the SnmpGet method).
  3. Performs an SNMP GETBULK synchronous request (by calling the SnmpGetBulk method).