SNMP configuration steps for VI3, vSphere 4.0 and 4.1
search cancel

SNMP configuration steps for VI3, vSphere 4.0 and 4.1

book

Article ID: 308101

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

Background Information

Simple Network Management Protocol (SNMP) allows management programs to monitor and control a variety of networked devices.

Managed systems run SNMP agents, which can provide information to a management program in at least one of these ways:

  • In response to a GET operation, a specific request for information from the management system. This uses port 161.
  • By sending a trap, an alert sent by the SNMP agent to notify the management system of a particular event or condition. This uses port 162.

Management Information Base (MIB) files define the information that can be provided by managed devices. The MIB files contain object identifiers (OIDs) and variables arranged in a hierarchy.

vCenter Server and ESX/ESXi have SNMP agents. The agent provided with each product has differing capabilities.

VERSION COMPARISON

ESX
Version
Supported Method
GET Request Support
Trap Support
3.5 ESX Classic
net-snmp
yes
yes
3.5 ESXi
embedded snmp
no
yes
4.0 - ESXi and Classic
embedded snmp
yes
yes
4.1 - ESXi and Classic
embedded snmp
yes
yes
vCenter
Version
Supported Method
GET Request Support
Trap Support
2.5 vCenter
standard
no
yes
4.0 vCenter
standard
no
yes
4.1 vCenter
standard
no
yes


Symptoms:



Environment

VMware ESX 4.0.x
VMware ESX Server 3.5.x
VMware ESX 4.1.x
VMware ESXi 3.5.x Embedded
VMware ESXi 3.5.x Installable
VMware vCenter Server 4.1.x
VMware ESXi 4.1.x Installable
VMware ESXi 4.0.x Installable
VMware ESXi 4.0.x Embedded
VMware vCenter Server 4.0.x
VMware ESXi 4.1.x Embedded

Resolution

This article has these sections:

vCenter-specific information

  • Configuration has remained unchanged from Virtual Center 2.5 through vCenter 4.1
  • vCenter only sends traps. It does not respond to GET requests.

Configuration of vCenter traps

  1. Navigate to the SNMP page in the client.
    • In the vSphere Client (4.x), go to Administration > vCenter Server Settings.
    • In the VI Client (2.5), go to Administration > Virtual Center Server Settings.
  2. Choose SNMP from the menu on the left.
  3. Enter the trapserver hostname/IP, port and community string in the Receiver URL and Community String fields.

    Example:

ESX-specific information

Virtual Infrastructure 3 (VI 3)

ESX Server 3 ships with two SNMP agents. The first is an SNMP agent based on Net-SNMP with enhancements to support data specific to ESX Server 3. The second agent is identical to that which ships with ESX Server 3i, and can be used and configured in the same manner.

There are two methods of use:

  1. Net-SNMP: This method handles both traps and GET requests
  2. Embedded agent: This method handles only traps

Configuration for Net-SNMP for ESX 3.5 Classic

To configure Net-SNMP to handle traps:

  1. Enable Net-SNMP as you would for requests.
  2. By default, traps are enabled. Edit the config file to disable them, with this command:

    /etc/vmware/hostd/config.xml

  3. Edit the configuration fiile /etc/snmp/snmpd.conf to include your domain and community name(s), with these commands:

    • trapsink example.com

      where example.com is your destination
    • trapcommunity public

      where public is community name of your choice


    Note: Repeat these lines to specify more than one destination or community.

  4. Save and restart snmpd, with this command:

    /etc/rc.d/init.d/snmpd restart

To configure Net-SNMP to handle GET requests:

  1. Log in to the service console as the root user.
  2. Edit the /etc/snmp/snmpd.conf configuration file (if needed)
  3. Tell ESX to start SNMP on boot, with this command:

    chkconfig snmpd on

  4. Start SNMP manually, with this command:

    /etc/rc.d/init.d/snmpd start

  5. Open the firewall ports, if needed, with these commands:

    esxcfg-firewall -o 161,udp,in,snmpd
    esxcfg-firewall -o 161,udp,out,snmpd

Configuration for emedded SNMP for ESXi 3.5

See the section for vSphere 4.0 and 4.1. The instructions are the same.

vSphere 4.0 and 4.1

ESX/ESXi includes an SNMP agent embedded in hostd that can both send traps and receive polling requests such as GET requests. This agent is referred to as the embedded SNMP agent.

Versions of ESX prior to ESX 4.0 included a Net-SNMP-based agent. You can continue to use this Net-SNMP-based agent in ESX 4.0 with MIBs supplied by your hardware vendor and other third-party management applications. However, to use the VMware MIB files, you must use the embedded SNMP agent.

By default, the embedded SNMP agent is disabled. To enable it, you must configure it using the vSphere CLI command vicfg-snmp. Also, there are no default/built-in community strings configured. For more information, see the vSphere Command-Line Interface Installation and Reference Guide.

Note: Configuration and use of the Net-SNMP-based agent is deprecated as of vSphere 4.0. Use of this method, if required, is not supported by VMware. Contact your monitoring software vendor or hardware vendor on their own best practices where needed. While this is not an officially-supported configuration, VMware publishes this document for assistance in utilizing Net-SNMP and the embedded agent together: Configuring the Net-SNMP Agent on ESX Hosts.

Configuration for embedded SNMP for ESX Classic and ESXi 4.0 and 4.1

The VMware vSphere CLI (Windows or Linux) is required to configure SNMP as of vSphere 4.0. This tool is pre-installed in the vSphere Management Assistant and can be used as well.

These steps modify the configuration file /etc/vmware/snmp.xml.

Note: VMware does not recommend modifying this file by hand. Use the provided commands instead.

If it needs to be re-created, a default snmp.xml file looks like this:

false

Configuring embedded SNMP with the vSphere CLI or vMA

You can configure embedded SNMP with the VMware vSphere CLI (Windows, Linux) or the VMware vSphere Management Assistant (vMA) (runs in a virtual machine).

Downloading

You can obtain the vSphere CLI and vMA from our site.

To download the CLI, go to the VMware Download Center. Under the Drivers & Tools tab, expand Automation Tools and SDKs and then click the VMware vSphere CLI for your version of vSphere.

To download the vMA in .zip form, go to the VMware Download Center. Under the Drivers & Tools tab, click the VMware vSphere Management Assistant (vMA) for your version of vSphere.

To deploy the vMA from a URL, open the vSphere client and go to File > Deploy OVF template. Use this URL: http://www.vmware.com/go/importvma/vma4.ovf

Configuration for all versions of the embedded SNMP (ESXi 3.5 and ESX/ESXi 4.x)

  1. Set the community string to public, with this command:

    vicfg-snmp --server --username root --password -c public

    where is your hostname, and < your password> is your root password.

    Example: vicfg-snmp --server esx1-old --username root --password vmware -c public

    Note: It was seen in one instance where it was necessary for the login credentials to be encapsulated in quotes: --username "username" --password "password"

  2. Turn traps on, with this command:

    vicfg-snmp --server --username root --password your password> -t @162/public

    where is your hostname, < your password> is your root password, and is your trap server hostname.

    Example: vicfg-snmp --server esx1-old --username root --password vmware -t vc-all.jlab.local@162/public

    Note: You can set multiple target servers by comma delimiting the -t @162/public strings:

    Example: vicfg-snmp --server esx1-old --username root --password vmware -t @162/public ,@162/public

  3. Enable SNMP:

    vicfg-snmp --server --username root --password your password> -E

    where is your hostname, and < your password> is your root password.

    Example: vicfg-snmp --server esx1-old --username root --password vmware -E

  4. Show the configuration settings:

    vicfg-snmp --server hostname --username root --password your password> -s

    where is your hostname, and < your password> is your root password.

    Example: vicfg-snmp --server esx1-old --username root --password vmware -s

Syntax

Use this syntax with the vicfg-snmp.pl script:

vicfg-snmp.pl –server –c –p –t

CLI Options:
  • -r: Resets configure to defaults
  • -E: Enables the SNMP service
  • -D: Disables the SNMP service
  • -T: Sends a test trap
  • -t: Configures a trap server
  • -s: Shows the current SNMP configuration

Verify Configuration for ESX Classic and ESXi 3.5, 4.0, and 4.1

To send a test trap, from vMA or vSphere CLI, use this command:

vicfg-snmp.pl –server –username –password -T

Example: vicfg-snmp --server esx1-old --username root --password vmware -T

The output looks like this:

Sending test notification(trap) to all configured targets...
Complete. Check with each target to see if trap was received.

To test GET request functionality, from vMA or vSphere CLI, use this command:

snmpwalk -v -c

Example: snmpwalk -v 2c -c public esx1-old

Configuring SNMP Collector Software

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

To configure your software, you must:

  • Specify the communities for the managed device
  • Configure the port settings
  • Load the VMware MIB files

Refer to the documentation for your management system for specific instructions for these steps.

Note: It is important to import the MIBs in order. For more information, see the vSphere Administration Guides. Unless there is a typo in the MIB files themselves, the process for this is the responsibility of the monitoring software vendor.

Download the MIB files from the VMware Download Center. For more information, see SNMP MIB module file download (1013445).


Additional Information

For more information, see:
SNMP MIB module file download
VI3、vSphere 4.0、および 4.1 の SNMP 構成手順
VI3、vSphere 4.0 和 4.1 的 SNMP 配置步骤