Network Change & Configuration Management

Reply

Import SNMPv3 credentials for multiple devices

Authority
Posts: 4
1211     2

I'm trying to import SNMPv3 credentials similar to the way SSH credentials are imported in this article: https://support.infoblox.com/s/article/3636. Any help is appreciated on the exact format of the file.

 

Thanks.

Re: Import SNMPv3 credentials for multiple devices

Expert
Posts: 59
1211     2

I can't quickly find a way to do that, but do you really need to import creds per device?  Is SNMP guessing not sufficient?

 

If you're trying to update existing/working creds, you can either:

1) Add the new ones to the global list with a higher priority and then via the NetMRI CLI - "reset snmp".  That forces guessing for all devices.

2) Use a perl or python script that executes on the devices of interest.  Via the API, it sets the values for each device in the DB and initiates a Discover Now for each one.  I used this method when migrating from v2 to v3 and also to update the v3 ones.

 

Re: Import SNMPv3 credentials for multiple devices

Authority
Posts: 4
1211     2

I had actually found this script on the site. Unfortunately, I can't find the original posting. And I can't attach it here, so here is the text of the perl script. This seems to work well.

 

###########################################################################
## Export of Script: Change SNMP version or credentials
## Script-Level: 1
## Script-Category:
###########################################################################

# BEGIN-INTERNAL-SCRIPT-BLOCK
# Script:
# Change SNMP version or credentials

# Script-Description:
# 'Changes device monitoring from v2 to v3 or vice versa. Can also be used to change SNMP credentials.

Note: This only changes parameters within the NetMRI device viewer, not on the devices themselves!!!'

# END-INTERNAL-SCRIPT-BLOCK

#
# This script can be used to change the SNMP version/credentials that
# Network Automation uses to communicate with an already discovered
# device (i.e., the "guessed" credentials for that device). This script
# does no validation of user input whatsoever, so be careful.
#
# NOTICE: This script is provided on an "as-is" basis, and is intended to
# serve as an example illustrating how to accomplish certain tasks
# using the NetMRI API. This script is not part of the NetMRI product,
# and is not supported by Infoblox Technical Support.
#

# BEGIN-SCRIPT-BLOCK
#
# Script-Filter:
# true
#
# Script-Login:
# false
#
# Script-Variables:
# $snmp_version integer 3
# $snmp2_community string 'secret'
# $snmp3_user string 'monitoring'
# $snmp3_auth_proto string 'md5'
# $snmp3_auth_pwd string '%nJuN(7i0NjUnCt1oN'

# END-SCRIPT-BLOCK

use NetMRI_Easy;

my $easy = new NetMRI_Easy;

if ($snmp_version eq '3') {
print "\nConfiguring SNMPv3 credentials for this device.\n\n";
$easy->broker->discovery_statuses->update_snmp({
DeviceID => $device_id,
SNMPVersion => $snmp_version,
SNMPRead => $snmp3_user,
SNMPAuthProto => $snmp3_auth_proto,
SNMPAuthPW => $snmp3_auth_pwd,

});
}

if ($snmp_version eq '2') {
print "\nConfiguring SNMPv2 credentials for this device.\n\n";
$easy->broker->discovery_statuses->update_snmp({
DeviceID => $device_id,
SNMPVersion => $snmp_version,
SNMPRead => $snmp2_community
});
}

print "\nDone.\n\n";

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You