Forum Discussion

Jonathan_Arnold's avatar
Jonathan_Arnold
Icon for LM Champion rankLM Champion
9 years ago

Monitoring Databases as Instances

One of our customers wanted a datasource that has instances that call from each database.

Trying to use the auto discovery in the datasource for jdbc with a discovery type of "Database List" so that they could monitor each customer's database the same way.

Quote

Database list: This option is intended to query a global database about other databases to be monitored. It expects the SQL statement to return a list of databases, which are concatenated with the port used. This value can then be used in the JDBC URL. Each listed database will be returned as an instance.

 
 
 
 
 
 
 
 
 

So the above per our documentation explains how this should work, but this will return port#:databaseName. 

It will pass this to the ##WILDCARD## as port#databaseName (ex: 1433testDB). This is great if you want to see where you have what databases, but if you want to monitor the individual database then it won't work since the database is not written in that form. 

To do this you can change the active discovery to be "Instance List" 

Quote

Instance list: The result of the SQL statement will be used as instances. The query must return only a single column, of varying numbers of rows (e.g. "select name from customers").

and write a SQL statement that will return the database names (Select name as databasename From sys.databases) 

This will discover all of the databases that are in the master database and pass them as wildcards to the collector which you can use in the URL, and then you are able to write a SQL statement that will query all of the databases the same way.

Quotes via: https://www.logicmonitor.com/support/datasources/active-discovery/jdbc-active-discovery/