SNMP Queries

I recently help someone out getting a monitor working that uses the System.SnmpQueryProvider module in the System.Snmp.Library management pack to perform a query against an SNMP device.  They were getting back an error message showing some cryptic characters in the community string.  They were just providing simple text like "public" for the CommunityString parameter on the module, so this looked pretty strange.

After some research, it turns out that module wants the community string specified in Base64 format.  Nothing special from the MP perspective – you just need to specify the Base64 equivalent of your community string in the CommunityString parameter rather than the simple text.

If you already have a means of converting a string to Base64, then you should be fine.  If not, here’s bit of PowerShell that will do the conversion for you.

 $communityString = 'public'
[System.Convert]::ToBase64String([System.Text.Encoding]::UNICODE.GetBytes($communityString))

If I run that code, I get the following value: cAB1AGIAbABpAGMA.  Pasting that into the CommunityString parameter on the module should get you the results you want.  Obviously, if you have a community name different than "public" you would paste that in and use the resulting converted value.