Link Functions

Overview

These functions return URLs to ATSD pages based on database URL, set the server.url property, and the current window context.

URLs are automatically inlined for email notifications and webhooks that support inline links.

Alternatively, manually assemble inline links using syntax supported by the webhook target.

  • markdown
[Error Messages](${serverLink}/messages?entity=${entity})
  • pipe (used by Slack)
<${serverLink}/messages?entity=${entity}|Error Messages>
  • html
<a href="${serverLink}/messages?entity=${entity}">Error Messages</a>

Reference

getEntityLink(string entity [, bool matchLabel [, string format]]) string

Returns the URL to the Entity Editor page for entity entity on the target ATSD instance. The function URL encoded the entity name if necessary.

If the match entity parameter matchLabel is set to true, the entity is matched by label if it cannot found by name.

Optional format parameter creates an inline link in one of supported formats: html, markdown, and pipe (used by Slack).

Example:

getEntityLink('nurswgvml007')

Returns URL to the Entity Editor for the specified entity.

https://atsd_hostname:8443/entities/nurswgvml007

Alternatively assemble the above URL manually:

serverLink + '/entity/' + urlencode(entity)
getPropertyLink(string entity, string type [, bool matchLabel [, string format]]) string

Returns the URL to the property table for entity entity and property type type on the target database server.

If the match entity parameter matchLabel is set to true, the entity is matched by label if it cannot be found by name.

Optional format parameter creates an inline link in one of supported formats: html, markdown, and pipe (used by Slack).

The link name is set to property type type in inline mode.

Example:

getPropertyLink('nurswgvml007', 'configuration', false, 'markdown')

Returned inline link:

[configuration](https://atsd_hostname:8443/entities/nurswgvml007/properties?type=configuration)
getPortalLink(string portalName, string entityName) string

Returns the URL to the specified portal for the given entity.

getPortalLink('vm-stats', 'nurswgvml007')

The link name is set to portal name in inline mode.

getRuleLink([string format]) string

Returns the URL to the current rule.

Optional format parameter creates an inline link in one of supported formats: html, markdown, and pipe (used by Slack).

The link name is set to rule name in inline mode.

getCsvExportLink([string format]) string

Returns the URL to the CSV file with historical statistics for the current metric, entity, and tags.

Optional format parameter creates an inline link in one of supported formats: html, markdown, and pipe (used by Slack).

The link name is set to CSV Export link in inline mode.

Note

Supported only in rules with Series data type.

getHtmlExportLink([string format]) string

Returns the URL to the Data > Export page for the current metric, entity, and tags.

Optional format parameter creates an inline link in one of supported formats: html, markdown, and pipe (used by Slack).

Displayed as HTML Export link in inline mode.

Note

Supported only in rules with Series data type.

getChartLink([string format]) string

Returns the URL to the default portal for the current metric, entity, and tags.

Optional format parameter creates an inline link in one of supported formats: html, markdown, and pipe (used by Slack).

Displayed as Default link in inline mode.

Note

Supported only in rules with Series data type.

Example:

getChartLink('markdown')

The following inline link is returned:

[Default](https://atsd_hostname:8443/portals/series?metric=docker&entity=nurswgvml007...)
getOHLCVChartLink(string format) // extracts symbol and class code from entity
getOHLCVChartLink(string format, string symbol, string class)
getOHLCVChartLink(string format, string symbol, string class, string interval)
getOHLCVChartLink(string format, string symbol, string class, string interval, string period)
getOHLCVChartLink(string format, string symbol, string class, map options) // options can contain `interval`, `period`, `startDate`, and `endDate`

Returns the URL to the built-in OHLCV portal .

Optional format parameter creates an inline link in one of supported formats: html, markdown, and pipe (used by Slack).

Example:

getOHLCVChartLink('markdown', 'TSLA', 'IEXG')
addLink(string label, string url) string

Returns the URL url with a short name label, formatted based on the current endpoint settings.

If the endpoint settings are not available, the function returns the original URL url.

Examples:

  • markdown (Telegram):
addLink('Error Messages', serverLink + '/messages?entity=' + entity)

The following inline link is returned:

[Error Messages](https://atsd_hostname:8443/messages?entity=nurswgvml007)
  • pipe (Slack):
addLink('Error Messages', serverLink + '/messages?entity=' + entity)

The following inline link is returned:

<https://atsd_hostname:8443/messages?entity=nurswgvml007|Error Messages>
  • html (Email, HipChat, Discord):
addLink('Error Messages', serverLink + '/messages?entity=' + entity)

The following inline link is returned:

<a href="https://atsd_hostname:8443/messages?entity=nurswgvml007">Error Messages</a>