Monitoring Alerts For Azure Virtual Machine

When hosting a service in the cloud, you may need to monitor and send alerts when specific conditions take place, such as when your service is not running. In this blog post, I will show you how to create a simple alert in Microsoft Azure that sends an email when no activity is taking place on a virtual machine. As a pre-requisite, you will need a Microsoft Azure account, and a Virtual Machine up and running.

To create an alert, select Management Services from the left bar (using the current portal). 

image

This will bring up a list of alerts currently defined, if any. In the sample screenshot below, you will see an alert defined for a Virtual Machine; the alert itself has not been triggered (the status is Not Activated).

image

Let’s create a new Alert to monitor that will activate when 0 bytes have been sent out by the Virtual Machine within a 15 minute period. In other words, we want to be alerted when no outbound network traffic has been detected for 15 minutes, which represents a likely severe condition on the machine itself (either the machine is stopped, or the services are not running at all since no traffic is detected).

Click on the image icon to add an alert, select a name for the alert, a subscription, and Virtual Machine as the Source Type. Make sure you select the correct virtual machine in the Service Name list, then click the arrow to move to the second page.

image

Select Network Out as the metric to monitor, a ‘less than or equal’ condition, and 0 for Bytes. Select 15 minutes for the Evaluation Window. At this point, you are almost done; you just need to indicate which actions you want to take when the condition has been met. For our purposes, simply check ‘Send email to the service administrator and co-administrators’.  Ensure the ‘Enable rule’ is checked, and click OK to save this alert.

image

If your service experiences an issue, you will see that the alert has been ‘activated’, with a warning sign. The alert called ‘Custom Monitoring’ below shows an active alert.

image

You will also receive an email from Microsoft Azure when:

  • - The condition has been met (and the alert is active)
  • - The condition is no longer met (and the alert has been resolved)

You can monitor other services in Microsoft Azure the same way and become aware when serious issues are affecting your services. Although this alerting mechanism does not help you understand the root cause of the problem, you can use it as a mechanism to proactively resolve service issues.

About Herve Roggero

Herve Roggero, Microsoft Azure MVP, @hroggero, is the founder of Blue Syntax Consulting (http://www.bluesyntaxconsulting.com). Herve's experience includes software development, architecture, database administration and senior management with both global corporations and startup companies. Herve holds multiple certifications, including an MCDBA, MCSE, MCSD. He also holds a Master's degree in Business Administration from Indiana University. Herve is the co-author of "PRO SQL Azure" and “PRO SQL Server 2012 Practices” from Apress, a PluralSight author, and runs the Azure Florida Association.

Print | posted @ Thursday, July 23, 2015 6:04 PM

Comments on this entry:

Gravatar # re: Monitoring Alerts For Azure Virtual Machine
by Kevin Johnson at 8/13/2015 2:21 PM

Thanks, great post.
We use Stackify (which seems to be published here extensively) to monitor Azure errors and logs. It is a great tool and seems to be developers oriented (JSON search, tagging etc). You can set up notification based on trends of both errors as well as custom metrics relevant to your app
Comments have been closed on this topic.