• RSS
  • Twitter
11
June
Comments

Scenario: Let’s say you’ve installed VMware vCenter Operations Manager, or as it’s affectionately known vCOPs, and you are suddenly inundated with email notifications! Trust me, we’ve been there :-(. If you are anything like us you have determined that you can’t quickly and efficiently weed out the real issues from the non issues in your inbox. By default vCOPs will send workload and anomaly alerts for metrics that breach dynamic thresholds, like hey: “VIRTUALM01 is using 2GB of RAM” even though the VM in question has 10GB of RAM and this is nowhere near the “danger zone.” The worst part about it is that these email notification will be right along side critical faults, which you may miss seeing because of the nonsense. So, what do we do about it?

Luckily, for us, VMware added functionality to create custom email notifications using the custom UI of vCOPs!

 

Let’s Get To Work!: First, we need to configure the vCOPs custom UI to send email notification via our choice of email server. To do this we create what’s called an Outbound Alert Handler. The alert handlers can be used to send alerts via email, log to file, trigger SNMP traps, and through EMC Smarts. Additionally, multiple alert handlers can be created for different purposes. For our purpose we will use an Outbound Alert Type of Email:

  •  Navigate to your vCOPs custom UI at: https://myanalyticsvm.vj.local/vcops-custom/
  • Once logged in, select the ADMIN menu item and the CONFIGURE OUTBOUND ALERT sub menu item
  • Under the Alert Handler section click the icon that looks like: add
  • Select Email from the drop down menu beside Outbound Alert Type
  • Specify an Instance Name that describes what you will use the alerts for, in our case we will use these to notify us of Key Performance Indicators (KPI) breaches
  • Specify your mail server info SMTP host name or IP, SMTP port number, and if it requires a secure connection or authentication:

vcops1

 

  • Click Test to verify your configuration is correct and Click Ok. Now, select your newly created Alert Handler from the list and click the icon that looks like this to start the handler: start

Now that we have our SMTP configuration correct we need to configure our email filter. This will tell vCOPs which address to send the emails too, the alert handler to use, the email template to use, the from email address, and various other settings:

  •  Locate and create a backup copy of the emailFilter.xml file from your Analytics VM of the vCOPs vApp. I normally access the files with my favorite Secure FTP client WinSCP. The emailFilter.xml file is located in the directory: /usr/lib/vmware-vcops/user/plugins/outbound/filter_alertplugin/conf
  • Download a copy of the file and locate the section below to configure general options:
    • Edit the section between the <FileReloadTimeInMinutes> to specify how often the emailFilter.xml file is checked for changes.
    • Edit the section between the <SendFromEmail> tags with the email address you wish the email notification to be from such as VCOPS@yourcompany.com
    • Edit the section between the <Subject> tags with the default subject your emails. Note: in the email templates we will create later on you can choose a custom subject.

 

 

  • Locate the section below to configure the filter rules:
    • I suggest editing the existing FilterRule called ResourceKindAlerts to customize it to your needs or creating a new <FilterRule> </FilterRule> section
    • Edit FilterRule name =… to something specific to you such as KPIAlerts
    • Edit the condition types to correspond to the type of alert you wish to receive emails for. Example, you want to receive emails for alerts of the type: Classic and the subtype: KPI_HT_Breach:
      • <condition type=”AlertType”>Classic</condition>
      • <condition type=”AlertSubType”>KPI_HT_Breach</condition>
    • Edit the sendTo section to specify what email address the alert should be sent to. Additonally, you can add resend and delay into this section to make the email notification wait a delay of 5 minutes before sending an email about an alert or configure it to resend the alert every 2 minutes until cancelled
    • On page 82 of the vCOPs Enterprise Admin guide you can find the full list of alert and alert sub types that can be used

 

 

Once we have our FilterRule defined the way we like we can move on to the Templates section of the XML file:

  • Locate the section below to configure the templates:
    • At this point you can do two things:
      • Edit the tags to specify a custom HTML file name that you create and place in the folder: /usr/lib/vmware-vcops/user/plugins/outbound/filter_alertplugin/conf/custom_templates
      • Don’t edit the tag and just edit the HTML file specified in the tag such as New-Classic-KPI_HT_Breach.html. These files are located in: /usr/lib/vmware-vcops/user/plugins/outbound/filter_alertplugin/conf/default_templates. Be sure to backup your templates before editing the defaults.

 

 

I won’t go into a full tutorial of how to edit the HTML templates but I will post a copy below of my New-Classic-KPI_HT_Breach.html and Cancel-Classic-KPI_HT_Breach.html templates for reference. Additionally, you can find the full list of placeholder variable for the templates on page 87 of the vCOPs Enterprise Admin guide

  • Here is my New-Classic-KPI_HT_Breach.html template example and what it looks like in email form:

    new

 

 

  • Here is my Cancel-Classic-KPI_HT_Breach.html template example and what it looks like in email form:

cancelled

 

Closing Thoughts: Now you have the information to move forward and create your own custom notifications! In a future blog post we will discuss creating KPI Alerts so you can generate specific alerts for the information you care about the most like disk free percent, CPU workload or even VMotions as you saw above. Once you have defined the KPI’s and email templates you wish to use you can stop the stock emails from the vCOPs standard UI by unchecking the alert types in the Notification settings as show below:

vcops5

 

 

Enjoy 🙂

About the author

@virtual_cj

Categories: vCOPs

One Response so far.

  1. […] Closing Thoughts: In addition to the great new alert we generated above we can go one step further and generate an email based off the alert. Creating an alert handler, configuring custom email templates and all the settings related to this can be found in a blog post I wrote last month: Creating Customer vCOPs Email Notifications […]

Leave a Reply