Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How do I use Azure Monitor to monitor the health of the service?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

How do I use Azure Monitor to monitor the health of the service? In view of this problem, today the editor summarizes this article on Azure Monitor monitoring, hoping to help more students who want to solve this problem to find a more simple and easy way.

By default, the change tracking solution collects service changes every 30 minutes, and eggs can be configured to collect them every 10 seconds. It is important to note, however, that this approach refers to tracking changes rather than the current state. That is, if there are no changes, no data will be sent to log analytics.

In the next article, we will focus on monitoring Windows services, but the concept works the same for Linux daemons.

Enable change tracking

If we use GUI, we have two ways to enable change tracking:

Enable from the Log Analytics workspace

Click "workspace summary"-"+ Add"-"Change Tracking" in log analytics:

Click "Change Tracking" to open the description tab, then click create, and enter the automation account information as prompted:

Enable from Automation Account

Click "Change Tracking" in "Automation Account", then select the corresponding log analytics workspace and click enable:

Ps: personally, I find it easier to write by enabling change tracking in an automated account.

Query the collected data

We can list the newly collected data with the following query statement. But please note that, as we said before, we can only collect changed data, not for other states that have not changed. And if the virtual machine suddenly crashes, we may not collect the corresponding change practices. But don't worry, we can use other query statements to monitor the viability of vm.

Let utcoffset = 8h ConfigurationData | where ConfigDataType = = "WindowsServices" | where SvcName = = "W3SVC" | extend localTimestamp = TimeGenerated + utcoffset | project localTimestamp, Computer, SvcDisplayName, SvcState | order by localTimestamp desc | summarize arg_max (localTimestamp, *) by SvcDisplayName

Configure Service change Alerts:

In general operation and maintenance scenarios, we certainly hope that when a problem is detected in the service, we can notify the corresponding operation and maintenance personnel by email and other means to deal with it. So here we can configure the corresponding alert rules according to the service changes. In this example, we use it to query and warn whether the IIS (W3SVC) service is stopped:

ConfigurationChange | where ConfigChangeType = = "WindowsServices" and SvcName = = "W3SVC" and SvcState = = "Stopped"

After setting the alarm, we can manually stop the iis service in the test environment. After the service is stopped, our mailbox will receive the following alert:

This is the end of the method of using Azure Monitor to monitor the health of the service. I hope the above content can be helpful to you and learn more knowledge. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report