NetCrunch Knowledge Base

How-tos, troubleshooting and answers about NetCrunch.

Receiving events from VMware as SNMP traps

How can I configure vSphere Web Client, ESXi, and vCenter Server to enable receiving info about VMware events as SNMP traps

Applies to 12.x 11.x 10.x

Learn how to configure vSphere Web Client, ESXi, and vCenter Server to enable receiving info about events as SNMP traps

Enable SNMP on ESXi

  1. Enable SSH on ESXi
    • Open vSphere Web Client
    • Open Configure -> System -> Security Profile -> Configure, then click Edit button
    • Select SSH and click Start button
  2. Configure SNMP on ESXi
    • Open SSH client
    • Login into VMware (use root credentials)
    • Set community:
      esxcli system snmp set --communities `<COMMUNITY_STRING>`
      
    • Enable SNMP service:
      esxcli system snmp set --enable true
      
  3. Set firewall rules on ESXi
    • we need to allow traffic from the NetCrunch Server host
      esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
      esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address `<NETCRUNCH_SERVER_IP>`/`<MASK>` (eg. 192.168.0.1/24)
      esxcli network firewall ruleset set --ruleset-id snmp --enabled true
      
  4. Restart SNMP Service
    /etc/init.d/snmpd restart
    
  5. Disable SSH on VMware host

Configure vCenter Server SNMP agents and ESXi SNMP agents

  1. Configure SNMP Community
    • Open appliance shell
    • Log in as an administrator or super administrator user
    • Configure SNMP community. To do this run the following command:
      snmp.set --communities `<COMMUNITIES>`
      
  2. Configure SNMP Agent
    • Open appliance shell
    • Log in as an administrator or super administrator user
    • Run the following command:
      snmp.set --targets `<NETCRUNCH_SERVER_IP>`@`<PORT>`/`<COMMUNITY>`
      

Configure traps to be sent as an Alarm Action

Traps can be configured for many different types of events. For hosts, virtual machines, etc. For the purposes of this article, we will create a trap that will be sent when the VM is powered on.

  1. Open Homepage in VMware Client
  2. Select VMs and Templates view
  3. Select Virtual Machine
  4. In the right panel, select the Configure tab
  5. Go to Alarm Definitions
  6. Click the Add button
  7. In new WIndow provide Alarm Name and select Target type: Virtual Machines
  8. In Alarm Rule 1 set condition:
    IF VM powered on
    Send SNMP traps
    
  9. Go to the last tab and click the CREATE button

Configure NetCrunch

When you configure everything correctly in VMware, the traps will start displaying in NetCruch, in the External Events tab. To set up alerts, please do as follows:

  1. Go to the External Events tab
  2. Open the SNMP Traps tab
  3. Localize interesting trap
  4. Click on the Set Alert button on the left side of the trap
  5. All settings should be set in the New Alert Rule... window, so just click the OK button to save alert
  6. Select Alerting Script from the list or create a new one
  7. Click the OK button

From now, when the virtual machine migrates, you will be informed about it in the way you selected in step 6 above.

NetCrunch. Answers not just pictures

Maps → Alerts → Automation → Intelligence