Forum Discussion

Antony_Hawkins's avatar
7 years ago

DataSources_List PropertySource

(Edit, October 2020 - see later comment below for a version that does all this without needing an API call)

Q: What does it do?

A: Calls the LogicMonitor API and finds, for each applicable device, a list of DataSource Names that exist on the Device, i.e. have at least one instance. This also includes ConfigSources active on the Device. These are put together as a semicolon-seperated list in the property auto.activedatasources:

c79ef7414884f314cf54c8317eb8bd77.png

Q: Why? I can just look at the Device in the Device tree.

A: You can, but... This PropertySource means you can create Dynamic Groups and Device Inventory Reports based on the presence or absence of *any* combination of DataSources on Devices.

Q: Can you give me a real-world example of this being useful?

A: Yes. On a Microsoft SQL server, LogicMonitor will find the SQL Services via WMI, but the actual SQL Server metrics are found via Perfmon or JDBC methods. If we can't access Perfmon or JDBC for any reason (required services not running, lack of credentials, etc) we'll be missing the SQL stats but quite probably getting all the other Windows metrics (via WMI). This can be very difficult to spot if you have one affected SQL server out of 1,000.

With this PropertySource running, you could create a Dynamic Group with a custom query of:

auto.ActiveDataSources =~ "WinSQLServices-" && auto.ActiveDataSources !~ "WinSQLServer-" && auto.ActiveDataSources !~ "WinSQLServer_JDBC-"

This will list all the devices on which we've found SQL Services but have failed to find any SQL metrics.

Similarly Exchange Services are discovered via WMI, whilst most Exchange metrics come from Perfmon.

Or, maybe you want to create a Group to contain all your Linux servers that are running Apache web server and MySQL:

isLinux() && auto.ActiveDataSources =~ "Apache-" && auto.ActiveDataSources =~ "Mysql-"

You will need:

A REST API Access ID and Access Key for a user with permissions to at least view all Devices within the account (or all Devices in whichever Groups you wish to consider). These should be set as properties 'apiaccessid.key' and 'apiaccesskey.key' within the Devices tree (generally the root level, or a Group level if appropriate).

The PropertySource will use these to find the list of DataSources present on the Device, and create the auto.activedatasources property for all devices.

auto.activedatasources will have one of two error messages if the required API details are not present or do not give sufficient access to query the Device; this could of course also be used to create Dynamic Groups and in Device Inventory Reports.

Note that DataSources are listed by their (unique) 'Name' rather than their (not necessarily unique) 'Displayed As' string seen in the Device tree.

v1.0.0: ZLTDWM

Current limitations:

The auto.property fields are limited to 2,000 characters, so if the list of DataSource Names exceeds this size, the data will be truncated. This is likely to be an edge case only seen on test Devices with multiple custom DataSources applied.

Auto Properties are updated daily or when Active Discovery is run for a Device, so there may (will!) be a time lag between DataSources being applied to a Device and those DataSources appearing in this auto.activedatasources property list.

19 Replies