Using PowervRNI to configure SNMP settings
Version 1.2 of PowervRNI was just released and it contains 2 new cmdlets:
- Get-vRNIDataSourceSNMPConfig
- Set-vRNIDataSourceSNMPConfig
You can use these cmdlets to see and update SNMP configuration on specific data sources. All Arista, Brocade, Cisco, Dell, and Juniper devices are data sources where SNMP can be enabled for richer data collection. This basically turns on interface counter collections, so you can have pretty graphs like this:
Examples
To give you an idea of how to use these new cmdlets, check out the examples below. Of course, there is also documentation available in the module itself, viewable via the Get-Help cmdlet.
Get-vRNIDataSourceSNMPConfig
It's quite a mouthful, but the naming convention of PowerShell is clear: name it after what it does. ;-) So this cmdlet retrieves the SNMP configuration (if there's any present) from a data source. It uses the values from Get-vRNIDataSource as input. Here's an example that goes through all Cisco switch data sources:
PS C:\> Get-vRNIDataSource -DataSourceType ciscoswitch | Get-vRNIDataSourceSNMPConfig
...snip...
snmp_enabled : False
snmp_version : v2c
config_snmp_2c : @{community_string=string}
config_snmp_3 : @{username=string; context_name=string; authentication_type=NO_AUTH; authentication_password=string; privacy_type=AES; privacy_password=string}
...snip...
As the result, you can see the SNMP configuration is disabled for this example. If it were enabled, you would see the details it's using to poll the data source.
Set-vRNIDataSourceSNMPConfig
As the counterpart to Get-vRNIDataSourceSNMPConfig, the cmdlet Set-vRNIDataSourceSNMPConfig updates the SNMP configuration of a data source. It also takes the output of Get-vRNIDataSource as input, so you can use it in a piped manner.
PS C:\> $snmpOptions = @{ "Enabled" = $true; "Community" = "snmpcommunity"; }
PS C:\> Get-vRNIDataSource | Where {$_.nickname -eq "Core01"} | Set-vRNIDataSourceSNMPConfig @snmpOptions
As a result, the data source with the nickname Core01 will get its SNMP configuration updated to use SNMP v2c and use the community
Feedback
As interest in PowervRNI grows, I'm seeing a growing number of people using it to automate installation and operational tasks. Please continue to give me feedback on the module so we can continuously improve it!