Come join our live training webinar every other Wednesday at 11am PST and hear LogicMonitor experts explain best practices and answer common questions. We understand these are uncertain times, and we are here to help!
LogicMonitor’s pre-defined Active Discovery methods, such as SNMP, WMI, and HTTP, are suitable for most applications. But in some cases you may need to use a script to discover DataSource instances.
Discovering DataSource instances using a script is straightforward. Here’s a high-level overview of what you need to do:
Please note the following string/character limitations for your script:
To ensure instance generation is properly interpreted by the Collector, Active Discovery scripts require output in a specific format. In the simplest case your Active Discovery script needs to return only the instance id and name, with each instance on its own line.
You can optionally add a description to each instance as follows:
Further you may collect instance properties with your Active Discovery script using this syntax:
Active Discovery will update its list of discovered instances when the script returns an exit code of “0”, indicating that the script execution completed successfully.
It is best practice to ensure values are assigned to the instance level properties and not left blank. In the example below, creating the property auto.fooProperty with a null value will create an error in the discovery task log.
If the script output is empty or malformed, but the script exits with a code of “0”, all previously discovered instances will be removed. To prevent Active Discovery from removing instances in the case of a script error (such as an SNMP timeout), make sure your code is designed to catch such conditions and return a non-zero exit code.
NOTE: Use the Test Active Discovery button to return a table of all instances that would be discovered using the script. This is a good way to ensure that all instances you expect to discover are, in fact, being discovered.
In This Article