VMware Cloud Community
skayser
Enthusiast
Enthusiast

Test and periodic SNMP traps from vCenter?

According to vSphere Basic System Administration, section SNMP and vSphere, VMWARE-VC-EVENT-MIB, vCenter can send out SNMP traps for diagnostic purposes

a) on request

b) on a periodic basis

"The vCenter Server SNMP agent sends this trap when vCenter Server starts or is restarted, or when a test notification is requested. vCenter Server can be configured to send this trap periodically at regular intervals."

Does anyone know how to do so? The manual says it can be done, but doesn't explain how to (neither the on demand nor the periodic one). I know that I can manually trigger an alarm (e.g. on VM power state), but now that I stumbled upon the test trap description it seems as if there should be a more straight-forward way (and even one which can be used to periodically verify the vCenter trap handling).

Tags (2)
5 Replies
mark_chuman
Hot Shot
Hot Shot

You're not talking about setting up and using the SNMP traps from within the vSphere client right? Are you talking about vCenter being able to send out SNMP traps when it starts or restarts? Not clear on what you're trying to setup? We use HP monitoring for the actual vCenter service.

Are you just asking about how to take the next step of having vCenter "send" the SNMP alerts somewhere?

Reply
0 Kudos
skayser
Enthusiast
Enthusiast

I am talking about the pre-defined alarms that come with vCenter like "Datastore usage on disk", "Virtual machine CPU usage" etc. (VCENTER -> Alarms -> Definitions). Some of them are already pre-configured to trigger SNMP alarm traps and it IMHO makes for a long hanging fruit to setup a SNMP trap receiver that processes such traps.

While doing so (setup is running by now), I stumbled upon the manual section above that talks about triggering diagnostic traps (on demand, periodically) and I was curious whether anyone has actually seen an option in vCenter to configure or trigger them. So it's not about the actual alarm traps, but about manual-mentioned diagnostic traps that could be used for troubleshooting and periodic verification of the communication vCenter -> trap receiver.

Reply
0 Kudos
MRSNMP
Enthusiast
Enthusiast

Regarding vCenter Server's built in SNMP Agent Test & periodic trap (Enterprise 6876, trap number 202  or vpxdDiagnostic):

This feature is not presently configurable by the GUI or by the VIM API. The GUI only provides a means to configure targets.

The VIM API provides a trap on demand method, shares the same SnmpSystem managed entity as does ESXi.

One must first first obtain the HostConfigManager, then the HostSnmpSystem property and

call the method SendTestNotification() which will generate the vpxdDiagnostic to each configured target.

To generate repeated vpxdDiagnostics, there is no VIM API or CLI/GUI support for this.

It requires an operator to modify vpxd's config file, add the following:

Edit the vpxd config file (vpxd.cfg) and restart vpxd to setup recurrent test traps.
If no period element is defined then it default to 5 minutes (300 seconds).
<config>
...
<snmp>
    <testTrap>
        <periodic>
          <enable>true</enable>
          <period>300</period>
        </periodic>
    </testTrap>
  </snmp>
...
</config>

Location of vpxd.cfg file by platform:
VCVA: /etc/vmware-vpx/vpxd.cfg
Windows 2008:  C:\ProgramData\VMware\VMware VirtualCenter\vpxd.cfg
Windows 2003:  C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\vpxd.cfg
I verified this feature works in version 5.1/VCVA, here's the periodic test notification as a SNMPv1
trap over UDP/IPv4.
edit vpxd.conf above, set the timeout to 60 seconds, verify receipt and interval:

1) coldStart trap indicates app/agent has booted up
2012-10-22 13:36:29 localhost.localdomain [127.0.0.1] (via UDP: [10.20.103.167]:57831) TRAP, SNMP v1, community witriew-vcva-prom-eng-vmware-com
        VMWARE-PRODUCTS-MIB::vmwVC Cold Start Trap (202) Uptime: 95 days, 21:49:26.42

2) first test notification
2012-10-22 13:36:29 localhost.localdomain [127.0.0.1] (via UDP: [10.20.103.167]:57831) TRAP, SNMP v1, community witriew-vcva-prom-eng-vmware-com
        VMWARE-PRODUCTS-MIB::vmwVC Cold Start Trap (202) Uptime: 95 days, 21:49:26.42
3) second test notification
2012-10-22 13:37:29 localhost.localdomain [127.0.0.1] (via UDP: [10.20.103.167]:39074) TRAP, SNMP v1, community witriew-vcva-prom-eng-vmware-com
        VMWARE-PRODUCTS-MIB::vmwVC Enterprise Specific Trap (VMWARE-VC-EVENT-MIB::vpxdDiagnostic) Uptime: 95 days, 21:50:26.43
....

Even on an unloaded vcenter server/network there was noticable jitter.

I would recommend using a "dead timer" of 4 times the  period ("hello") duration for single hop ethernet LAN.

roddam
Contributor
Contributor

Just a FYI, there is a limit to the periodicity value though. My vpxd service would not start if it is something more than 2147 seconds.

I snubbed my ego before I could figure out what it is 2147 seconds.

-Roddam

Reply
0 Kudos
ipv6
VMware Employee
VMware Employee

To send a test trap use the mob since there is no GUI support:

https://vcva.example.com/mob/?moid=SnmpSystem&method=sendTestNotification

To configure heartbeat, periodic intervals:

To change the default sending period on vCenter Server:

  1. Take a backup of the vpxd.cfg file. This file is located by default at:

    vCenter Server Appliance: /etc/vmware-vpx/vpxd.cfg for vCenter Server Applicace.
    Windows 2008: C:\ProgramData\VMware\VMware VirtualCenter\vpxd.cfg for Windows 2008.
    Windows 2003: C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\vpxd.cfg for Windows 2003.
  2. As an administrator, open the vpxd.cfg file using a text editor.
  3. Within the <config> </config> tags, add or update this SNMP configuration:
    <config>...<snmp><testTrap><periodic><enable>true</enable><period>300</period></periodic></testTrap></snmp>...</config> Note: The <period> value is in seconds. If no SNMP <period> element is defined then it default to 5 minutes (300 seconds).
Reply
0 Kudos