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 e [, boolean m [, string f]]) string

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

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

Optional f 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 e, string t [, boolean m [, string f]])) string

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

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

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

Displayed as the value of type t in inline mode.

Example:

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

Returned inline link:

[configuration](https://atsd_hostname:8443/entities/nurswgvml007/properties?type=configuration)
getRuleLink([string f]) string

Returns the URL to the current rule.

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

Displayed as rule name in inline mode.

getCsvExportLink([string f]) string

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

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

Displayed as CSV Export link in inline mode.

Available only in rules with Series data type.

getHtmlExportLink([string f]) string

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

Optional f 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.

Available only in rules with Series data type.

getChartLink([string f]) string

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

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

Displayed as Default link in inline mode.

Available only for 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...)
addLink(string l, string u) string

Returns the URL u with a short name l based on the current endpoint settings.

If no settings are available, the function returns the original URL u.

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>