|
9 | 9 | "x": 0, |
10 | 10 | "y": 0, |
11 | 11 | "colSpan": 3, |
12 | | - "rowSpan": 4 |
| 12 | + "rowSpan": 5 |
13 | 13 | }, |
14 | 14 | "metadata": { |
15 | 15 | "inputs": [ |
|
44 | 44 | }, |
45 | 45 | { |
46 | 46 | "name": "query", |
47 | | - "value": "// Count of all resources\nresources\n| where type == \"microsoft.azurearcdata/sqlserverinstances\"\n| summarize Servers=count()\n", |
| 47 | + "value": "// Count of all resources\nresources\n| where type == \"microsoft.sql/managedinstances\" or \n type == \"microsoft.azurearcdata/sqlserverinstances\" or \n type == \"microsoft.sql/servers\"\n| summarize Servers=count()\n", |
48 | 48 | "isOptional": true |
49 | 49 | } |
50 | 50 | ], |
|
60 | 60 | "position": { |
61 | 61 | "x": 3, |
62 | 62 | "y": 0, |
| 63 | + "colSpan": 6, |
| 64 | + "rowSpan": 5 |
| 65 | + }, |
| 66 | + "metadata": { |
| 67 | + "inputs": [ |
| 68 | + { |
| 69 | + "name": "isShared", |
| 70 | + "isOptional": true |
| 71 | + }, |
| 72 | + { |
| 73 | + "name": "queryId", |
| 74 | + "isOptional": true |
| 75 | + }, |
| 76 | + { |
| 77 | + "name": "formatResults", |
| 78 | + "isOptional": true |
| 79 | + }, |
| 80 | + { |
| 81 | + "name": "partTitle", |
| 82 | + "value": "Query 1", |
| 83 | + "isOptional": true |
| 84 | + }, |
| 85 | + { |
| 86 | + "name": "query", |
| 87 | + "value": "resources\n| where type == \"microsoft.sql/managedinstances\" or \n type == \"microsoft.azurearcdata/sqlserverinstances\" or \n type == \"microsoft.sql/servers\"\n| summarize ResourceCount=count() by iff( type==\"microsoft.sql/managedinstances\",\"Azure SQL Manage Instance\"\n,iif(type==\"microsoft.azurearcdata/sqlserverinstances\",\"Arc Enable SQL Server\",iif(type==\"microsoft.sql/servers\",\"Azure SQL Server On VM\",\"Azure SQL DB\")))\n", |
| 88 | + "isOptional": true |
| 89 | + }, |
| 90 | + { |
| 91 | + "name": "chartType", |
| 92 | + "value": 2, |
| 93 | + "isOptional": true |
| 94 | + }, |
| 95 | + { |
| 96 | + "name": "queryScope", |
| 97 | + "value": { |
| 98 | + "scope": 0, |
| 99 | + "values": [] |
| 100 | + }, |
| 101 | + "isOptional": true |
| 102 | + } |
| 103 | + ], |
| 104 | + "type": "Extension/HubsExtension/PartType/ArgQueryChartTile", |
| 105 | + "settings": {}, |
| 106 | + "partHeader": { |
| 107 | + "title": "Sql Server Type Distributions", |
| 108 | + "subtitle": "" |
| 109 | + } |
| 110 | + } |
| 111 | + }, |
| 112 | + "2": { |
| 113 | + "position": { |
| 114 | + "x": 9, |
| 115 | + "y": 0, |
63 | 116 | "colSpan": 3, |
64 | | - "rowSpan": 4 |
| 117 | + "rowSpan": 5 |
65 | 118 | }, |
66 | 119 | "metadata": { |
67 | 120 | "inputs": [ |
|
86 | 139 | "value": "Query 1", |
87 | 140 | "isOptional": true |
88 | 141 | }, |
| 142 | + { |
| 143 | + "name": "queryScope", |
| 144 | + "value": { |
| 145 | + "scope": 0, |
| 146 | + "values": [] |
| 147 | + }, |
| 148 | + "isOptional": true |
| 149 | + }, |
89 | 150 | { |
90 | 151 | "name": "query", |
91 | | - "value": "// Count of all resources\nresources\n| where type == \"microsoft.azurearcdata/sqlserverinstances/databases\"\n| count ", |
| 152 | + "value": "// Count of all resources\nresources\n| where type == \"microsoft.sql/managedinstances/databases\" or \n type == \"microsoft.azurearcdata/sqlserverinstances/databases\" or \n type == \"microsoft.sql/servers/databases\"\n| count ", |
| 153 | + "isOptional": true |
| 154 | + } |
| 155 | + ], |
| 156 | + "type": "Extension/HubsExtension/PartType/ArgQuerySingleValueTile", |
| 157 | + "settings": {}, |
| 158 | + "partHeader": { |
| 159 | + "title": "Number of Databases", |
| 160 | + "subtitle": "" |
| 161 | + } |
| 162 | + } |
| 163 | + }, |
| 164 | + "3": { |
| 165 | + "position": { |
| 166 | + "x": 12, |
| 167 | + "y": 0, |
| 168 | + "colSpan": 7, |
| 169 | + "rowSpan": 5 |
| 170 | + }, |
| 171 | + "metadata": { |
| 172 | + "inputs": [ |
| 173 | + { |
| 174 | + "name": "isShared", |
| 175 | + "isOptional": true |
| 176 | + }, |
| 177 | + { |
| 178 | + "name": "queryId", |
| 179 | + "isOptional": true |
| 180 | + }, |
| 181 | + { |
| 182 | + "name": "formatResults", |
| 183 | + "isOptional": true |
| 184 | + }, |
| 185 | + { |
| 186 | + "name": "partTitle", |
| 187 | + "value": "Query 1", |
| 188 | + "isOptional": true |
| 189 | + }, |
| 190 | + { |
| 191 | + "name": "chartType", |
| 192 | + "value": 2, |
92 | 193 | "isOptional": true |
93 | 194 | }, |
94 | 195 | { |
|
98 | 199 | "values": [] |
99 | 200 | }, |
100 | 201 | "isOptional": true |
| 202 | + }, |
| 203 | + { |
| 204 | + "name": "query", |
| 205 | + "value": "// top ten resource types by number of resources\n// Count of all resources\nresources\n| where type == \"microsoft.sql/managedinstances/databases\" or \n type == \"microsoft.azurearcdata/sqlserverinstances/databases\" or \n type == \"microsoft.sql/servers/databases\"\n| summarize ResourceCount=count() by iff( type==\"microsoft.sql/managedinstances/databases\",\"Azure SQL Manage Instance/databases\"\n,iif(type==\"microsoft.azurearcdata/sqlserverinstances/databases\",\"Arc Enable SQL Server\",iif(type==\"microsoft.sql/servers\",\"Azure SQL Server On VM\",\"Azure SQL DB\")))", |
| 206 | + "isOptional": true |
101 | 207 | } |
102 | 208 | ], |
103 | | - "type": "Extension/HubsExtension/PartType/ArgQuerySingleValueTile", |
| 209 | + "type": "Extension/HubsExtension/PartType/ArgQueryChartTile", |
104 | 210 | "settings": {}, |
105 | 211 | "partHeader": { |
106 | | - "title": "Number of Databases", |
| 212 | + "title": "Databases per Type", |
107 | 213 | "subtitle": "" |
108 | 214 | } |
109 | 215 | } |
110 | 216 | }, |
111 | | - "2": { |
| 217 | + "4": { |
112 | 218 | "position": { |
113 | | - "x": 6, |
114 | | - "y": 0, |
115 | | - "colSpan": 14, |
| 219 | + "x": 0, |
| 220 | + "y": 5, |
| 221 | + "colSpan": 19, |
116 | 222 | "rowSpan": 4 |
117 | 223 | }, |
118 | 224 | "metadata": { |
|
148 | 254 | }, |
149 | 255 | { |
150 | 256 | "name": "query", |
151 | | - "value": "resources\r\n| where type == \"microsoft.azurearcdata/sqlserverinstances/databases\"\r\n| summarize Dbs=count(),Offline=sum(toint(iif(tostring(properties[\"state\"])!=\"Online\",1,0)))\r\n,SizeMB=sum(toint(iif(tostring(properties[\"sizeMB\"])!=\"\",properties[\"sizeMB\"],0))) by Instances = tostring(split(tostring(id),\"/\")[8])\r\n| order by Offline", |
| 257 | + "value": "resources\r\n| where type == \"microsoft.sql/managedinstances/databases\" or \r\n type == \"microsoft.azurearcdata/sqlserverinstances/databases\" or \r\n type == \"microsoft.sql/servers/databases\"\r\n| summarize Dbs=count(),Offline=sum(toint(iif(tostring(properties[\"state\"])!=\"Online\",1,0)))\r\n,SizeMB=sum(toint(iif(tostring(properties[\"sizeMB\"])!=\"\",properties[\"sizeMB\"],0)))\r\n,Type=max(iff( type==\"microsoft.sql/managedinstances/databases\",\"Azure SQL Manage Instance\"\r\n,iif(type==\"microsoft.azurearcdata/sqlserverinstances/databases\",\"Arc Enable SQL Server\",iif(type==\"microsoft.sql/servers/databases\",\"Azure SQL Server On VM\",\"Azure SQL DB\")))) by Instances = tostring(split(tostring(id),\"/\")[8])\r\n| order by Offline", |
152 | 258 | "isOptional": true |
153 | 259 | } |
154 | 260 | ], |
|
160 | 266 | } |
161 | 267 | } |
162 | 268 | }, |
163 | | - "3": { |
| 269 | + "5": { |
164 | 270 | "position": { |
165 | 271 | "x": 0, |
166 | | - "y": 4, |
| 272 | + "y": 9, |
167 | 273 | "colSpan": 6, |
168 | 274 | "rowSpan": 6 |
169 | 275 | }, |
|
201 | 307 | }, |
202 | 308 | { |
203 | 309 | "name": "query", |
204 | | - "value": "// If distinct count is small (e.g. < 1000)\n// run next query to get count of each value\nresources\n| where ['type'] == \"microsoft.azurearcdata/sqlserverinstances\"\n| summarize Count=count() by tostring(properties['edition'])\n| order by Count desc", |
| 310 | + "value": "// If distinct count is small (e.g. < 1000)\n// run next query to get count of each value\nresources\n| where type == \"microsoft.sql/managedinstances\" or \n type == \"microsoft.azurearcdata/sqlserverinstances\" or \n type == \"microsoft.sqlvirtualmachine/sqlvirtualmachines\"\n| summarize Count=count() by iif(type==\"microsoft.azurearcdata/sqlserverinstances\"\n,tostring(properties['edition'])\n, iif(type==\"microsoft.sql/managedinstances\", tostring(sku['tier'])\n,tostring(properties['sqlImageSku'])))\n| order by Count desc", |
205 | 311 | "isOptional": true |
206 | 312 | } |
207 | 313 | ], |
|
213 | 319 | } |
214 | 320 | } |
215 | 321 | }, |
216 | | - "4": { |
| 322 | + "6": { |
217 | 323 | "position": { |
218 | 324 | "x": 6, |
219 | | - "y": 4, |
220 | | - "colSpan": 8, |
| 325 | + "y": 9, |
| 326 | + "colSpan": 7, |
221 | 327 | "rowSpan": 6 |
222 | 328 | }, |
223 | 329 | "metadata": { |
|
266 | 372 | } |
267 | 373 | } |
268 | 374 | }, |
269 | | - "5": { |
| 375 | + "7": { |
270 | 376 | "position": { |
271 | | - "x": 14, |
272 | | - "y": 4, |
| 377 | + "x": 13, |
| 378 | + "y": 9, |
273 | 379 | "colSpan": 6, |
274 | 380 | "rowSpan": 6 |
275 | 381 | }, |
|
319 | 425 | } |
320 | 426 | } |
321 | 427 | }, |
322 | | - "6": { |
| 428 | + "8": { |
323 | 429 | "position": { |
324 | 430 | "x": 0, |
325 | | - "y": 10, |
| 431 | + "y": 15, |
326 | 432 | "colSpan": 6, |
327 | 433 | "rowSpan": 6 |
328 | 434 | }, |
|
372 | 478 | } |
373 | 479 | } |
374 | 480 | }, |
375 | | - "7": { |
| 481 | + "9": { |
376 | 482 | "position": { |
377 | 483 | "x": 6, |
378 | | - "y": 10, |
| 484 | + "y": 15, |
379 | 485 | "colSpan": 6, |
380 | 486 | "rowSpan": 6 |
381 | 487 | }, |
|
425 | 531 | } |
426 | 532 | } |
427 | 533 | }, |
428 | | - "8": { |
| 534 | + "10": { |
429 | 535 | "position": { |
430 | 536 | "x": 12, |
431 | | - "y": 10, |
432 | | - "colSpan": 8, |
| 537 | + "y": 15, |
| 538 | + "colSpan": 7, |
433 | 539 | "rowSpan": 6 |
434 | 540 | }, |
435 | 541 | "metadata": { |
|
477 | 583 | "subtitle": "" |
478 | 584 | } |
479 | 585 | } |
| 586 | + }, |
| 587 | + "11": { |
| 588 | + "position": { |
| 589 | + "x": 0, |
| 590 | + "y": 21, |
| 591 | + "colSpan": 6, |
| 592 | + "rowSpan": 5 |
| 593 | + }, |
| 594 | + "metadata": { |
| 595 | + "inputs": [ |
| 596 | + { |
| 597 | + "name": "isShared", |
| 598 | + "isOptional": true |
| 599 | + }, |
| 600 | + { |
| 601 | + "name": "queryId", |
| 602 | + "isOptional": true |
| 603 | + }, |
| 604 | + { |
| 605 | + "name": "formatResults", |
| 606 | + "isOptional": true |
| 607 | + }, |
| 608 | + { |
| 609 | + "name": "partTitle", |
| 610 | + "value": "Query 1", |
| 611 | + "isOptional": true |
| 612 | + }, |
| 613 | + { |
| 614 | + "name": "query", |
| 615 | + "value": "resources\n| where type == \"microsoft.azurearcdata/sqlserverinstances/databases\"\n| where name != \"tempdb\"\n| extend prop_db=parse_xml(properties) \n| extend prop_db_recoveryMode = prop_db.recoveryMode\n| extend prop_db_databaseCreationDate = todatetime(prop_db.databaseCreationDate)\n| extend prop_db_backupInformation = prop_db.backupInformation\n| extend prop_db_backupInformation_lastFullBackup = todatetime(prop_db.backupInformation.lastFullBackup)\n| extend calc_lastBackupAgeDays = iff(isnull(prop_db_backupInformation_lastFullBackup),\n datetime_diff('Day',now(),prop_db_databaseCreationDate),\n datetime_diff('Day',now(),prop_db_backupInformation_lastFullBackup)\n )\n| extend Backup_1day = iif( calc_lastBackupAgeDays <=1 , 1 , 0)\n| extend Backup_7day = iif( calc_lastBackupAgeDays >1 and calc_lastBackupAgeDays <=7 , 1 , 0)\n| extend Backup_over7day = iif( calc_lastBackupAgeDays >7 , 1 , 0)\n| extend Backup_desc = case(\n isnull(prop_db_backupInformation_lastFullBackup), \"no backups at all\", \n datetime_diff('Day',now(),prop_db_backupInformation_lastFullBackup) <= 1, \"1 day\", \n datetime_diff('Day',now(),prop_db_backupInformation_lastFullBackup) <= 7, \"7 days\", \n datetime_diff('Day',now(),prop_db_backupInformation_lastFullBackup) <= 30, \"1 Month\", \n \"older than a month\")\n| project database_name = name, RecoveryModel = prop_db_recoveryMode, Last_Full_Backup = prop_db_backupInformation_lastFullBackup , Backup_Age_Days = calc_lastBackupAgeDays ,Backup_1day ,Backup_7day ,Backup_over7day, Backup_desc\n| summarize Count=count() by Backup_desc", |
| 616 | + "isOptional": true |
| 617 | + }, |
| 618 | + { |
| 619 | + "name": "queryScope", |
| 620 | + "value": { |
| 621 | + "scope": 0, |
| 622 | + "values": [] |
| 623 | + }, |
| 624 | + "isOptional": true |
| 625 | + }, |
| 626 | + { |
| 627 | + "name": "chartType", |
| 628 | + "value": 2, |
| 629 | + "isOptional": true |
| 630 | + } |
| 631 | + ], |
| 632 | + "type": "Extension/HubsExtension/PartType/ArgQueryChartTile", |
| 633 | + "settings": {}, |
| 634 | + "partHeader": { |
| 635 | + "title": "SQL Server Backups Intervals", |
| 636 | + "subtitle": "" |
| 637 | + } |
| 638 | + } |
| 639 | + }, |
| 640 | + "12": { |
| 641 | + "position": { |
| 642 | + "x": 6, |
| 643 | + "y": 21, |
| 644 | + "colSpan": 6, |
| 645 | + "rowSpan": 5 |
| 646 | + }, |
| 647 | + "metadata": { |
| 648 | + "inputs": [ |
| 649 | + { |
| 650 | + "name": "isShared", |
| 651 | + "isOptional": true |
| 652 | + }, |
| 653 | + { |
| 654 | + "name": "queryId", |
| 655 | + "isOptional": true |
| 656 | + }, |
| 657 | + { |
| 658 | + "name": "formatResults", |
| 659 | + "isOptional": true |
| 660 | + }, |
| 661 | + { |
| 662 | + "name": "partTitle", |
| 663 | + "value": "Query 1", |
| 664 | + "isOptional": true |
| 665 | + }, |
| 666 | + { |
| 667 | + "name": "query", |
| 668 | + "value": "resources\n| where type == \"microsoft.azurearcdata/sqlserverinstances/databases\"\n| where name != \"tempdb\"\n| where name != \"model\"\n| where name != \"master\"\n| where name != \"msdb\"\n| extend prop_db=parse_xml(properties) \n| extend Recovery_Model = prop_db.recoveryMode\n| summarize Count = count() by tostring(Recovery_Model)", |
| 669 | + "isOptional": true |
| 670 | + }, |
| 671 | + { |
| 672 | + "name": "chartType", |
| 673 | + "value": 2, |
| 674 | + "isOptional": true |
| 675 | + }, |
| 676 | + { |
| 677 | + "name": "queryScope", |
| 678 | + "value": { |
| 679 | + "scope": 0, |
| 680 | + "values": [] |
| 681 | + }, |
| 682 | + "isOptional": true |
| 683 | + } |
| 684 | + ], |
| 685 | + "type": "Extension/HubsExtension/PartType/ArgQueryChartTile", |
| 686 | + "settings": {}, |
| 687 | + "partHeader": { |
| 688 | + "title": "SQL Server Recovery Mode", |
| 689 | + "subtitle": "" |
| 690 | + } |
| 691 | + } |
480 | 692 | } |
481 | 693 | } |
482 | 694 | } |
|
0 commit comments