Script or CSV Discovery Method

Last updated on 27 March, 2023

The script or CSV discovery method lets you use a script or CSV file to specify which devices are added. This allows you to retrieve devices from a configuration database or other repository. 

Setting Script or CSV Discovery Method

1. Navigate to Settings > NetScans > Add Advanced NetScan.


Note: If your script takes more than five minutes to complete and results in a Stream closed exception or Timeout exception, you can extend the script timeout value using the netscan.script.timeout.inSeconds Collector setting. The default value is set to 300 seconds.
You must update the setting in the agent.conf file of the Collector assigned to the NetScan. For more information, see Editing the Collector Config Files.

2. In the Script and CSV options section, enter the following details:

  • Upload script or CSV file – For an external script file, complete the following:
    • Upload the script.
    • Specify the path to the uploaded script to be used by Linux and/or Windows Collectors. The path must be local to the Collector using the script.
    • Specify any parameters needed by the uploaded script. The parameters can be passed by a combination of positional arguments and named options. If both are used, options should be passed in first, then arguments (For example, opt1=xxx opt2=yyy argument1 argument2).
  • Upload script or CSV file from the network – Enter the URL and the parameters for the required network.
  • Embed a Groovy script – To embed a Groovy script, do the following:
    • Enter the code for your Groovy script.
    • Specify any parameters required by your script. You can pass the parameters by a combination of positional arguments and named options. If you use both, ensure to pass the options must be passed first, then arguments. (For example, opt1=xxx opt2=yyy argument1 argument2).

CSV File Requirements

The process for running a NetScan that uses a CSV file is nearly identical to that of a script-based NetScan. Since most CSV files are static, you cannot schedule a CSV NetScan.
Your CSV files must meet the following requirements:

  • The first line of the CSV file must be your column headers. There are four valid headers: “IP”, “displayname”, “hostgroup”, and “properties”. Both “IP” and “displayname” are required column headers.
  • If hostgroup is specified, it must use the full group path.
  • Multiple properties for any given resource can be added. These must be line-separated in the “properties” column and the entire property field enclosed in double quotes, as shown in the following example.
IP,displayname,hostgroup,properties 
10.0.0.10,Device from CSV,New Target
Group,"prop.one=firstproperty prop.two=secondproperty" 
10.0.0.11,Another Device from CSV,New Target 
Group,"prop.one=firstproperties 
prop.two=secondproperties"
  • Within the key-value pairing, the value can contain “=”. For example, the notation “A=B=C” represents a key=value property in which “A” is the key and “B=C” is the value.
  • Once the required headers “IP” and “displayname” are configured, a resource is added to your account even if properties are misconfigured.
  • CSV files are separated by commas, to include a comma within an individual CSV cell, you must surround that cell with double quotation marks.
  • If you need to include quotes within a cell, they must be escaped by surrounding the quotes with another set of double quotes per CSV standards, as shown in the following example.
IP,displayname,hostgroup,properties
10.0.0.10,Device from CSV,New Target 
Group,"prop.one=""firstproperty""
prop.two=""secondproperty"""
  • If a cell includes a multi-line string, the entire string should be surrounded by double quotes.
  • Once added to your account, the prefix “system.” will be removed from the resource properties. System auto-properties are an exception, these properties include: system.ips, system.sysinfo, system.sysoid, system.db.mysql, system.db.mssql, system.db.oracle, system.db.db2, system.ec2.resourceid, system.ec2.region, and system.virtualization.
    If the prefix “systems” is absent from these properties, it will be appended to them upon discovery.

Note: You can download the LogicMonitor CSV NetScan template if required.

In This Article