Monitor resources in Azure Flashcards
- What is Azure Monitor?
https://learn.microsoft.com/en-us/azure/azure-monitor/vm/monitor-virtual-machine
Solution that collects , analyzes , and responds to telemetry data for both on prem and cloud environments.
Azure monitor can monitor these types of resources in azure , other clouds or on prem:
*Applications
*Virtual machines
*Guest OS
*Containers
*Databases
*security events in conjunction with Azure Sentinel
*networking events and health in conjunction with network watcher
*custom sources that use API to get data into Azure monitor
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
*If you want to log metrics for a vm you have to:
- You should enable the log analytics VM extension in azure monitor -
- You then need to install the log analytics vm extension that configures the agent to send data to the log analytics workspace.
- This procedure supports both Linux and windows
Describe Azure monitor key capabilities
- Monitor and visualize metrics
Gathers numerical metric values from azure resources
Offers different methods for viewing metric data such as health , operation and performance - Query and analyze logs
generates activity logs , diagnostic logs and telemetry data. - Set up alerts and actions
You can configure action based on alert conditions.
Automated steps based on triggers from your metrics or logs.
Describe Azure monitor components
Azure monitor is composed of several components:
- Azure monitor metrics
*Usage Enables you to visualize and analyze the performance of your resources overtime , setup alerts based on threshold conditions and create dashboards for monitoring
*Purpose: Collects and stores performance data(Metrics) from various azure resources. - Azure monitor logs
*Usage: Uses Kusto query language ( KQL) to query and analyze log data.
*Purpose: Collects and analyzes log data from various sources such as resources , applications and custom sources. - Azure application insights
*Usage: Monitors the availability , performance and usage of your web applications. Uses request tracking , dependency tracking and performance profiling.
*Purpose: Focuses on application performance and usage - Azure monitor workbooks
*Usage: Allows you to combine data from various sources and build visualization to gain insights into your enviroment health and performance
*Purpose: Enables you to create interactive , customizable reports and dashboards using data from azure monitor metrics and logs - Azure monitor alerts
*Usage: Notifies you when specific conditions or thresholds are met. You can configure alerts to trigger actions such as sending emails , invoking webhooks or starting automation runbooks.
*Purpose: Allows you to set up manage alerts based on metric and log data - Azure Monitor Autoscale
*Usage: ensures optimal resource utilization and cost efficiency by automatically scaling resources up or down
*Purpose: Automatically adjusts the number compute resources such as vm’s or instances in an azure Kubernetes service based on demand or defined schedule - Azure monitor for containers
*Usage: Collects container related metrics , logs and performance data to help you understand and optimize the performance of your containerized applications
*Purpose: Monitors the performance and health of containerized applications specifically those deployed in azure Kubernetes service
Azure monitor captures data by using two types logs and metrics. Azure monitor metrics and Azure monitor logs are the two base types of data used by the service.
Azure monitor uses multiple monitoring sources to capture the metrics data and logs , which includes azure subscription , tenant , azure services instances , azure resources an applications.
Azure Insights
access the azure application insights extension to azure monitor to use the application performance monitoring(APM) features. This allows you to monitor your applications performance and gather trace logging data. It available for services such as , Azure virtual machines , azure virtual machine scale sets , azure container instances , azure cosmos DB and azure IoT.
Described Azure monitor alerts
You can configure Azure alerts to initiate a responsive action and send notifications based on telemetry data.
Helps detect and address issues pertaining to your apps that are running and prevent service disruptions.
Things to know:
*create alerts to capture data for your azure services such as resources and apps.
*Alerts consists of alert rules which combines settings and conditions you want to monitor
*An alert rule specifies actions groups to fulfill responsive steps when an alert triggers , such as sending notifications.
- Each Alert monitors your telemetry and captures a signal about changes to your specified resource
Components of azure monitor alerts
Alert rule:
*defines the condition’s under which the alert should be triggered
*Includes criteria such as metric/time thresholds and other conditions.
* Alert rules can be created for vm’s , databases and application insights.
Alert condition:
*Specifies the criteria that must be met for an alert to be triggered. Examples are CPU usage exceeding a certain percentage or number of failed requests reaching a specified threshold.
Actions group:
collection of notification preferences and actions that are taken when an alert is triggered , notifications such as email , sms , webhook and actions such as runbook , logical app
Alert status:
composed of different states such as new , acknowledged and closed.
You can configure your alerts either as stateless or stateful:
*Stateless alerts
-evaluate the current state of the monitored resource independently of its past states.
-Each evaluation is based on the current data and conditions specified in the alert.
-if the current state of the resource meets the alert rule conditions , a new alert is triggered
- Example - Trigger an alert if CPU usage exceeds 90% in the last 5 min
*Stateful alerts
- considers the historical state or condition of the monitored resource
-Takes into account the history of the resources states and conditions based on current and past conditions.
example - trigger an alert if the average CPU is above 80% in three consecutive monitoring intervals
Create alert rules
https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-create-metric-alert-rule
A metric alert rule is used to generate an alert when a performance metric crosses a configured performance threshold value
An alert rule consists of several attributes:
*Target resource - Specifies the azure resource for which you are creating the rule for. It can be a virtual machine , database , application or any other resource
*A signal is emitted for the selected resource type. The emitted signal can be metric , activity log , application insights or log
*Criteria -
*Severity - The range of severity can be 0 to 4.
*Actions - system invokes the actions for your rule by sending notifications
*Enabled/disabled - By default the rule is set to enabled. The alert can only trigger if it is enabled.
Create action groups
Multiple alerts can use the same action group
Notifications how to notify user when action group is triggered
Actions specify how to respond to the defined actions when it is trigged
Action type: Is where you can configure an automated action.
Here are some automated actions:
Automation runbook -
Action function
ITSM
Logic Apps
Webhook
- What is Azure log Analytics?
Is a tool in azure monitor which is used to edit and run log queries for the data that has been collected.
Things to know about log analytics
- Log analytics uses a query language called Kusto Query Language(KQL)
- Search and sort by value , time , property state
- Join data from multiple tables
- Combine large sets of data
- Minimal code needed to perform complex operations
Create a log analytic workspace
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/quick-create-workspace?tabs=azure-portal
https://learn.microsoft.com/en-us/azure/azure-monitor/agents/agent-windows?tabs=setup-wizard
*Azure log analytic workspace is a central resource monitoring platform in azure.
* The log analytic workspace is a data warehouse to which associated resources send their telemetry data
- Has its own query language with which you can generate reports that stretch across all of your azure deployments and management solutions.
Location of where the log analytics data is stored
You cab link network watcher to log analytics but you still need to create the workspace first
Things to know about log Analytics workspace
To create log analytics workspace you need to configure the following parameters:
- Name - Must be unique
- subscription
- resource group - Must contain at least one azure vm instance
- Region - Must support log analytics
- Pricing - Default pricing tier is pay as you go. Charges only apply when the data is collected.
Create Kusto queries( KQL)
Things to consider when using KQL queries:
1.create/save searches of your data
2. Use the saved log searches
3. configure your saved log searches to run automatically
4.configure saved searches to produce notification alerts
5. export data to power bi or excel.
Things to know about KQL query Structure
Common dedicated tables are events , syslog , heartbeat and alerts.
- data is stored in dedicated tables in the log analytics workspace
- each data source and solution includes the name of the data that it creates and description of each of its properties
- Structure of a query is source table followed by a series of commands known as operators
- Query cab be composed of multiple operators to perform advanced functions
- Each operator chain begins with a pipe character
6.The queries can use various options and include data from multiple tables.
KQL log query examples
Common operators used:
Count operator - is used to discover the number of records in an input record set.
Top - used to see the first n records of your input record set , sorted by specified columns.
Where - filter your table
summarize - create a table that aggregates the content based on specifications