» Determining whether a Datasource applies to a Host

Each host has a set of properties. These properties can be set by the Auto Properties system, the OID to Categories mapping, manually on a host or group, or even by adding a host to a group.  These properties are visible from the Host tab by selecting a host, and then clicking the "Properties" tab.

These properties are available to determine whether a datasource applies to a host.  Each datasource has an AppliesTo field.  This field contains a small program (in LMS - LogicMonitor Script - full details can be found in the LMS page) that evaluates to either True or False.  If the AppliesTo program evaluates to True when given the set of properties for a host as input, the datasource applies to the host. If False, the datasource does not apply to a host.

If any of the properties for a host ever changes, LogicMonitor will re-evaluate all datasources against the properties of the host, to see if any datasources need to be associated with the host, or removed from it. Similarly, if the AppliesTo field of any datasource changes, LogicMonitor will assess all hosts and their properties against the new AppliesTo expression.  (This process is automatic, but can be manually forced for a specific host by selecting "Force Datasource Rematch" from the More button.)

The most common usages of the AppliesTo field follow:

True()

The simplest case is if the AppliesTo field contains the function True().

In this case, the datasource will unconditionally apply to all hosts, regardless of all host properties.

Examples are the Ping datasource (as by default, we run availability checks on all hosts)

isWindows()

isWindows() is another built in LMS function - this will return True if the host property ‘system.sysinfo’ (which will have been set previously by the Auto Properties system) contains both “Microsoft” and “Windows”.  Thus datasources that should apply to all Windows systems, and not systems of other types, can use isWindows() as the value of the AppliesTo field, as the WinCPU datasource does:

WinCPUAppliesto

hasCategory()

hasCategory("XXX") is a built-in function that checks if system.categories property for a particular host contains the tag “XXX” (not case sensitive). Given that the OID to Categories mapping table will have assigned different values to this property based on the system.sysoid value, this is a simple way to apply datasources appropriate for the category of device.

For example, all devices with "snmp" in the system.categories property (which is practically all devices supporting snmp) will have this datasource applied:

snmpAppliesTo

Whereas only those devices with the CiscoASA value in the system.categories property (which, as we saw in the OID to Category mapping page, will be those with OIDs that match the regular expression \.1\.3\.6\.1\.4\.1\.9\.1\.(45[01]|227|389|39[0-3]|417|67[5-8]|76[8-9]|77[0-1]|669|67[0-3]|745|753|76[3-6]|77[3-4]|91[4-6])) will have this datasource applied:

CiscoASAApliesTo

Users can add their own values to the system.categories property of hosts or groups. If added to groups, all hosts in those groups will inherit the property. Right click host or host group title, choose Edit, and click Add for properties. Specify system.categories as name, and XXXX into the value field, where XXXX should match the tag in the hasCategory("XXXX") on the datasource definition page. If system.categories property already exists, you can append values to it as a comma separated list.