Grid Designer
The Grid designer is available in the grid columns panel in Grid visualizations. It allows you to easily add, hide, order, and customize columns of data that may come from any internal or external source.
Hiding a column
By default, when you configure a tile all columns will be displayed. To hide a column, simply click hide for each column you wish to hide.
Restoring hidden columns
If you have previously hidden some columns that you now want restored, you can click show all columns to show visible and hidden columns (the toggle will now read show visible columns only). Columns that are currently hidden will be grayed out and have the show option instead of hide.
Tip: Filtering columns in your query
The column modifications are performed client-side, so it's still most efficient to filter the columns directly in your query or script (for example, for SQL or Azure Log Analytics tiles), but if you're using an API that doesn't allow you to filter columns then this feature gets you the results you need.
Ordering columns
Changing the column order couldn't be easier, simply click and drag the gray ☰ icon to the left of the column name.
Changing the name of a column
If you want to change a column name, simply click on the existing column name in the grid options panel and enter the new name.
To restore the original name, simply delete your updated name and the column will revert to its original name.
Changing the way the data in a column is displayed
To format the way the data in a column is displayed, click edit to the right of a column to display the custom template box. You can then type your standard SquaredUp DS 'mustache' syntax and click on done when you have the column looking exactly how you want it. If you want to preview the results before you're done, click anywhere outside the text box while editing it.
A { } icon will appear next to the column edit option to indicate that a custom template has been applied.
The mustache syntax is great for converting numbers, adding units, highlighting key values or performing any other customizations you may need. For more information on mustaches see How to use Custom Labels.
Check out our GitHub Samples repository for samples around using mustache. You'll find snippets for custom labels, conversions, manipulating strings, using HTML, and many more use cases.
Property names that contain hyphens (for example properties.name-with-hyphens
) can't be processed due to a JavaScript limitation. If you want to use a property that contains a hyphen, you have two options:
- If you have access to the data source and can change the name of the property, change the name of the property to a name without hyphens.
For example, if your Elasticsearch query uses a property (an aggregation, a grouping or any other property you want to use) with a name that contains a hyphen, you can either access your Elasticsearch instance and change the name there or you can overwrite the name in the query dsl field. - If you can't change the name of the property, you need to enter the property name in the following format:
Original property name:{{properties.name-with-hyphens.value}}
New format:{{properties['name-with-hyphens'].value}}
Adding custom columns
You can dynamically construct new columns based on the data returned by your tile, which is invaluable when dealing with data sources that only support simple data retrieval, or where the API does not return data in a simple tabular form (such as many JSON based Web APIs).
To add a custom column:
- Click the add button near the bottom of the grid columns panel.
- Click the column name and change the name from customcolumn1 to the name you want to give the column.
- In the data key path box, enter the (original) name of the column or path to the desired property in the returned data (this will depend on the API you are returning data from). If you need to access the values of multiple columns (i.e. concatenating two columns together) simply leave the box empty.
- Optionally, if you want to customize the display of the column, you can enter a mustache in the custom template box
- Click done when you have finished.
Custom columns have a pencil icon in the grid options panel to indicate they have been added by a dashboard author.
Property names that contain hyphens (for example properties.name-with-hyphens
) can't be processed due to a JavaScript limitation. If you want to use a property that contains a hyphen, you have two options:
- If you have access to the data source and can change the name of the property, change the name of the property to a name without hyphens.
For example, if your Elasticsearch query uses a property (an aggregation, a grouping or any other property you want to use) with a name that contains a hyphen, you can either access your Elasticsearch instance and change the name there or you can overwrite the name in the query dsl field. - If you can't change the name of the property, you need to enter the property name in the following format:
Original property name:{{properties.name-with-hyphens.value}}
New format:{{properties['name-with-hyphens'].value}}
Example
In this example, we are going to customize the output of a SCOM task from the Data On Demand management pack that displays CPU process information. This will include hiding columns which may not be interesting, reformating some data for legibility, and separating the path column into separate folder and executable columns, so that a long path doesn't make it hard to see what program is being run.
- Add a new tile to a dashboard or windows server perspective. If using a dashboard, on the scope panel specify a valid Windows computer.
- Click on SCOM Task and then On-Demand Task (Grid). Click next.
- In the task config panel select List Processes (Data On Demand) as the task to execute.
- Click hide next to sessionId, handles, parentPid and threads.
- Click add and select Format in the override parameters dropdown. Enter
csv
and click apply changes (execute). Click next twice. - Rename cpuPercent to
CPU Usage
by clicking on its name in the grid columns panel. - Click edit to the left of your CPU Usage column. In the custom template column enter `{{value}}%' to add a percent symbol to the value. Click done.
- Rename the privateBytes column to
Private MB
and click edit. In the template box enter{{Math.round(value/1048576)}}
. Click done. - Rename the path column to
Folder
. Click edit and enter{{value.substring(0,value.lastIndexOf('\\'))}}
. Click done. - Click add to add a new custom column. Rename the column from customcolumn1 to Executable. In the path box enter
path
and in the custom template box enter{{value.slice(1+ value.lastIndexOf('\\'))}}
. Click done. - Click and drag the ☰ icon to the left of the Executable column above the Folder column.
- Click the orange done button to finish editing the tile.
Using Timeago to convert Unix timestamps
You can use timeago
to convert Unix timestamps from milliseconds to show a readable date and time. You can either display an absolute time (for example, August 20th 2021) or a relative time (for example, 20 hours ago).
There are four parameters you can use for converting the time, written in the following format:
timeago(Value you want to convert, Show Absolute, Show Time, Without Suffix, With Prefix).
The parameters for the value you want to convert can either be true
or false
:
Tip: The default setting for all parameters is false
. If you only want to change the first parameters, you can just use timeago(value, true, true)
and it will be interpreted as timeago(value, true, true, false, false)
.
Examples:
To display the relative time (how long ago something occurred):
{{timeago(value)}}
To display the absolute time as the date without the time:
{{timeago(value, true)}}
To display the absolute time as the date with the time:
{{timeago(value, true, true)}}
To display the time with the prefix "for" for relative time and "since" for absolute time (for example, "the status has been unhealthy for 10 hours")
Option A) Use the fourth parameter and set it to true
. This will insert the appropriate prefix for the absolute or relative time:
timeago(value, false, false, true, true)
Option B) You can leave out the fourth parameter that controls if the prefix "for" or "since" is inserted automatically. Since you left it out, it defaults to false, causing no prefix to be shown. Instead you insert the word "for" or "since" manually before the timeago function.
for timeago(value, false, false, true)
To convert a time value from seconds to milliseconds:
Some APIs, like Pingdom for example, return the value in seconds. Since Timeago uses the time value in milliseconds, you need to multiply by 1000 in that case:
{{timeago(value*1000)}}
Example with a Pingdom property:
{{timeago(properties.lasttesttime*1000)}}