From ed1950eb3e1c823ee731d34dcbbf0929b73dc565 Mon Sep 17 00:00:00 2001 From: WKahnZA <50588165+WKahnZA@users.noreply.github.com> Date: Tue, 5 Nov 2019 09:07:18 +0200 Subject: [PATCH 1/3] Create tmp.tmp --- Workbooks/Virtual Machines/Availability/tmp.tmp | 1 + 1 file changed, 1 insertion(+) create mode 100644 Workbooks/Virtual Machines/Availability/tmp.tmp diff --git a/Workbooks/Virtual Machines/Availability/tmp.tmp b/Workbooks/Virtual Machines/Availability/tmp.tmp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Workbooks/Virtual Machines/Availability/tmp.tmp @@ -0,0 +1 @@ + From ba4512699ead413344d589ce0ef7c74399b860c2 Mon Sep 17 00:00:00 2001 From: WKahnZA <50588165+WKahnZA@users.noreply.github.com> Date: Tue, 5 Nov 2019 09:07:36 +0200 Subject: [PATCH 2/3] Add files via upload --- .../Availability/server availability.workbook | 258 ++++++++++++++++++ .../Availability/settings.json | 8 + 2 files changed, 266 insertions(+) create mode 100644 Workbooks/Virtual Machines/Availability/server availability.workbook create mode 100644 Workbooks/Virtual Machines/Availability/settings.json diff --git a/Workbooks/Virtual Machines/Availability/server availability.workbook b/Workbooks/Virtual Machines/Availability/server availability.workbook new file mode 100644 index 0000000..fc845c7 --- /dev/null +++ b/Workbooks/Virtual Machines/Availability/server availability.workbook @@ -0,0 +1,258 @@ +{ + "version": "Notebook/1.0", + "items": [ + { + "type": 1, + "content": { + "json": "# Server Availability\r\n\r\n\r\n
" + }, + "name": "text - 2" + }, + { + "type": 9, + "content": { + "version": "KqlParameterItem/1.0", + "crossComponentResources": [ + "{Subscription}" + ], + "parameters": [ + { + "id": "ff24505c-2099-43a4-a8a3-3456bed78eb5", + "version": "KqlParameterItem/1.0", + "name": "TimeRange", + "type": 4, + "isRequired": true, + "value": { + "durationMs": 604800000 + }, + "typeSettings": { + "selectableValues": [ + { + "durationMs": 3600000 + }, + { + "durationMs": 14400000 + }, + { + "durationMs": 43200000 + }, + { + "durationMs": 86400000 + }, + { + "durationMs": 172800000 + }, + { + "durationMs": 259200000 + }, + { + "durationMs": 604800000 + }, + { + "durationMs": 1209600000 + }, + { + "durationMs": 2419200000 + }, + { + "durationMs": 2592000000 + }, + { + "durationMs": 5184000000 + }, + { + "durationMs": 7776000000 + } + ] + } + }, + { + "id": "bfe50469-7469-4c4d-a33e-0edbb43546c4", + "version": "KqlParameterItem/1.0", + "name": "Subscription", + "type": 6, + "isRequired": true, + "multiSelect": true, + "quote": "'", + "delimiter": ",", + "value": [ + "/subscriptions/64f9887b-aa93-4bc9-a8d7-56033998b7b1" + ], + "typeSettings": { + "additionalResourceOptions": [ + "value::all" + ], + "includeAll": true + } + }, + { + "id": "fb861784-4609-49f2-9f58-427fcc547677", + "version": "KqlParameterItem/1.0", + "name": "Workspace", + "type": 5, + "isRequired": true, + "multiSelect": true, + "quote": "'", + "delimiter": ",", + "query": "where type =~ 'microsoft.operationalinsights/workspaces'\r\n| order by name asc\r\n| summarize Selected = makelist(id, 10), All = makelist(id, 1000)\r\n| mvexpand All limit 200\r\n| project value = tostring(All), label = tostring(All), selected = iff(Selected contains All, true, false)", + "crossComponentResources": [ + "{Subscription}" + ], + "typeSettings": { + "resourceTypeFilter": { + "microsoft.operationalinsights/workspaces": true + }, + "additionalResourceOptions": [ + "value::all" + ] + }, + "timeContext": { + "durationMs": 0 + }, + "timeContextFromParameter": "TimeRange", + "queryType": 1, + "resourceType": "microsoft.resourcegraph/resources" + }, + { + "id": "b2627475-cef7-4e91-97b9-b70bf00164e6", + "version": "KqlParameterItem/1.0", + "name": "Servers", + "type": 2, + "isRequired": true, + "multiSelect": true, + "quote": "'", + "delimiter": ",", + "query": "Heartbeat\r\n| distinct Computer\r\n| order by Computer asc", + "crossComponentResources": [ + "{Workspace}" + ], + "value": [ + "adVM.Cloudwise.co.za", + "ULabDC.ulab.local" + ], + "typeSettings": { + "additionalResourceOptions": [ + "value::all" + ] + }, + "timeContext": { + "durationMs": 0 + }, + "timeContextFromParameter": "TimeRange", + "queryType": 0, + "resourceType": "microsoft.operationalinsights/workspaces" + } + ], + "style": "pills", + "queryType": 1, + "resourceType": "microsoft.resourcegraph/resources" + }, + "name": "parameters - 1" + }, + { + "type": 1, + "content": { + "json": "### This Workbook calculates availability of VM's based on the specified time period." + }, + "name": "text - 3" + }, + { + "type": 3, + "content": { + "version": "KqlItem/1.0", + "query": "let timeRangeStart = {TimeRange:start};\r\nlet timeRangeEnd = {TimeRange:end};\r\nHeartbeat\r\n| where TimeGenerated > timeRangeStart and TimeGenerated < timeRangeEnd and Computer in ({Servers})\r\n| summarize heartbeat_per_hour=count() by bin_at(TimeGenerated, 1h, timeRangeStart), Computer\r\n| extend available_per_hour=iff(heartbeat_per_hour>0, true, false)\r\n| summarize total_available_hours=countif(available_per_hour==true) by Computer \r\n| extend total_number_of_buckets=round((timeRangeEnd-timeRangeStart)/1h)\r\n| extend availability_rate=total_available_hours*100/total_number_of_buckets\r\n| order by availability_rate asc", + "size": 0, + "timeContext": { + "durationMs": 0 + }, + "timeContextFromParameter": "TimeRange", + "exportToExcelOptions": "visible", + "queryType": 0, + "resourceType": "microsoft.operationalinsights/workspaces", + "crossComponentResources": [ + "{Workspace}" + ], + "gridSettings": { + "formatters": [ + { + "columnMatch": "Computer", + "formatter": 0, + "formatOptions": { + "showIcon": true + } + }, + { + "columnMatch": "total_available_hours", + "formatter": 0, + "formatOptions": { + "showIcon": true + } + }, + { + "columnMatch": "total_number_of_buckets", + "formatter": 0, + "formatOptions": { + "showIcon": true + } + }, + { + "columnMatch": "availability_rate", + "formatter": 3, + "formatOptions": { + "min": 0, + "max": 100, + "palette": "redGreen", + "showIcon": true + }, + "numberFormat": { + "unit": 1, + "options": { + "style": "decimal" + } + } + }, + { + "columnMatch": "number_of_buckets", + "formatter": 0, + "formatOptions": { + "showIcon": true + } + } + ], + "sortBy": [ + { + "itemKey": "$gen_bar_availability_rate_3", + "sortOrder": 1 + } + ], + "labelSettings": [ + { + "columnId": "Computer" + }, + { + "columnId": "total_available_hours", + "label": "Total Available Hours" + }, + { + "columnId": "total_number_of_buckets", + "label": "Total Hours" + }, + { + "columnId": "availability_rate", + "label": "Availability %" + } + ] + }, + "sortBy": [ + { + "itemKey": "$gen_bar_availability_rate_3", + "sortOrder": 1 + } + ] + }, + "name": "query - 0" + } + ], + "styleSettings": {}, + "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" +} \ No newline at end of file diff --git a/Workbooks/Virtual Machines/Availability/settings.json b/Workbooks/Virtual Machines/Availability/settings.json new file mode 100644 index 0000000..6f2994e --- /dev/null +++ b/Workbooks/Virtual Machines/Availability/settings.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/settings.json", + "name":"Availability", + "author": "Microsoft", + "galleries": [ + { "type": "workbook", "resourceType": "Azure Monitor", "categoryKey": "azureMonitorVirtualMachines", "order": 300 } + ] +} \ No newline at end of file From 5bfa08b2d0144e6c39260b1777563f6dbc3c7cb1 Mon Sep 17 00:00:00 2001 From: WKahnZA <50588165+WKahnZA@users.noreply.github.com> Date: Tue, 5 Nov 2019 09:08:31 +0200 Subject: [PATCH 3/3] Delete tmp.tmp --- Workbooks/Virtual Machines/Availability/tmp.tmp | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Workbooks/Virtual Machines/Availability/tmp.tmp diff --git a/Workbooks/Virtual Machines/Availability/tmp.tmp b/Workbooks/Virtual Machines/Availability/tmp.tmp deleted file mode 100644 index 8b13789..0000000 --- a/Workbooks/Virtual Machines/Availability/tmp.tmp +++ /dev/null @@ -1 +0,0 @@ -