私は次の(動作する)perlスクリプトを持っています:
use Net::SNMP;
# create session to the host
my ($session, $error) = Net::SNMP->session(
-hostname => $hostname,
-version => 'snmpv3',
-username => 'my_user_name',
-authkey => 'my_authkey',#actually, here stands the real authkey as configured on the switch
-privkey => 'my_privkey',#same as on switch
-authprotocol => 'sha',
-privProtocol => 'des'
);
if (!defined($session)) {
print $error . "\n";
last;
}
# retrieve a table from the remote agent
my $result = $session->get_table(
-baseoid => $MAC_OID
);
if (!defined($result)) {
print $session->error . "\n";
$session->close;
last;
}
#print out the result of the snmp query
#....
ここで、同じキーでsnmpwalkまたはsnmpgetを使用したいと思いました。そのために、ホームディレクトリの.snmpに次の内容のsnmp.confファイルを作成しました。
defSecurityName my_user_name
defContext ""
defAuthType SHA
defSecurityLevel authPriv
defAuthPassphrase my_auth_key here
defVersion 3
defPrivPassphrase my_privkey here
defPrivType DES
ご覧のとおり、スクリプトとsnmpgetで同じ資格情報を使用しています。snmpgetを取得するのはなぜですか:認証の失敗(パスワード、コミュニティ、またはキーが正しくありません)?