Azure

Azure Alerts

La gente suele discrepar conmigo, pero nadie quiere ser el último en enterarse, así que deberías considerar usar Azure Alerts para tu entorno, ¿me equivoco?

Alerts proactively notify you when important conditions are found in your monitoring data. They allow you to identify and address issues before the users of your system notice them.

You can have since the well-known alerts like watch CPU percentage, memory utilization, up to watch a specific error happens in your environment.

Monitor

In Azure Portal, you can use the main search field, and type Monitor, select it and click at Alerts

azure search for monitor blog vinicius deschamps
azure monitor alerts blog vinicius deschamps

Bajo Alerts, encontrarás las siguientes opciones New alert rule, Manager alert rules y Manage actions.

Con el propósito de la explicación, voy a saltar primero a Manage Actions y luego a New Alert Rules, y finalmente Manage Alert Rules

Manage Actions

Manage Actions proporciona la posibilidad de determinar los canales que se van a usar para enviar notificaciones a las personas (email, sms, voz) y si también se dispararán acciones automáticas cuando se genere una alerta.

azure monitor alerts manage actions add action group blog vinicius deschamps

Basics

Primero, proporcionarás la información de Basics para crear el Action Group, el Resource Group, un Action Group Name y un Display Name

azure create action group basics blog vinicius deschamps

Notifications

Es hora de establecer la forma en que este Action Group será notificado, así que debes elegir Notification Type y un nombre único para él

azure create action group notifications blog vinicius deschamps
Notification type
Email Azure Resource Manager Role

Puedes elegir enviar correo a los miembros del rol de la suscripción. Es posible elegir entre Owner, Contributor, Reader, Monitoring Contributor y Monitoring Reader.

azure create action group notifications email azure manager role blog vinicius deschamps
Email/SMS message/Push/Voice

Puedes elegir enviar email, sms message, push y voice.

azure create action group email sms push voice blog vinicius deschamps

If the Azure portal action group user interface does not let you select your country code, then SMS or/and Voice is not supported for your country

https://docs.microsoft.com/en-us/azure/azure-monitor/platform/action-groups#sms

Además, puedes tener múltiples Notification type por Action Group, por ejemplo, he configurado para enviar email y para notificar a los Owners de la suscripción.

azure notifications type blog vinicius deschamps

Actions

Este paso no es obligatorio para recibir notificaciones, pero vale la pena conocerlo, porque puedes configurar Actions para que se realicen una vez que se disparen las alertas.

azure create action group actions blog vinicius deschamps

En resumen, puedes configurar una acción para registrar un ticket en tu sistema ServiceNow, o tal vez el error podría solucionarse reiniciando la VM, o muchas otras opciones con todos los demás Action Type disponibles.

Create Action Group

En la pestaña Monitor haz clic en Alerts y luego en Manage Actions

azure monitor alerts blog vinicius deschamps

En la sección Basics, elige un Resource Group o Create new, y proporciona un Action group name así como Display name, luego haz clic en Notifications

azure create action group blog vinicius deschamps

En Notifications, elige un Notification type y proporciona un unique Name

azure create action group create notifications blog vinicius deschamps

Tan pronto como selecciones el Notification type, aparecerán algunas opciones en tu lado derecho y debes elegir entre Email, SMS, Azure App Push y Voice, y finalmente presionar OK

azure create action group notifications set email blog vinicius deschamps
azure create action group notifications review create blog vinicius deschamps

Como solo queremos un Action Group simple, vamos a omitir Actions y Tag, y vamos directamente a Review & Create

Revisa la información proporcionada en esta pantalla y pulsa Create

azure create action group create blog vinicius deschamps

Ahora, que ya tienes tu Action Group, vamos a crear una nueva regla, luego gestionarla.

New Alert Rule

Aquí vas a crear reglas de alerta, determinar umbrales, definir qué debe Azure vigilar en tu behalf y seleccionar a las personas – Action Groups – que serán notificadas cuando se active la alerta.

En Monitor, debes hacer clic en Alerts, luego New alert rule

azure monitor alerts new alert rule blog vinicius deschamps

The Create Alert Rule needs to be filled accordingly to the rule you want to create but the requirements are

Scope
Will point the resource you want to Monitor

Condition
How would you want the alert to be triggered

Action Group
Simple selecting which Action Groups should be prompted when a condition is met

Alert rule details
Will help to find and identify the rule later on

Creating Alert Rule

First of all, you need to select a resource, in my example, I’m going to create an alert for High CPU utilization, so here is how my selections will look like.

In the Create alert rule, under Scope click Select resource

azure create alert select a resource blog vinicius deschamps

Filter by subscription – ensure I choose the Subscription I want to find my resource is selected

Filter by resource type – App Services plan

Filter by location – this is helpful when you have multiple region resource groups

And of course you can use the Search field to look for the resource.

azure create alert select a resource app service plan blog vinicius deschamps

Once you choose the resource, you need to Select a Condition

azure create alert select a condition blog vinicius deschamps

Since I selected App Plan in the previous step, the options presented are designed for this specific resource. Let’s choose CPU Percentage

azure create alert select a condition cpu percentage blog vinicius deschamps

Then you will be presented with the CPU Percentage options

The first thing to notice is the graphic with the CPU percentage from the resource chosen in the Scope step, and it will be very helpful while setting the threshold

azure create alert rule configure signal logic graphic cpu percentage blog vinicius deschamps

Here is an example how the graphic is important while setting the threshold. I have set a 7% threshold, and the dashed line shows how the limit would trigger my alerts.

azure create alert rule configure signal logic graphic cpu percentage threshold line blog vinicius deschamps

Dimension is important when you want to monitor multiple instances running your website with the same rule.

azure create alert rule configure signal logic dimension name blog vinicius deschamps

En Alert logic, you will choose the way conditions should be in order to generate an alert state

Threshold
a) Static, como su nombre indica, es un valor fijo definido por el administrador
b) Dynamic, se calcula utilizando datos históricos mediante un algoritmo de aprendizaje automático (learn more)

Operator
Aquí defines si el valor del umbral debe ser: Greater than, Less than o Greater or Less than

Aggregation type
Qué valores deben considerarse: Average, Maximum, Minimum, Total o Count

Threshold value
El propio valor y formará parte de la expresión para activar la alerta

azure create alert rule configure signal logic alert logic blog vinicius deschamps

Y el Evaluated based on que define cómo se monitorizará la condición

Aggregation granularity (Period)
La ventana de look back sobre la que se verifican los valores de la métrica

Frequency of evaluation
La frecuencia con la que se verifica si se cumplen las condiciones

azure create alert rule configure signal logic evaluated based on blog vinicius deschamps

Ahora, voy a establecer los valores para crear la Condition, y presionar Done

azure create alert rule configure signal logic values blog vinicius deschamps

Vamos a añadir un Action Group haciendo clic en select action group

azure create alert rule select action group blog vinicius deschamps

Select an action group to attach this alert rule aparecerá, y como el Action Group fue creado anteriormente, marca la casilla junto al nombre del grupo de acciones y pulsa Select

azure create alert rule select an action group to attach to this alert rule blog vinicius deschamps

Finalmente, es hora de proporcionar Alert rule details

Alert rule name
Te permite identificar la regla y encontrarla fácilmente luego en Manage Alert Rules

Description
Es un valor opcional, pero puede ayudar a entender mejor el uso de una regla

Severity
Indica la severidad de la alerta cuando se activa, que se mostrará en el asunto del correo y también en la vista de Alertas en Azure

azure create alert rule alert rule details create alert rule blog vinicius deschamps

Manage Alert Rules

Podrás ver todas las reglas existentes, y también buscar fácilmente una regla específica, así como hacer clic en ella para ver cómo se ha definido la regla y modificar detalles si es necesario

En Monitor, debes hacer clic en Alerts, luego Manage alert rules

azure monitor manage alerts rules blog vinicius deschamps
azure monitor manage alerts rules list blog vinicius deschamps

Haciendo clic en blogviniciusdeschamps CPU Percentage, verás y podrás modificar las siguientes cosas: Condition, Action group, Description y Severity.

azure monitor manage alerts rule editing blog vinicius deschamps

Espero que te haya gustado, y nos vemos en mi próximo post.

Photo by Matt Ridley on Unsplash

AlertsAzureAzure Alerts
Azure Alerts — Vinicius Deschamps