Link Functions

Overview

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

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

The inline links can be also assembled manually using the syntax supported by the notification channel:

  • 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 e page on the target ATSD instance. The entity name is URL-encoded 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')

The returned link includes the path to the entity page on the target database server:

https://atsd_hostname:8443/entities/nurswgvml007

The above URL could also be assembled 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>