{"id":4423,"date":"2018-02-21T21:59:21","date_gmt":"2018-02-21T20:59:21","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=4423"},"modified":"2018-02-21T22:06:20","modified_gmt":"2018-02-21T21:06:20","slug":"building-an-azure-dashboard-with-server-performance-data","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=4423","title":{"rendered":"Building an Azure dashboard with server performance data"},"content":{"rendered":"<p>I guess all of you have seen the dashboards in Azure, the first page when login to the Azure portal. In some case, there are some resources that you by mistake pin while deploying, and in some case, it is just blank. In this blog post, I would like to share how to build a simple server health dashboard with basic performance data from servers (CPU workload, free disk space, and free memory). To set up this we need to do three main tasks<\/p>\n<ol>\n<li>Connect Data sources to get data into Log Analytics<\/li>\n<li>Configure queries to collect the needed data<\/li>\n<li>Pin dashboard\/view to Azure Dashboard<\/li>\n<\/ol>\n<h4>Connect Data Sources<\/h4>\n<p>If your servers are Azure virtual machines you can read some performance data (see image) direct from the VM using the Azure VM agent, but unfortunately nothing about free memory, CPU or free disk space.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_001.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4426\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_001-261x300.jpg\" alt=\"\" width=\"261\" height=\"300\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_001-261x300.jpg 261w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_001.jpg 282w\" sizes=\"(max-width: 261px) 100vw, 261px\" \/><\/a><\/p>\n<p>To collect the required data we need to install an agent inside the OS. Azure Log Analytic (often called OMS) provides features for collect data and from different sources. Log Analytic also provide features around visualize and analyze the collected data.<\/p>\n<p>In Log Analytics we first need to install the agent on all servers, more information about that <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/log-analytics\/log-analytics-agent-windows\">here<\/a>. Once all servers are connected to the workspace the next step is to start collection performance data. You can enable specific performance counters under Advanced settings \/ Data \/ Windows Performance Counters or Linux Performance Counters. In the image, it is Windows Performance Counters shown, but of course,\u00c2\u00a0you can also do this with Linux Performance Counters too. It is the same steps for Linux servers, install the agent and then enable performance counters.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_002.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4427\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_002-300x152.jpg\" alt=\"\" width=\"300\" height=\"152\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_002-300x152.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_002-768x390.jpg 768w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_002-1024x520.jpg 1024w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_002.jpg 1577w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In this example, we will add the following performance counters, and configure sample interval for every 10 seconds.<\/p>\n<ul>\n<li>Memory(*)\\Available MBytes<\/li>\n<li>LogicalDisk(*)\\Free Megabyte<\/li>\n<li>LogicalDisk(*)\\% Free Space<\/li>\n<li>Processor(_Total)\\% Processor Time<\/li>\n<\/ul>\n<h4>Building Queries<\/h4>\n<p>Next step is to configure queries to visualize the collected data. There are a lot of good information about building queries and working with performance data <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/log-analytics\/log-analytics-search-reference\">here<\/a> and <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/log-analytics\/log-analytics-log-search-transition\">here<\/a>. But to save you some time you can use the following queries as a foundation,<\/p>\n<p>These queries show the average for each minute (1minutes), based on the data we collect every 10 seconds.<\/p>\n<p>Disk, % Free Space. This query will show % free space on each logical disk that has an instance name that contains \u00e2\u20ac\u0153:\u00e2\u20ac\u009d (this filter out, for example, mount points volumes on DPM servers).<\/p>\n<p><em>Perf | where ObjectName == &#8220;LogicalDisk&#8221; and CounterName == &#8220;% Free Space&#8221; | where InstanceName contains &#8220;:&#8221; | summarize FreeSpaceP = avg(CounterValue) by bin(TimeGenerated, 1minutes), CounterPath| sort by TimeGenerated desc | render timechart<\/em><\/p>\n<p>Disk, Free Megabytes<\/p>\n<p><em>Perf | where ObjectName == &#8220;LogicalDisk&#8221; and CounterName == &#8220;Free Megabytes&#8221; | where InstanceName contains &#8220;:&#8221; | summarize FreeSpaceMb = avg(CounterValue) by bin(TimeGenerated, 1minutes), CounterPath| sort by TimeGenerated desc | render timechart<\/em><\/p>\n<p>Memory, Available MBytes<\/p>\n<p><em>Perf | where ( ObjectName == &#8220;Memory&#8221; ) | where ( CounterName == &#8220;Available MBytes&#8221; ) | summarize FreeMemMb = avg(CounterValue) by bin(TimeGenerated, 1minutes), CounterPath| sort by TimeGenerated desc | render timechart<\/em><\/p>\n<p>Processor, % Processor Time<\/p>\n<p><em>Perf | where ( ObjectName == &#8220;Processor&#8221; ) | where ( CounterName == &#8220;% Processor Time&#8221; ) | where ( InstanceName == &#8220;_Total&#8221; ) | summarize CPU= avg(CounterValue) by bin(TimeGenerated, 1minutes), CounterPath| sort by TimeGenerated desc | render timechat<\/em><\/p>\n<p>It can take some time before the first data is collected. If you don\u00e2\u20ac\u2122t see any data when you run the queries, take another cup of coffee and try again a bit later \u00f0\u0178\u02dc\u0160<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_003.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4428\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_003-300x154.jpg\" alt=\"\" width=\"300\" height=\"154\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_003-300x154.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_003-768x395.jpg 768w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_003-1024x526.jpg 1024w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_003.jpg 1508w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Building a view<\/p>\n<p>We now have all data sources connected and queries to visualize the data. The next step is to build views in Log Analytics. This is not requirements to build an Azure Dashboard but is nice to have.<\/p>\n<p>Log Analytics View Design is a feature that we can use to build custom views. These views can later be pinned to the Azure Dashboard.\u00c2\u00a0 To save you some time you can download \u00e2\u20ac\u0153Contoso Example Log Analytics Dashboard\u00e2\u20ac\u009d (<a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Contoso-Servers.zip\">Contoso Servers<\/a>) and import into View Designer.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_004.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4429\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_004-300x154.jpg\" alt=\"\" width=\"300\" height=\"154\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_004-300x154.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_004-768x393.jpg 768w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_004-1024x525.jpg 1024w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_004.jpg 1175w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_005.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4430\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_005-300x138.jpg\" alt=\"\" width=\"300\" height=\"138\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_005-300x138.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_005-768x352.jpg 768w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_005-1024x470.jpg 1024w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_005.jpg 1528w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h4>Pin tiles to the Azure Dashboard &#8211; Log Analytics tile<\/h4>\n<p>There are two ways to pin a tile to the Azure dashboard that we will look at. The first one is to right-click a tile in Log Analytics and select pin to the dashboard. You can see this process in the following two images. On the Azure Dashboard you will see the view tile from the Log Analytics solution, if you click it you will go into Log Analytics and the specific solution. In this example, you can\u00e2\u20ac\u2122t see processor, memory or disk performance direct on the Azure Dashboard.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_006.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4431\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_006-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_006-300x225.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_006.jpg 427w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_007.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4432\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_007-300x162.jpg\" alt=\"\" width=\"300\" height=\"162\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_007-300x162.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_007-768x415.jpg 768w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_007.jpg 785w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h4>Pin tiles to the Azure Dashboard &#8211; Advanced Analytics<\/h4>\n<p>The second alternative is to pin charts directly from the Advanced Analytics portal inside of Log Analytics. The Advanced Analytics feature provides advanced functionality not available in the Log Search portal, for example, Smart Analytics. In Log Analytics, click Analytics, to open up the Advanced Analytics portal. In the advanced analytics portal run the queries from this blog post, and click \u00e2\u20ac\u0153Pin\u00e2\u20ac\u009d on the right side.\u00c2\u00a0Once the different charts\/queries are pinned to the Azure dashboard you can select them, click Edit, and change title and description on them.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_008.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4433\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_008-300x205.jpg\" alt=\"\" width=\"300\" height=\"205\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_008-300x205.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_008-768x526.jpg 768w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_008-1024x701.jpg 1024w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_008.jpg 1778w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_009.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-4425\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_009-300x267.jpg\" alt=\"\" width=\"300\" height=\"267\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_009-300x267.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_009-768x684.jpg 768w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_009-1024x911.jpg 1024w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2018\/02\/Azure_Dashboard_009.jpg 1347w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><span lang=\"EN-US\">Disclaimer: Cloud is very fast-moving target. It means that by the time you\u00e2\u20ac\u2122re reading this post everything described here could have been changed completely.<\/span><span lang=\"EN-US\"><br \/>\nNote that this is provided \u00e2\u20ac\u0153AS-IS\u00e2\u20ac\u009d with no warranties at all. This is not a production ready\u00c2\u00a0solution for your production environment, just an idea and an example.<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I guess all of you have seen the dashboards in Azure, the first page when login to the Azure portal. In some case, there are some resources that you by mistake pin while deploying, and in some case, it is just blank. In this blog post, I would like to share how to build a &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=4423\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":4425,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[64,68],"tags":[],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4423"}],"collection":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4423"}],"version-history":[{"count":3,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4423\/revisions"}],"predecessor-version":[{"id":4437,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4423\/revisions\/4437"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/media\/4425"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4423"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}