Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

MIDServerFinder- Global

The MIDServerFinder script include provides methods to find a list of MID Servers for specified IP addresses.

Use in server scripts to get the MID Server list.

Parent Topic:Server API reference

MIDServerFinder - MIDServerFinder()

Creates an instance of MIDServerFinder.

NameTypeDescription
None  
TypeDescription
void 

MIDServerFinder - getMIDServers()

Gets the names of MID servers available for a given range and capability.

NameTypeDescription
None  
TypeDescription
ArrayAn array of MID server names. If no MID servers are available, returns an empty array.
var msf = new MIDServerFinder();
msf.setRanges('10.10.10.1-10.10.11.254');
var msnames = msf.getMIDServers();

for(var i=0; i<msnames.length; i++) {
  gs.print(msnames[i]);
};

MIDServerFinder - getMIDServersBySysId()

Gets the sys_ids of MID servers available for a given range and capability.

NameTypeDescription
None  
TypeDescription
ArrayAn array of MID server sys_ids. If no MID servers are available, returns an empty array.
var msf = new MIDServerFinder();
msf.setRanges('10.10.10.1-10.10.11.254');
var msids = msf.getMIDServersBySysId();

for(var i=0; i<msids.length; i++) {
  gs.print(msids[i]);
};

MIDServerFinder - getStatusMessage()

Gets the state of the finder operation.

NameTypeDescription
None  
TypeDescription
StringThe status message
var msf = new MIDServerFinder();
gs.print(msf.getStatusMessage());

MIDServerFinder - setActive(Boolean flag)

Sets whether to look for active or inactive MID servers. By default, searches are for active MID servers unless inactive is specified by this method.

NameTypeDescription
flagBooleanIf true, look for inactive MID servers. If false, do not look for inactive MID servers.
TypeDescription
void 
var msf = new MIDServerFinder();
msf.setActive('true');

MIDServerFinder - setCapabilities(Array capabilities)

Sets the technologies for which to look.

NameTypeDescription
capabilitiesArrayContains a list of capabilities, for example - capabilities = ["ssh","wmi","snmp",{"os_domain":"disco"},{"phase":1}];
TypeDescription
void 
var msf = new MIDServerFinder();
msf.setRanges('10.10.10.1-10.10.11.254');
var capab = ["ssh","wmi","snmp"];
msf.setCapabilities(capab);

MIDServerFinder - setDebug(Boolean onOrOff)

Turns debugging on or off.

NameTypeDescription
onOrOffBooleanTrue to turn on debugging; false to turn debugging off.
TypeDescription
void 
var msf = new MIDServerFinder();
msf.setDebug('true');

MIDServerFinder - setRanges(String ranges)

Sets the range of IP addresses for which to look.

NameTypeDescription
rangesStringA comma-separated list in one of these formats. - IP addresses \(10.10.10.1, 10.10.10.2\) - IP networks \(10.10.10.0/23\) - IP ranges \(10.10.10.1-10.10.11.254\)
TypeDescription
void 
var msf = new MIDServerFinder();
msf.setRanges('10.10.10.1-10.10.11.254');

MIDServerFinder - setRangesByIPOrHostname(String ipOrHostname)

Determines if the input is a single IP or a hostname, and passes the IP or multiple IPs to the setRanges() method.

If the value of ipOrHostname is an IP address, it is passed into the setRanges() method. It the value is a hostname, we look up the DNS table (cmdb_ip_address_dns_name) to try resolving the hostname. The result, either an IP or multiple IPs, is then passes into the setRanges() method.

NameTypeDescription
ipOrHostnameStringThe IP address, IP range, or host name.
TypeDescription
void 
var msf = new MIDServerFinder();
msf.setRangesByIPOrHostname('10.10.10.1-10.10.11.254');