Skip to content

Commit 9dc07a7

Browse files
authored
Merge pull request #1151 from rodrigomonteiro-gbb/master
Adding new Tiles to the Dashboard
2 parents cade208 + a2a9cd2 commit 9dc07a7

File tree

1 file changed

+239
-27
lines changed

1 file changed

+239
-27
lines changed

samples/features/azure-arc/dashboard/SQL Server Instances.json

Lines changed: 239 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"x": 0,
1010
"y": 0,
1111
"colSpan": 3,
12-
"rowSpan": 4
12+
"rowSpan": 5
1313
},
1414
"metadata": {
1515
"inputs": [
@@ -44,7 +44,7 @@
4444
},
4545
{
4646
"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",
4848
"isOptional": true
4949
}
5050
],
@@ -60,8 +60,61 @@
6060
"position": {
6161
"x": 3,
6262
"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,
63116
"colSpan": 3,
64-
"rowSpan": 4
117+
"rowSpan": 5
65118
},
66119
"metadata": {
67120
"inputs": [
@@ -86,9 +139,57 @@
86139
"value": "Query 1",
87140
"isOptional": true
88141
},
142+
{
143+
"name": "queryScope",
144+
"value": {
145+
"scope": 0,
146+
"values": []
147+
},
148+
"isOptional": true
149+
},
89150
{
90151
"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,
92193
"isOptional": true
93194
},
94195
{
@@ -98,21 +199,26 @@
98199
"values": []
99200
},
100201
"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
101207
}
102208
],
103-
"type": "Extension/HubsExtension/PartType/ArgQuerySingleValueTile",
209+
"type": "Extension/HubsExtension/PartType/ArgQueryChartTile",
104210
"settings": {},
105211
"partHeader": {
106-
"title": "Number of Databases",
212+
"title": "Databases per Type",
107213
"subtitle": ""
108214
}
109215
}
110216
},
111-
"2": {
217+
"4": {
112218
"position": {
113-
"x": 6,
114-
"y": 0,
115-
"colSpan": 14,
219+
"x": 0,
220+
"y": 5,
221+
"colSpan": 19,
116222
"rowSpan": 4
117223
},
118224
"metadata": {
@@ -148,7 +254,7 @@
148254
},
149255
{
150256
"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",
152258
"isOptional": true
153259
}
154260
],
@@ -160,10 +266,10 @@
160266
}
161267
}
162268
},
163-
"3": {
269+
"5": {
164270
"position": {
165271
"x": 0,
166-
"y": 4,
272+
"y": 9,
167273
"colSpan": 6,
168274
"rowSpan": 6
169275
},
@@ -201,7 +307,7 @@
201307
},
202308
{
203309
"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",
205311
"isOptional": true
206312
}
207313
],
@@ -213,11 +319,11 @@
213319
}
214320
}
215321
},
216-
"4": {
322+
"6": {
217323
"position": {
218324
"x": 6,
219-
"y": 4,
220-
"colSpan": 8,
325+
"y": 9,
326+
"colSpan": 7,
221327
"rowSpan": 6
222328
},
223329
"metadata": {
@@ -266,10 +372,10 @@
266372
}
267373
}
268374
},
269-
"5": {
375+
"7": {
270376
"position": {
271-
"x": 14,
272-
"y": 4,
377+
"x": 13,
378+
"y": 9,
273379
"colSpan": 6,
274380
"rowSpan": 6
275381
},
@@ -319,10 +425,10 @@
319425
}
320426
}
321427
},
322-
"6": {
428+
"8": {
323429
"position": {
324430
"x": 0,
325-
"y": 10,
431+
"y": 15,
326432
"colSpan": 6,
327433
"rowSpan": 6
328434
},
@@ -372,10 +478,10 @@
372478
}
373479
}
374480
},
375-
"7": {
481+
"9": {
376482
"position": {
377483
"x": 6,
378-
"y": 10,
484+
"y": 15,
379485
"colSpan": 6,
380486
"rowSpan": 6
381487
},
@@ -425,11 +531,11 @@
425531
}
426532
}
427533
},
428-
"8": {
534+
"10": {
429535
"position": {
430536
"x": 12,
431-
"y": 10,
432-
"colSpan": 8,
537+
"y": 15,
538+
"colSpan": 7,
433539
"rowSpan": 6
434540
},
435541
"metadata": {
@@ -477,6 +583,112 @@
477583
"subtitle": ""
478584
}
479585
}
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+
}
480692
}
481693
}
482694
}

0 commit comments

Comments
 (0)