How To Use vSphere Alarms To Monitor VMware Environments

vSphere alarms are one of many methods available to monitor vSphere environments. If you have vCenter installed, you can create alarms to monitor any object registered in the vSphere inventory. For instance, you can create an alarm to email a notification whenever a new VM is created or alert you to resources running low on an ESXi host. These are just a couple of use cases that first come to mind but there are plenty more. Out-of-the-box, vCenter Server 6.5 comes with no less than 194 preconfigured vSphere alarms readily set up.

You can view alarms in vSphere Web client or by using PowerCLI as shown next.

Listing alarm definitions in vSphere Web client

Listing alarm definitions in vSphere Web client

 

PowerCLI comes in handy when you need to manage alarms. Here, I used the Get-AlarmDefinition cmdlet to get a count of the number of alarms starting from the root level. The second command on the screenshot lists the alarms specific to vSAN, something I chose for no particular reason other than to illustrate the importance of monitoring the vSAN component given a total of 90 alarms.

Using PowerCLI cmdlets to retrieve alarm definitions related info

Using PowerCLI cmdlets to retrieve alarm definitions related info

 

Some stuff you need to know


Before jumping in, you need to know that alarms created at higher levels in the vSphere hierarchy, will trickle down to the underlying objects at lower levels where applicable. The topmost object in the hierarchy is the vCenter server itself which is followed by a datacenter object, ESXi hosts, etc. Also, the type of alarm created depends on the type of object it has been applied to. For instance, an alarm set to monitor vSAN will not be applied to, say, a VM for obvious reasons. You can verify this fact by selecting a VM in your hierarchy. Have a look and see which alarms have been applied and which ones, if any, have percolated from higher up levels in the hierarchy. The latter can be assessed by looking at the values under the Defined In column. In the following example, we can see that the alarms set for the selected VM have been inherited from those set at the vCenter Server level.

Viewing the alarms set for a specific VM

Viewing the alarms set for a specific VM

 

You can have a triggered alarm alert you via email or SNMP if you so desire. Alternatively, you can use the vSphere Web client to monitor the status of your environment. The latter might suffice for small environments but in general, you’d want to use an SNMP based monitoring tool like Nagios or something like vRealize Operations Manager and vRealize Log Insight server. When enabling SNMP or SMTP (email) functionality, remember that you must configure vCenter Server first to be able to use either. You can do this by selecting the vCenter Server object in vSphere Web Client and configure SNMP or SMTP from the General settings page as shown next. In some instances, you can also set up alarms to execute a script in response to being triggered.

Configuring vCenter Server for SMTP and SNMP

Configuring vCenter Server for SMTP and SNMP

 

Creating an alarm


In general, you should leave system alarms set. In the next example, I’m creating an alarm definition – which is the proper term – such that an email is sent to me anytime a VM is created in my testing environment.

There are three parts to an alarm, the object to monitor and what to monitor for, triggers and what action to take. To create alarms, you need to have vCenter Server deployed and vSphere Web client. I want the alarm to apply to all levels in my vSphere hierarchy so I’ll create it and place it at the topmost level; vCenter Server. This ensures that the alarm will percolate down to all the objects in the hierarchy.

To do this, right-click on the vCenter Server name and select New Alarm Definition from the Alarms menu which invokes a wizard by the same name.

Creating a new vSphere alarm definition

Creating a new alarm definition

 

On the first screen, we need to specify what is it we want to monitor.

  1. Assign a meaningful name to the alarm. Optionally, you can add a description as well.
  2. Choose the object to monitor. In this case, I’ve chosen Virtual Machines since I want the alarm to trigger whenever a new VM is created.
  3. Select whether you want to monitor for a specific condition or state or a specific event taking place. I’ve chosen the latter since the creation a new VM is a specific event.
  4. The Enable this alarm option is ticked on by default. You can disable the alarm at any time.
  5. Press Next to continue to the next screen.
Specifying what to monitor for

Specifying what to monitor for

 

Next, we specify a trigger.

  1. Hit the Add green plus button.
  2. Choose an event from the drop-down list. You can include multiple events but we’re only interested in one at this point.
  3. Optionally, we can fine-tune triggering by adding a condition that must be met for the trigger to fire. Once again, hit the green plus sign to add the condition.
  4. In this example, I want the alarm to trigger only when a VM is created on an ESXi host called esx-a.vsphere65.local. I do this by selecting the Host Name argument and setting it to match the ESXi’s host name.
  5. Press Next to move on to the last screen.
Defining triggers and conditions for the alarm

Defining triggers and conditions for the alarm

 

Finally, we specify what action to take once the alarm is triggered. In this example, I’m going to have the alarm send me an email with the details whenever a VM is created.

  1. Click on the green plus sign to add an action.
  2. Select an action type from the Action drop-down menu. You can set the Status to Unset, Normal, Warning or Alert which determines how the object shows up once an alarm is triggered.
  3. Under the Configuration field, type in the recipient’s email address which is where alerts will be delivered to. Remember to set the SMTP configuration for vCenter Server.
  4. Select if the alert is sent only once or repeatedly. Notice the last 4 columns each representing state transitions; normal to warning, warning to critical, critical to warning and warning to normal. Since this is a one-time event having one state transition, I’ve selected Once under the normal to warning column.
  5. Pressing Finish completes the alarm definition creation process.
Deciding what action to take once an alarm has been triggered

Deciding what action to take once an alarm has been triggered

 

It’s Testing Time


To test if the alarm definition triggers off, I’ve created a VM on the host specified by the trigger condition and a second on a different ESXi host. As shown in the next screenshot, the VM called test is accompanied by an Alert sign next to it. This indicates that an alarm was triggered in response to an event.

To view what made it trigger off, click on the VM and select the Triggered Alarms page as shown next. You can see that the New VM Created alarm I created earlier was successfully triggered when a VM was created on the host which name matches that set for the trigger condition. The second VM created, test2, did not set the alarm off since the VM’s parent host name is not included in the trigger condition.

An icon is displayed next to the VM name once an alarm is triggered. The triggering alarm definition can be determined from the Triggered Alarms page for the selected VM.

An icon is displayed next to the VM name once an alarm is triggered. The triggering alarm definition can be determined from the Triggered Alarms page for the selected VM.

 

The email received also confirms successful triggering of the alarm.

An email generated by the triggered alarm definition

An email generated by the triggered alarm definition

 

Conclusion


Alarms are an effective and easy method which you can use to monitor what goes on in your vSphere environment. As with many features, it takes a while to get used to fine-tune what is what you want to monitor and what not, which triggers and conditions to use and where one draws the line. For larger environments, vSphere alarms should complement monitoring solutions like Nagios, vRealize Operations Manager and Log Insight Server.

[the_ad id=”4738″][the_ad id=”4796″]

Altaro VM Backup
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

16 thoughts on "How To Use vSphere Alarms To Monitor VMware Environments"

Leave a comment

Your email address will not be published.