MIDServerFinder - Global

Finds a list of MID servers for given IP addresses.

Use in server scripts to get the server list.

MIDServerFinder - getMIDServers()

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

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
Array An 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.

Table 3. Parameters
Name Type Description
None
Table 4. Returns
Type Description
Array An 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.

Table 5. Parameters
Name Type Description
None
Table 6. Returns
Type Description
String The status message
var msf = new MIDServerFinder();
gs.print(msf.getStatusMessage());

MIDServerFinder - MIDServerFinder()

Creates an instance of MIDServerFinder.

Table 7. Parameters
Name Type Description
None
Table 8. Returns
Type Description
void

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.

Table 9. Parameters
Name Type Description
flag Boolean If true, look for inactive MID servers. If false, do not look for inactive MID servers.
Table 10. Returns
Type Description
void
var msf = new MIDServerFinder();
msf.setActive('true');

MIDServerFinder - setCapabilities(Array capabilities)

Sets the technologies for which to look.

Table 11. Parameters
Name Type Description
capabilities Array Contains a list of capabilities, for example - capabilities = ["ssh","wmi","snmp",{"os_domain":"disco"},{"phase":1}];
Table 12. Returns
Type Description
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.

Table 13. Parameters
Name Type Description
onOrOff Boolean True to turn on debugging; false to turn debugging off.
Table 14. Returns
Type Description
void
var msf = new MIDServerFinder();
msf.setDebug('true');

MIDServerFinder - setRanges(String ranges)

Sets the range of IP addresses for which to look.

Table 15. Parameters
Name Type Description
ranges String A 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)
Table 16. Returns
Type Description
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.

Table 17. Parameters
Name Type Description
ipOrHostname String The IP address, IP range, or host name.
Table 18. Returns
Type Description
void
var msf = new MIDServerFinder();
msf.setRangesByIPOrHostname('10.10.10.1-10.10.11.254');