AppliesTo Function Reference

Last updated on 27 March, 2023

Note: Please use the AppliesTo Scripting Overview article for the most complete information regarding AppliesTo scripting.

Absolute Functions

false()

Syntax

false()

Parameters

None

Description

The false() function matches no resources. The false() function can be used to globally disable a LogicModule without deleting it. The false() function can also be used with a LogicModule under development to prevent it from being applied to any resource prematurely. The false() function does not accept parameters.

See also

true()

true()

Syntax

true()

Parameters

None

Description

The true() function matches all resources in your environment and should be used with caution. The true() function does not accept parameters.

See also

false()

Convenience Functions

LogicMonitor maintains a number of built-in functions to identify common categories of resources. Most of these functions inspect the system.sysinfo property (which is populated via WMI (for Windows devices) or SNMP (for Linux, NetApp, Netscaler, Cisco), or the system.categories property (which is most typically populated by PropertySources, although it can be populated manually). Convenience functions do not accept parameters.

isAWSService()

Syntax

isAWSService()

Parameters

None

Description

Returns TRUE if the value of the system.devicetype property is “2”.

isAzureService()

Syntax

isAzureService()

Parameters

None

Description

Returns TRUE if the value of the system.devicetype property is “4”.

isCisco()

Syntax

isCisco()

Parameters

None

Description

Returns TRUE if the value of “cisco” is contained in the system.sysinfo or system.categories property.

isCollectorDevice()

Syntax

isCollectorDevice()

Parameters

None

Description

Returns TRUE if the value of the system.collector property is “true”.

isDevice()

Syntax

isDevice()

Parameters

None

Description

Returns TRUE if the value of the system.devicetype property is “0” or if the value of “collectorDataSources” is contained in the system.categories property.

isFreebsd()

Syntax

isFreebsd()

Parameters

None

Description

Returns TRUE if the value of “freebsd” is contained in the system.sysinfo or system.categories property.

isF5()

Syntax

isF5()

Parameters

None

Description

Returns TRUE if the system.sysoid property begins with “1.3.6.1.4.1.3375.2.1.3.4.4” or if the value of “f5” is contained in the system.categories property.

isGCPService()

Syntax

isGCPService()

Parameters

None

Description

Returns TRUE if the value of the system.devicetype property is “7”.

isK8sPod()

Syntax

isK8sPod()

Parameters

None

Description

The isK8sPod() AppliesTo function applies the modules only on Kubernetes pods.

isLinux()

Syntax

isLinux()

Parameters

None

Description

Returns TRUE if the value of “linux” is contained in the system.sysinfo or system.categories property and the value of “Cisco IOS” is not present in the system.sysinfo property.

isLinux(“excludeK8sPod”)

Syntax

isLinux("excludeK8sPod")

Parameters

None

Description

The isLinux(“excludeK8sPod”) AppliesTo function applies modules on only Linux devices.

isMisc()

Syntax

isMisc()

Parameters

None

Description

Returns TRUE if none of the criteria for the isWindows(), isLinux(), isNetwork(), isStorage(), and isVirtualization() convenience functions are met.

isNetApp()

Syntax

isNetApp()

Parameters

None

Description

Returns TRUE if the value of “netapp” is contained in the system.sysinfo or system.categories property.

isNetflow()

Syntax

isNetflow()

Parameters

None

Description

Returns TRUE if the value of the system.enablenetflow property is “true”.

isNetscaler()

Syntax

isNetscaler()

Parameters

None

Description

Returns TRUE if the value of “netscaler” is contained in the system.sysinfo or system.categories property.

isNetwork()

Syntax

isNetwork()

Parameters

None

Description

Returns TRUE if the system.sysinfo or system.categories property contains a value that represents systems considered to be a network. A large number of values are inclusive; see the “isNetwork” AppliesTo function (Settings > AppliesTo Functions > isNetwork) for the complete expression.

isSolaris()

Syntax

isSolaris()

Parameters

None

Description

Returns TRUE if the value of “solaris” is contained in the system.sysinfo or system.categories property.

isStorage()

Syntax

isStorage()

Parameters

None

Description

Returns TRUE if the system.sysinfo or system.categories property contains a value that represents systems considered to be storage. A large number of values are inclusive; see the “isStorage” AppliesTo function for the complete expression.

isUnix()

Syntax

isUnix()

Parameters

None

Description

Returns TRUE if the value of “solaris” or “linux” or “freebs” is contained in the system.sysinfo or system.categories property.

isVirtualization()

Syntax

isVirtualization()

Parameters

None

Description

Returns TRUE if the value of “vmware” or “xen” is contained in the system.virtualization property or if the value of “hyperv” is contained in the system.categories property.

isWindows()

Syntax

isWindows()

Parameters

None

Description

Returns TRUE if the value of “windows” or “hyper-v” is contained in the system.sysinfo or system.categories property.

getCollectorVersion()

Syntax

getCollectorVersion()

Parameters

None

Description

Returns the value of the system.collectorversion property.

Functions that Operate on Arrays

While most resource properties are string or numeric type, there are several that are array type, including:

  • system.categories
  • system.groups
  • system.staticgroups
  • system.ips

The following AppliesTo functions can be used for working with arrays.

contains()

Syntax

contains(<array>, "<string>")

Parameters

  • <array>
  • <string>

Description

This function returns TRUE if the specified string matches an array element. The match is a complete match on the search string, case insensitive. Regex is not supported.

Examples

contains(system.groups,"network") – Matches groups (dynamic and static) at the root of the Resources tree named “network”, “Network”, “nEtWoRk”, and so on.

Note: The system.groups property cannot be used in AppliesTo scripting expressions that are intended to dynamically organize resources into groups. If you want to create a dynamic group that is dependent on group membership, you must use the system.staticgroups property. For example, contains(system.staticgroups,"network".

contains(system.staticgroups,"Acme Corp/Prod") – Matches child groups of “Acme Corp” named “Prod” or “prod”, but not those named “production”, “Prod_QA”, and so on.

Note: Only static group membership (not dynamic group membership) is queried when the system.staticgroups property is referenced.

contains(system.ips,"192.168.170.1") – Matches resources with an IP address of 192.168.170.1.

Note: The contains() function can only be used to match the full IP address of a resource. For partial IP address or range matching, use the join() function.

See Also

join()

join()

Syntax

join(<array>, "<separator>")

Parameters

  • <array> (Required)
  • <separator> (Required)

Description

This function flattens an array to a string with array elements separated by the designated separator. Partial match and regex are supported. When used alone, it returns TRUE for resources which have any value set for the specified array property.

Examples

join(system.ips,",")=~"192.168.100." – Matches resources with an IP address on the subnet 192.168.100.X. The ability to match on the partial IP address of a resource is useful for grouping devices by subnet or IP range.

join(system.groups,",")=~"Prod" – Matches resources in groups with names like “Prod”, “production”, or “Prod1” at any level of the Resources tree.

join(system.staticgroups,",")=~"/.*dev" – Matches resources in any non-dynamic child group whose name contains “dev”, “Dev”, or “DEV”.

!join(system.categories,",")=~"/.*dev" – Matches any resource for which system.categories is empty. Equivalent to !system.categories.

See Also

contains()

hasCategory()

Syntax

hasCategory("<string>")

Parameters

<string>

Description

This function queries the system.categories property for an array element that is a complete, case insensitive match for the specified string. Returns TRUE if there is a match. Regex is not supported.

Examples

hasCategory("sonicwallfw")

Functions that Operate on Strings and Numbers

The following functions operate on properties that are string or numeric type.

exists()

Syntax

exists("<property value>")

Parameters

<property value>

Description

This function returns TRUE if the specified value is assigned to any of the resource’s properties.

sum()

Syntax

sum(x,y,z)

Parameters

Any number

Description

This function returns the sum of the numbers passed as parameters.

startsWith()

Syntax

startsWith(<property>, "<value>")

Parameters

  • <property>
  • “<value>”

Description

This function returns TRUE if the property value starts with the value specified in the function. Typically the value will be a string and should be enclosed in double quotes. Partial match from the beginning of the string is supported. Regex is not supported. It is possible to pass the value as a number without double quotes. However, partial match is not supported for numeric values, so the match must be complete for the function to return TRUE.

Examples

startsWith(system.sysinfo,"Microsoft") – Matches Windows resources.

startsWith(system.collectorversion,"28") – Matches resources monitored by Collector version 28.xxx.

startsWith(system.collectorversion,"28102") – Matches resources monitored by Collector version 28.102. Note that this is equivalent to system.collectorversion==23102.

getPropValue()

Syntax

getPropValue("<property name>")

Parameters

<property name>

Description

If the device property name contains special characters such as “:”, “/”, “*”, “=”, or spaces, you will need to use the getPropValue("") function. We recommend not having special characters in your property names, but if it can’t be avoided, this function allows you to use the property in an AppliesTo expression.

For example, if you have a property named “SiteA:unit”, and you want to return resources with this property having values 10 to 19, you might try: SiteA:unit=~"[10-19]"

However, you will receive a syntax error informing you that characters in regular expressions must be escaped. To get past the error you will need to use this expression instead: getPropValue("SiteA:unit")=~"[10-19]". Note the property name is enclosed in double quotes

When getPropValue("") is used alone it returns TRUE for all resources which have a value set for the specified property.

In This Article