Entity Groups Expression Functions

Reference

collection

  collection(string s) [string]

Returns an array of strings which have been loaded with the specified string s.

The named collections are listed on the Data > Named Collections page.

To check the size of the collection, use the .size() method.

To access the n-th element in the collection, use square brackets as in [index] or the get(index) method (starting with 0 for the first element).

label = collection('hosts')[0]
tags.request_ip = collection('ip_white_list').get(1)

list

  list(string s[, string p]) [string]

Splits string s using separator p (default is comma ',') into a collection of string values. The function discards duplicate items by preserving only the first occurrence of each element.

To access the n-th element in the collection, use square brackets as in [index] or the get(index) method (starting with 0 for the first element).

Examples:

name = list('atsd,nurswgvml007').get(0)

likeAll

  likeAll(object s, [string] c) boolean

Returns true, if the first argument s matches every element in the collection of patterns c. The collection c can be specified inline as an array of strings or reference a named collection.

Examples:

likeAll(tags.request_ip, ['10.50.*', '10.50.102.?'])

likeAny

  likeAny(object s, [string] c) boolean

Returns true, if the first argument s matches at least one element in the collection of patterns c. The collection c can be specified inline as an array of strings or reference a named collection.

Examples:

likeAny(tags.os, ['Ubuntu*', 'CentOS*'])
likeAny(tags.request_ip, collection('ip_white_list'))

matches

  matches(string p, [string] c) boolean

Returns true if one of the collection c elements matches (satisfies) the specified pattern p.

The pattern supports ? and * wildcards.

Example:

matches('*atsd*', property_values('docker.container::image'))

startsWithAny

  startsWithAny(object s, [string] c) boolean

Returns true, if the first argument s starts with any of strings from collection c. The collection c can be specified inline as an array of strings or reference a named collection.

Examples:

startsWithAny(name, ['a', 'nur'])

collection_contains

  collection_contains(object v, [] c) boolean

Returns true, if collection c contains object v. The collection c can be specified inline as an array of strings or reference a named collection.

Examples:

NOT collection_contains(tags, [entity_tags('nurswgvml007')])

collection_intersects

  collection_intersects([] f, [] s) boolean

Returns true, if collection f has elements in common with collection s. The collections can be specified inline as an arrays of strings or reference a named collections.

Examples:

collection_intersects(tags.values(), collection('ip_white_list'))

upper

  upper(string s) string

Converts s to uppercase letters.

lower

  lower(string s) string

Converts s to lowercase letters.

property

  property([string e, ]string s) string

Returns the first value in the list of strings returned by the property_values(string s) function for the specified property search expression s and entity e.

The function returns an empty string if no matching property records are found.

Examples:

property('docker.container::image') = 'axibase/collector:latest'
// OR
property(name, 'docker.container::image') = 'axibase/collector:latest'
name = property('nurswgvml007', 'docker.container::image')
property('nurswgvml007','cpu::cpu.idle%') < property('cpu::cpu.idle%')

properties

  properties(string t) map

Returns the most resent tag=value map for property type t. Tag value can be accessed via the dot notation.

Examples:


properties('docker.container').image LIKE 'axibase/*'
NOT properties('docker.container').isEmpty()

property_values

  property_values([string e, ]string s) [string]

Returns a list of property tag values for the given entity for the specified property search expression s.

The function returns an empty list if the entity, property or tag is not found.

Examples:

name IN property_values('nurswgvml007', 'docker.container::image')
property_values('linux.disk:fstype=ext4:mount_point').contains('/')

hasMetric

  hasMetric(string m[, integer n]) boolean

Returns true if the entity collects the specified metric m, regardless of tags.

If the optional hours n argument is specified, only rows inserted for the last n hours are evaluated.

Examples:

hasMetric('mpstat.cpu_busy')
hasMetric('mpstat.cpu_busy', 24*7)

memberOf

  memberOf(string|[string] g) boolean

Returns true if an entity belongs to at least one of the specified entity groups.

Examples:

memberOf('all-linux-servers')
memberOf(['aws-ec2', 'aws-ebs'])
memberOf(collection('groups'))

memberOfAll

  memberOfAll([string] g) boolean

Returns true if an entity belongs to every of the specified entity groups.

Examples:

memberOfAll(['aws-ec2', 'aws-ebs'])
memberOfAll(collection('groups'))

entity_tags

  entity_tags(string e) map

Returns entity tags for entity e as a map.

If the entity is not found, an empty map is returned.

Examples:

entity_tags(name).file_system='ext4'

contains

  [string].contains(string s) boolean

Returns true if s is contained in the collection.

Example:

collection('ip_white_list').contains(tags.request_ip)

size

  [].size() integer

Returns the number of elements in the collection.

This function can be applied to collections of any type (string, number) as well as to maps.

Examples:

collection('ip_white_list').size()

isEmpty

  [].isEmpty() boolean

Returns true if the number of elements in the collection is zero.

This function can be applied to collections of any type (string, number) as well as to maps.

Example:

collection('ip_white_list').isEmpty()

IN

  string s IN (string a[, string b[...]]) boolean

Returns true if s is contained in the collection of strings enclosed in round brackets.

Examples:

name IN ('nurswgvml007', 'nurswgvml008')
tags.location IN ('NUR', 'SVL')