Create agent list for instance discovery?

Started by jeffreyz, March 22, 2014, 07:15:41 PM

Previous topic - Next topic

jeffreyz

I need to monitor a value that can be extracted from a database on a database server. This is easy to do with a DCI that uses a custom shell script that queries the database for the value to be monitored.

However, the database server has, in fact, not one but approximately 60 databases. Each database has the same schema, so the same script can be used to monitor the value in question for each database. But I do not want to create 60 different DCIs manually, one for each database to be monitored. I would rather use instance discovery so that they can be created automagically for me.

However, in order to use instance discovery for this case, it would appear to be necessary to do two things:


  • Create a DCI based on my shell script that contains an {instance} parameter that accepts the name of a database on the server.
  • Create an agent list that contains the names of all of the databases on the database server.

Are both of these things possible? I am new to NetXMS and so far I have only come across built-in DCIs that accept {instance} parameters, as well as only pre-defined agent lists. I would be willing to code something up in Java, but I would need a few pointers on how to get started.

I would appreciate any help to point me in the right direction, even if the answer is that this is not possible.

Victor Kirhenshtein

Hi!

You can create your own list on agent using ExternalList configuration option. Agent will execute command given and return all it's output as list elements. For example, to add list which will return all files in /tmp, add the following to nxagentd.conf:


ExternalList = TemporaryFiles:/bin/ls /tmp


Best regards,
Victor

jeffreyz

Quote from: Victor Kirhenshtein on March 24, 2014, 09:33:37 AM
You can create your own list on agent using ExternalList configuration option. Agent will execute command given and return all it's output as list elements. For example, to add list which will return all files in /tmp, add the following to nxagentd.conf:


ExternalList = TemporaryFiles:/bin/ls /tmp


Bingo! It works like a charm. Thank you very much.

Is "ExternalList" documented somewhere? It is not that I need more info, but I have not seen documentation that mentions this parameter and neither did a web search find anything. I would love to read more documentation, even if it were just source code.

Victor Kirhenshtein

We implement it just recently, in 1.2.12, and it is not documented yet.

Best regards,
Victor