p>Using Simple Networking Management Protocol (SNMP) to monitor server performance and send notifications (called traps) is an important skill that all VMware administrators will eventually need to master. In this article I'll explain the different types of SNMP agents available for VMware ESX, how to configure SNMP with ESX and give an example of how it could be monitored using SNMP. Finally, you'll learn how to configure the alternative ESX SNMP agent to send SNMP traps to a network management station.
Why would I want to configure SNMP for VMware ESX Server?
SNMP is used to gather statistics from network devices such PCs, servers, network devices and more. SNMP can also be used to send traps to SNMP management stations (such as Hostmonitor from ks-soft).
VMware ESX Server comes with two SNMP agents. One agent is based on net-snmp (a well-known Linux SNMP agent with excellent documentation on the Internet). The other SNMP agent is very simple and only supports traps. This is the same agent that ESXi offers. In this article, I will be configuring the more advanced SNMP agent - net-snmp. (For documentation on how to configure the slimmed down ESX agent and ESXi agent see VMware's article on using SNMP with ESXi. You will only be able to configure ESX or ESXi to send traps to your network management station.)
Unfortunately, you can not enable SNMP using a graphical interface (such as the VMware Infrastracture Client). That said, it isn't hard to do with the command line. Let me show you how by using secure shell (SSH) command line and simple network management protocol (SNMP) commands.
How to enable SNMP in ESX Server via SSH Other than going to the server's console, configuring SNMP via SSH is the only way to do it. Once connected to the ESX Server using SSH you can use standard Linux commands to configure SNMP. I will just cover the standard SNMP configuration. The SNMP daemon is NOT running by default so until you follow these instructions, your SNMP monitoring application won't be able to talk to your ESX Server. First, I would edit the
file using nano or vi. For example:
At minimum, enter the read-only community string (ROcommunity). I entered the system contact, the system location, read only community string, and trap community string.
At this point, the SNMP daemon is configured but not yet started. You could start the SNMP daemon manually by simply typing:
service snmpd start
However, you actually want the SNMP daemon to start automatically every time the server boots. To do this, type:
chkconfig snmpd on
To make sure it is running, you can do a:
service snmp status
There are also lots of SNMP commands in ESX. In /usr/bin you will find commands like snmpstatus, snmptest, and snmpwalk. Find them all go this way:
ls -l | grep snmp
To enable traps on ESX Server 3
Edit the config.xml file. The configuration parameter snmp/generateTraps in the /etc/vmware/hostd/config.xml file determines whether to generate a trap. By default, a trap is generated.
If necessary restart vmware_hostd to see the change take effect.
See also this vmware document
How to monitor VMware ESX Server using a management stations
There are a many management stations. So pick one and try for your self :)
How to enable VMware ESX / ESXi SNMP traps using the Remote CLI
To configure the basic SNMP agent to send traps, you can use the free VMware remote command line interface (Remote CLI). After running RCLI and typing DIR, I can see the command vicfg-snmp.pl.
Basic configuration for traps is done with:
vicfg-snmp.pl --server --username root --password -c -t @162/
For all the options, run vicfg-snmp.pl -help.