Wednesday, 29 May 2013

configure snmp on an esxi host

Configure SNMP for ESXi
based on this www

http://pubs.vmware.com/vsphere-50/topic/com.vmware.vsphere.monitoring.doc_50/GUID-8EF36D7D-59B6-4C74-B1AA-4A9D18AB6250.html

numbers in brackets indicate the step is optional

0
download and install the vsphere cli to desktop - from the vcli command prompt:

1
Display snmp agent configuration
**********
vicfg-snmp.pl --server esxi001.domain.com -s
**********
C:\>vicfg-snmp.pl --server esxi001.domain.com -s
Enter username: root
Enter password:
Current SNMP agent settings:
Enabled  : 0
UDP port : 161
Communities :
Notification targets :
Options :
EnvEventSource=indications

2
Configure SNMP Communities
**********
vicfg-snmp.pl --server esxi001 --username root --password Secret!! -c public1
**********
C:\>vicfg-snmp.pl --server esxi001 --username root --password Secret!! -c public1
Changing community list to: public1...
Complete.
C:\>vicfg-snmp.pl --server esxi001.domain.com -s
Enter username: root
Enter password:
Current SNMP agent settings:
Enabled  : 0
UDP port : 161
Communities :
public1
Notification targets :
Options :
EnvEventSource=indications

3
If the SNMP agent is not enabled, enable it by typing
**********
vicfg-snmp.pl --server esxi001 --username root --password Secret!! --enable
**********
C:\>vicfg-snmp.pl --server esxi001 --username root --password Secret!! --enable
Enabling agent...
Complete.
C:\>vicfg-snmp.pl --server esxi001.domain.com -s
Enter username: root
Enter password:
Current SNMP agent settings:
Enabled  : 1UDP port : 161
Communities :
public1
Notification targets :
Options :
EnvEventSource=indications

4
Configure the SNMP Agent to Send Traps
**********
vicfg-snmp.pl --server esxi001 --username root --password Secret!! -t solarwinds.domain.com@162/public1
**********
C:\>vicfg-snmp.pl --server esxi001 --username root --password Secret!! -t solarwinds.domain.com@162/public1
Changing notification(trap) targets list to: solarwinds.domain.com@162/public1...
Complete.

5
Send a test trap to verify that the agent is configured correctly by typing
**********
vicfg-snmp.pl --server esxi001 --username root --password Secret!! --test
**********
C:\>vicfg-snmp.pl --server esxi001 --username root --password Secret!! --test
Sending test nofication(trap) to all configured targets...
Complete. Check with each target to see if trap was received.

(6)
Configure the SNMP Agent for Polling (- not necessary - already done by default)
**********
vicfg-snmp.pl --server esxi001 --username root --password Secret!! -p 161
**********
C:\>vicfg-snmp.pl --server esxi001 --username root --password Secret!! -p 161
Changing udp port to 161...
Complete.

C:\>vicfg-snmp.pl --server esxi001.domain.com -s
Enter username: root
Enter password:
Current SNMP agent settings:
Enabled  : 1
UDP port : 161
Communities :
public1
Notification targets :
solarwinds.domain.com@162/public1
Options :
EnvEventSource=indications

(7)
Configure the Source used by the SNMP Agent for Hardware Events (- not necessary - already done by default)
**********
for vsphere4
vicfg-snmp.pl --server hostname --username username --password password -y sensors
for vsphere5
vicfg-snmp.pl --server esxi001 --username root --password Secret!! -y indications
**********
C:\>vicfg-snmp.pl --server esxi001 --username root --password Secret!! -y indications
Changing source of hardware event source: indications...
Complete.
C:\>vicfg-snmp.pl --server esxi001.domain.com --username root --password Secret!! -s
Current SNMP agent settings:
Enabled  : 1
UDP port : 161
Communities :
public1
Notification targets :
solarwinds.domain.com@162/public1
Options :
EnvEventSource=indications

8
Configure SNMP Management Client Software

After you have configured a vCenter Server system or a host to send traps, you must configure your management client software to receive and interpret those traps.

(9)
Configure the SNMP Agent to Filter Traps
vicfg-snmp.pl --server hostname --username username --password password -n oid_list

From the vSphere CLI, vicfg-snmp.pl --server hostname --username username --password password -n oid_list
oid_list is a list of OIDs for the traps to filter, separated by commas. This list replaces any OIDs that were previously specificed using this command.
For example, to filter out coldStart (OID 1.3.6.1.4.1.6876.4.1.1.0) and warmStart (OID 1.3.6.1.4.1.6876.4.1.1.1) traps, type vicfg-snmp.pl --server hostname --username username --password password -n 1.3.6.1.4.1.6876.4.1.1.0,1.3.6.1.4.1.6876.4.1.1.1
To clear all trap filters, typevicfg-snmp.pl --server hostname --username username --password password -n reset

No comments:

Post a Comment