{"id":688,"date":"2021-07-07T20:55:52","date_gmt":"2021-07-07T20:55:52","guid":{"rendered":"https:\/\/www.spktechfit.com\/?p=688"},"modified":"2021-07-07T20:55:52","modified_gmt":"2021-07-07T20:55:52","slug":"25-monitor-resources-using-azure-monitor","status":"publish","type":"post","link":"https:\/\/www.spktechfit.com\/?p=688","title":{"rendered":"25. Monitor Resources using Azure Monitor"},"content":{"rendered":"<h1 style=\"margin: 0in; font-family: Calibri; font-size: 16.0pt; color: #1e4e79;\">Overview of Azure Monitor<\/h1>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">Azure Monitor is a centrally place to monitor applications and infrastructure. It can monitor:<\/p>\n<ul style=\"margin-left: .375in; direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in;\" type=\"disc\">\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">VMs<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Applications<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Storage accounts<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Containers<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Networks<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">SQL<\/span><\/li>\n<\/ul>\n<p style=\"margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;\">\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">By default Azure Monitor doesn\u2019t do anything until you connect your infrastructure to it.<\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\"><span style=\"font-style: italic;\">&#8220;Azure Monitor collects monitoring telemetry from a variety of on-premises and Azure sources. Management tools, such as those in Azure Security Center and Azure Automation, also push log data to Azure Monitor. The service aggregates and stores this telemetry in a log data store that\u2019s optimised for cost and performance. Analyse data, set up alerts, get end-to-end views of your applications, and use machine learning-driven insights to quickly identify and resolve problems.&#8221;<\/span><\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p><cite style=\"margin: 0in; font-family: Calibri; font-size: 9.0pt; color: #595959;\">From &lt;<a href=\"https:\/\/azure.microsoft.com\/en-au\/services\/monitor\/\">https:\/\/azure.microsoft.com\/en-au\/services\/monitor\/<\/a>&gt; <\/cite><\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<h2 style=\"margin: 0in; font-family: Calibri; font-size: 14.0pt; color: #2e75b5;\">Pricing<\/h2>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">Using Azure Monitor is free, but if turn on logging for your resources the log data has to be stored somewhere and you get charged for that storage.<\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p>&nbsp;<\/p>\n<h2 style=\"margin: 0in; font-family: Calibri; font-size: 14.0pt; color: #2e75b5;\">Best Practices<\/h2>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">Very frequent monitoring of applications can have an impact on the performance of the application. It is best to have a limited amount of monitoring happening, then if there are issues happening you can increase the monitoring as a debugging tool.<\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p>&nbsp;<\/p>\n<h1 style=\"margin: 0in; font-family: Calibri; font-size: 16.0pt; color: #1e4e79;\">Enabling Diagnostics for Resources<\/h1>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p>&nbsp;<\/p>\n<h2 style=\"margin: 0in; font-family: Calibri; font-size: 14.0pt; color: #2e75b5;\">Enable Diagnostics for Virtual Machines<\/h2>\n<ol style=\"margin-left: .375in; direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;\" type=\"1\">\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\" value=\"1\"><span style=\"font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;\">Go to Monitor -&gt; Virtual Machines<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Click on the &#8220;Not monitored&#8221; tab to see your VM that isn&#8217;t being monitored<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Click on Enable. You will be asked for a Workspace to store the logs<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">This will install an agent on the VM to pull the log files<\/span><\/li>\n<\/ol>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\"><span style=\"font-weight: bold;\">NOTE: the VM must be running for the software installation to take place<\/span><\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p>&nbsp;<\/p>\n<h2 style=\"margin: 0in; font-family: Calibri; font-size: 14.0pt; color: #2e75b5;\">Enable Diagnostics for other Resources<\/h2>\n<ol style=\"margin-left: .375in; direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;\" type=\"1\">\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\" value=\"1\"><span style=\"font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;\">Go to Monitor -&gt; Diagnostic Settings<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Here you will see a list of all your Azure resources and whether diagnostics is enabled or not. You can filter by resource group, type etc\u2026<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Select a resource and click enable. In this example we are using a Web app<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Click on Add Diagnostic Setting<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Give it a name<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Select the logs (pageviews, page requests) and metrics (CPU, memory etc\u2026) you want to gather<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Destination details: select to send to Log analytics Workspace<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Click on Save<\/span><\/li>\n<\/ol>\n<p style=\"margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;\">\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">Once you have turned on Diagnostics it is best to leave it for around a day before running reports. This will give it time to gather data.<\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p>&nbsp;<\/p>\n<h1 style=\"margin: 0in; font-family: Calibri; font-size: 16.0pt; color: #1e4e79;\">Running Basic Kusto Queries on Logs<\/h1>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<ol style=\"margin-left: .375in; direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in; font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;\" type=\"1\">\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\" value=\"1\"><span style=\"font-family: Calibri; font-size: 11.0pt; font-weight: normal; font-style: normal;\">Go to Monitor -&gt; Logs<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">This opens a query dialog box. Close this to get the normal query page. This looks similar to SSMS<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">The &#8220;Select Scope&#8221; allows you to select the resource which logs you want to query <\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">On the left you will see the list of tables you can use for your query. If you double click the table it pulls it into the query and you could run that<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">You can build a &#8220;where&#8221; clause by piping this,<br \/>\nEG:<br \/>\n<\/span><span style=\"font-style: italic; font-family: Calibri; font-size: 11.0pt;\">AzureAcitiviy | Where OperationNameVauule contains &#8220;Microsoft.Insights&#8221;<\/p>\n<p><\/span><span style=\"font-family: Calibri; font-size: 11.0pt;\">Get last 10 metric events<br \/>\n<\/span><span style=\"font-style: italic; font-family: Calibri; font-size: 11.0pt;\">AzureMetrics | take 10<\/span><\/li>\n<\/ol>\n<p style=\"margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;\">\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">If you click on &#8220;Queries&#8221; on the top left, you will get some built in queries that you can use and edit.<\/p>\n<p style=\"margin: 0in; margin-left: .375in; font-family: Calibri; font-size: 11.0pt;\">\n","protected":false},"excerpt":{"rendered":"<p>Overview of Azure Monitor Azure Monitor is a centrally place to monitor applications and infrastructure. It can monitor: VMs Applications Storage accounts Containers Networks SQL By default Azure Monitor doesn\u2019t do anything until you connect your infrastructure to it. &#8220;Azure Monitor collects monitoring telemetry from a variety of on-premises and Azure sources. Management tools, such [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[13,3],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/posts\/688"}],"collection":[{"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=688"}],"version-history":[{"count":2,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/posts\/688\/revisions"}],"predecessor-version":[{"id":690,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/posts\/688\/revisions\/690"}],"wp:attachment":[{"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}