小编Che*_*kri的帖子

mib名称从perl中的mib值打印

这是我在net:snmp使用perl时用于遍历表的代码:

      #! /usr/local/bin/perl

      use strict;
      use warnings;

      use Net::SNMP qw(:snmp);

      my $OID_hrSystem = '1.3.6.1.2.1.25.1';
      my $OID_ifPhysAddress = '1.3.6.1.2.1.2.2.1.6';        

      my ($session, $error) = Net::SNMP->session(
         -hostname    => shift || 'localhost',
         -community   => shift || 'public',
         -nonblocking => 1,
         -translate   => [-octetstring => 0],
         -version     => 'snmpv2c',
      );

      if (!defined $session) {
         printf "ERROR: %s.\n", $error;
         exit 1;
      }

      my %table; # Hash to store the results

      my $result = $session->get_bulk_request(
         -varbindlist    => [ $OID_hrSystem ],
         -callback       => [ \&table_callback, \%table …
Run Code Online (Sandbox Code Playgroud)

printing perl mib net-snmp

5
推荐指数
1
解决办法
2523
查看次数

标签 统计

mib ×1

net-snmp ×1

perl ×1

printing ×1