Overview
The Azure App Insights tile allows you to query App Insights for data (both stand-alone and in the context of objects within SCOM) and display that information as part of your SquaredUp dashboard.
Using this tile you can unify data held within SCOM and Azure on the same screen to bring all collected monitoring information together into a single pane of glass.
The Azure tile button indicates that there are more tiles available from this one button:
After selecting the Azure tile you will get the choice of App Insights Scalar or App Insights Grid.
Scalar will show a single value:
Grid will show a table of data:
The ability to render information as a graph is a feature of the Azure portal rather than the App Insights Query language itself. At this time any queries run using the render
statement will still return tabular or scalar data rather than graphs, depending on the tile.
Configuring the Azure Log Analytics tile
See How to configure an Azure Application Insights provider
Walkthrough: Create tiles to query data
Now that you have an authorised provider, you can start to create App Insights tiles to perform our queries. It's useful to use the Azure portal to prepare and test your queries first, see the links at the bottom of this article for further information. For this walkthrough, you are going to query response time performance information aggregated into hourly values.
Sample: Query request performance information
- In SquaredUp browse to the dashboard you wish to add the App Insights tile to.
-
Click on the orange + button to add a new tile, then click on Azure > App Insights (Grid)
- The scope section (v4.2 and above) allows you to specify a scope of SCOM objects, which can be used later in the tile configuration to insert SCOM object properties into the query. If you are using v4.2 or above and wish to add a scope, click on group and search to find a suitable group of computers. You need a group that contains servers monitored by Azure App Insights which we can query later. See How to scope tiles on dashboards
- In the provider select the provider you created earlier.
-
On the query panel, enter the following App Insights Query:
requests | summarize percentiles(duration, 50, 90, 95) by bin(timestamp, 1h)
-
If you are using SquaredUp v4.2 and above, you might like to use one of the mustache style code snippets provided. Once you've specified a scope (as described above) then you can either start with one of the snippets provided, or write your own dynamic query string. SquaredUp v4.2 and above support multi-object query building based on a list of objects from the tile's scope, and the use of JavaScript to manipulate the SCOM property values using functions such as
split()
andsubstring()
.When you click the mustache editor button {{}} you will see a list of example scope code snippets, along with the snippet result based on the selected scope context for the tile.
For example, you can add the following JavaScript before the
| summarize
line to filter requests to only those in the scope:| where cloud_RoleInstance in ({{scope.map(item => '\"'+item.displayName+'\"').join(',')}})
To show:
requests | where cloud_RoleInstance in ({{scope.map(item => '\"'+item.displayName+'\"').join(',')}}) | summarize percentiles(duration, 50, 90, 95) by bin(timestamp, 1h)
We're working on a dashboard, but the Azure App Insights tile scope and dynamic queries can be particularly useful on perspectives. For example, you might like to show App Insights information for a dynamic list of servers found as children of an Enterprise Application (EA) object. See Scoping tiles on perspectives
- Leave the timeframe on 24 hours. For other queries, be careful with extending the timeframe beyond 7 days, as this may pull many thousands of log entries and significantly impact browser performance.
- Configure the desired columns on the grid columns panel. As a best practise, once you know which columns you want to display, modify the query to only return those columns (via
project
orproject away
), as it will improve performance when loading and displaying the tile. - You can customise the appearance of columns by clicking the edit link next to it's name in the grid columns panel and then specifying a custom template. For example, locate the timestamp column and set the template to
{{timeago(value)}}
to show a friendly time in the formLast x minutes
rather than the specific time. For more information see How to use the Grid designer when configuring tiles. - Click done.
The App Insights query language (AIQL) is very rich and offers features such as sorting, projection and calculated values, which you can use to control the display of data in your dashboard.
Restricting data to a specific timeframe
By default the tile will not return any entries older than 24 hours. You can use the timeframe panel to control this behaviour and select various values. If you attempt to load a large timeframe that may contain many thousands of records, this may cause significant browser delays. You can also include further timeframe restrictions in your query (such as where timestamp >= ago(2h)
) if you need more granularity, but be aware events must satisfy both where
clauses and the timeframe settings).
Querying multiple (cross-resource) applications
The Azure App Insights API allows you to send a query to multiple apps simultaneously using implicit and explicit cross-resource unions. The App Insights tile supports both mechanisms, with implicit being easier but explicit offering more control over how data is returned. Regardless of which mechanism you use, you may only query across 10 apps with a single cross-resource query (and therefore a single tile), and the provider's configured app is always used.
Identifying resources
In order to specify another application, you will need to specify one of the below identifiers (all are supported):
- Resource name: The human readable name of the resource. If used this must be unique to all Azure subscriptions the provider has access to or the query will fail as ambiguous.
- Qualified name: The "full name" of the application, in the format
<subscriptionName>/<resourceGroup>/<applicationName>
. This may still be ambiguous as subscription names are not unique, but it is extremely unlikely. - Application ID: This is a GUID (e.g.
b438b4f6-912a-46d5-9cb1-b44069212ab4
) and is completely unique and unambiguous. - Azure Resource ID: This is a string in the form
/subscriptions/<subscriptionId>/resourcegroups/<resourceGroup>/providers/microsoft.operationalinsights/applications/<applicationName>
, which whilst unambiguous is extremely long and difficult to work with.
Implicit Unions
When making use of implicit unions, you provide a query to the tile and specify up to 9 other additional app identifiers. The query is automatically sent to the provider's configured app and any others you specify, and the output joined together in a single result for further processing. To configure an implicit cross-resource query:
- In the query panel in the Azure App Insights tile click add under additional applications.
- Enter an identifier for your second app (using any of the formats discussed above) and press enter or deselect the text box.
- Either repeat the process by clicking add again and adding additional apps, or click next and continue to configure the tile.
Explicit Unions
In contrast to implicit unions, explicit unions are specified directly within your query using the Union
statement, and allow you to pull in a specific subset of the data in the other apps. The example below shows results from the provider's app, along with only GET request exceptions from another named contosoretail
:
union exceptions, (app("contosoretail").exceptions | where operation_Name contains "GET" )
| summarize count() by problemId
For further information check out this Azure blog post on Querying across resources.