Configuring VMware vCenter Server as an event source

VMware vSphere is a centralized management application. You can use the product to manage virtual machines and ESXi hosts centrally. You can set up an integration with Netcool® Operations Insight® to receive notifications created by VMware vSphere.

Before you begin

  • You must have permission to run Python 3 on vCenter Server Appliance (VCSA) or PowerShell on Windows.
  • You cannot apply the script in this procedure to multiple alarm definitions at a time. The path to the script must be entered manually in the alarms.
The following event types are supported for this integration:
  • All VMware alarms through the webhook connection.

Procedure

  1. Click Administration > Integrations with other systems.
  2. Click New integration.
  3. Go to the VMware vSphere tile and click Configure.
  4. Enter a name for the integration.
  5. Click Download file to download and extract the vmware-alarm-action-scripts-for-cem.zip file.
  6. Create the following directory:
    • On Linux®/Photon OS: /root/cem
    • On Windows: C:\cem
  7. Transfer and extract the package to /root/cem or C:\cem.
    Note:
    To transfer the package to VCenter Server installed on Linux/Photon, you must first run the chsh command to set bash for the login shell before you transfer the package. Example:
    root@9 [ ~ ]# chsh
    Changing the login shell for root
    Enter the new value, or press ENTER for the default
    Login Shell [/bin/appliancesh]: /usr/bin/bash
  8. For more information about creating an alarm in the vSphere client, see https://docs.vmware.com/en/VMware-vSphere/6.7/com.vmware.vsphere.monitoring.doc/GUID-E30ED662-D851-4230-9AFE-1BBBC55C98D6.html.
  9. For more information about running a script or a command as an alarm action, see https://docs.vmware.com/en/VMware-vSphere/6.7/com.vmware.vsphere.monitoring.doc/GUID-AB74502C-5F01-478D-AF66-672AB5B8065C.html.
    Note:

    Identify the path to run Python 3 or cmd.exe in vCenter Server.

    If the vCenter Server is running on Linux/Photon OS, you can run 'which python' to get the path to Python 3. For example, /usr/bin/python. Run /usr/bin/python --version to verify that it is Python 3.

    If the vCenter Server is running on Windows, then you must identify the path to cmd.exe. For example, C:\Windows\System32\cmd.exe.

  10. To send an alarm to event management, you must specify the following code as an alarm action:
    • Linux/Photon OS: /usr/bin/python /root/cem/vmware-alarm-action-scripts-for-cem/sendEventToCEM.py
    • Windows: C:\Windows\System32\cmd.exe "/c echo.|powershell -NonInteractive -File c:\cem\vmware-alarm-action-scripts-for-cem\sendEventToCEM.ps1
    Note:

    You can specify /usr/bin/python /root/cem/vmware-alarm-action-scripts-for-cem/sendEventToCEM.py --expirytime <time in seconds> or C:\Windows\System32\cmd.exe "/c echo.|powershell -NonInteractive -File c:\cem\vmware-alarm-action-scripts-for-cem\sendEventToCEM.ps1 --expirytime <time in seconds> as an alarm action. This alarm action sends an alarm to CEM and, if there is no further event, the CEM event is cleared after the --expirytime <time in seconds>. This alarm action is required if you cannot define the reset rule or reset the alarms.

    Repeat the alarm action as an interval under the alarm rule in the vCenter Server. Set the value to less than the --expirytime value. For example, repeat the action every 60 minutes until acknowledged or reset to green. Then, set the --expirytime value to 14400 (14400 seconds is equivalent to 4 hours). This implementation is a workaround to a current VMware limitation.

  11. Save the integration in event management. To start receiving notifications from VMware vSphere, verify that Enable event management from this source is set to On..

What to do next

The same script can be used to clear the alarm. In VMware, go to Edit Alarm Definition > Reset Rule > Run script and specify the path from step 10 in the Run this field. Note: due to VMware limitations, this script does not always run.