Scripted configurations of SNMP v2

Today I went through the process of scripting the configuration of SNMP configurations for multiple OS/devices. The reason for this is that there has never been a formality or standardisation of this and sometimes we tend to forget this and or that. So, in case you would also like to script it, here is what we use.

The defaults:

For this, you could either use “3rd floor, of some office” or, if you are a global company, with  monitoring system that makes use of the GoogleMaps API (e.g. Observium) and would like to show various location globally – use a google API name – e.g. London, UK or Cape Town, South Africa etc.

This could be a name or an email address or telephone number

Something that is configured on your server and on your device/workstation/server that allows communications. There is also a permission set that will get applied to this.

This is the place you are sending information to

This is by default, 161/UDP, unless you change it.

Setting SNMP for ESXi Hosts:

Single Host (Locally on the host):

Log in to the esxi host you want to configure and run the following:

Tested on esxi 5.1, 5.5 and 6.0

Single Host (powerCLI):

Login via vSphere PowerCLI and run the below

Multiple Hosts (powerCLI):

Login via vSphere PowerCLI and run the below. Be sure to change “”,”” to your own host names. As this is an array, the format is: “”,””,”” until you have added all your hostnames.

Windows Devices:

Tested on Server 2008, 2008R2, 2012, 2012R2. You also need to make sure you have installed the SNMP service via the server manager.

Cisco Devices

Cisco 3750 / 3850

Cisco Nexus

Cisco ASA

The second community listed in line 4 is the actual community string.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *