How to use custom labeling

Overview

Some of the most commonly used tiles in dashboards and perspectives display information from SCOM objects. These tiles work extremely well most of the time, but in some cases you need to customize the labels before you can understand which SCOM object you are looking at.

For example, below is a Status tile configured to show all disks on a group of servers:

Disks shown for a group of servers

Without drilling down it’s difficult to know which disk belongs to which server.

Custom labeling allows us to specify exactly how we want objects to be displayed (using both static text and dynamic properties from the object) to ensure that the tile always makes sense.

Disks shown for a group of servers with custom labels

Custom labeling requires Squared Up v3.1 or later.

You may also like to take a look at the Squared Up webinar ‘Custom Labelling’:

Supported tiles

Tiles that support custom labels come preconfigured with some useful labels and, in the case of Performance tiles, will even attempt to automatically select the most useful label based on the selected object and metric. You can however choose the custom option which will allow you to precisely control the label.

The following tiles support changing the labels of SCOM objects:

  • Status
  • Performance (Bar, Line graph, Sparklines)
  • Image
  • SLA
  • SQL (Grid)
  • Data On-Demand Task (Grid)
  • Web API (Grid)
  • OMS (Grid)

You can configure a custom label by configuring the labels panel when creating or editing a supported tile. Below are some examples of using both a predefined and custom label.

Display logical disks using a predefined format

One way to quickly fix the issue we saw at the start of this article is to use a predefined label that uses a name (path) format.

  1. Create a Status tile.

  2. On the scope panel select advanced and enter Logical Disk (Server) as the class.

  3. Click next until you are on the labels panel.

  4. Click on name (path).

  5. Click on done.

We can now see exactly which server each disk is associated with.

Disks shown for a group of servers with predefined label

Display logical disks with a custom label

In some layouts you may wish to simplify the labeling further, by removing the FQDN for example, and this is where using a custom label can be useful.

Using the custom option we can create our own advanced label that only uses the hostname. Custom labels use Mustache syntax to insert values from the SCOM object.

If you’re familiar with mustache, you can specify advanced labels that can transform properties prior to displaying them (such as showing only a portion of text, converting a number or reformatting a date).

The mustache helper

When specifying a mustache for a custom label, clicking the {{}} button or typing {{ brings up a helpful picker which shows all the properties of your selected objects, along with sample values.

Mustache helper displayed for disk properties

Once the mustache helper is displayed, the list of properties will automatically filter based on what you type, allowing you to quickly find a property using a partial name or likely term. Clicking an item in the list will automatically insert that property into your label and complete the mustache.

Property names are case-sensitive and should be written as they appear in the mustache helper (e.g. displayName not DisplayName).

Procedure

  1. Create a Status tile.

  2. On the scope panel select advanced and enter Logical Disk (Server) as the class.

  3. Click next until you are on the labels panel.

  4. Click on custom.

  5. Enter {{displayName}} ({{ path.split('.')[0] }}) for the label template.

  6. Click on done.

Disks shown for a group of servers with custom label

The mustache here uses the javascript split method to separate the FQDN into substrings at each ., and then accesses the first result (the hostname) using [0]

Display CPU usage for servers with a custom label

Performance tiles expose slightly different values for use in custom labels, as they access performance metrics rather than SCOM objects. This can be helpful if you want to include the timestamp or most recent value in the label.

In order to display just the hostname for a windows server metric, we’ll need to use either key.managedEntityPath or key.managedEntityName depending on whether the metric is available directly on the server or is hosted on a child class (such as Operating System).

Procedure

  1. Create a Performance (Sparklines) tile.

  2. On the scope panel select group and specify All Windows Computers. Click next.

  3. On the metric panel enter Processor Information - % Processor Time.

  4. Click next until you are on the labels panel.

  5. Click custom and enter {{ key.managedEntityPath.toUpperCase().split('.')[0] }} for the label template.

This will now display all servers as hostnames only, with all servers consistently showing as upper case.

Sample custom labels

Below are some sample mustaches you can use in custom labels. The table may wrap longer examples, but all mustaches below are a single line.

Status, Image, and SLA tiles

Scope Mustache Result Comment
Logical Disk (Server) {{ displayName }} ({{ path.split('.')[0] }}) C: (SQUP-OPP-WEB01) Displays disks with the server hostname
SQL Database {{ properties.instanceName }}\\{{ displayName }} MSSQLSERVER\Master Displays the database as instance\name
IIS Application Pool {{ displayName }} (running as {{ properties.applicationPoolIdentity }}) SquaredUpv3 (running as sales\svc_squp) Displays the pool name and identity
All Windows Computers {{#if /10\.0\.(\d{1,3}.?){2}/.test(properties.ipAddress) }} [Azure] {{else}} [Marlow] {{/if}} {{properties.netbiosComputerName}} [Azure] SQUP-OPP-WEB01 Displays servers with a tag denoting location by using a Regular Expression on the IP addresses
All Windows Computers {{timeago(stateLastModified, true)}} September 12th 2017, 11:10:48 am This takes the time the health state last changed and converts the Unix timestamp to show a readable date and time. Set to false to show a friendly time such as 5 minutes ago.
All Windows Computers {{displayName.split('.')[0]}} SQUP-OPP-WEB01 Show a machine’s short display name up to the dot, rather than the fully qualified domain name.

Performance tiles

Scope Mustache Result Comment
Network Adapter - Bytes Total/sec Line graph {{key.instance}} Realtek PCIe GBE Displays adapter manufacturer rather than interface name
Processor Information % Processor Time Sparklines {{ key.managedEntityPath.toUpperCase().split('.')[0] }} SQUP-OPP-WEB01 Displays all server names as hostnames, all in upper case

Webinar: Custom Labelling

Wikipedia: Mustache template system

Ractive 0.7 Mustache extensions

Regular Expression label: How to use custom labeling keywords: custom labelling labeling labels label displayname mustache