HTTP Active Discovery
When configuring a multi-instance DataSource, you have the option of enabling Active Discovery and subsequently defining the protocol (e.g. SNMP, WMI, HTTP, etc.) employed by Active Discovery to find instances.
In this support article, we'll overview the HTTP Active Discovery method, its various parameters, and the two modes it supports: Note: HTTP Active Discovery does not support authentication. If your HTTP endpoint requires authentication, you must script Active Discovery.
In this support article, we'll overview the HTTP Active Discovery method, its various parameters, and the two modes it supports:
Note: HTTP Active Discovery does not support authentication. If your HTTP endpoint requires authentication, you must script Active Discovery.
HTTP Active Discovery Parameters
The HTTP method of Active Discovery parameters include the following configurations.
HTTP URL (required): A URL to send to the target server during discovery. For example, if URL is '/server-status', an HTTP request like the following will be sent to the target server:
GET /server-status HTTP/1.0 Connection: close User-Collector: LogicMonitorCollector/1.0
- Regular Expression (required): If HTTP Active Discovery is running in extracting mode, this should be a regular expression containing a backreference, e.g. "Customer ID: (\d+)" where "(\d+)" is the captured substring. The HTTP method of Active Discovery applies the regular expression against the response to capture all matches and return them as the instances.
- Follow Redirect (optional): By default, HTTP Active Discovery processes the response only when the response status code is 2xx. Otherwise, it will report an error. If you set followRedirect to 'true', HTTP Active Discovery will follow HTTP redirects to the new location to fetch the final response, and process that as if it was returned in response to the original request.
- Use SSL (optional): By default, HTTP Active Discovery sends requests to the target host in plain text. You can set ssl to 'true' to cause it to talk to the web server via SSL on port 443.
- Match Case-sensitivity (optional): You can select this option to force the match in a case-sensitive manner.
- Port # List: If empty, HTTP discovery will work in extracting mode, otherwise HTTP discovery will work in port mode. This field specifies a list of port numbers to which Active Discovery sends request. The ports can be a single port number (e.g. 80), multiple port numbers separated by comma (e.g. 80,8080,8888), a port range (e.g. 8080-8100), or several port numbers and ranges separated by commas (e.g. 8080 - 8100, 80, 8000).
In extracting mode, the user needs to specify a URL and a regular expression that returns a substring via a capture group, but leave the port list empty.
The HTTP Active Discovery method will send a HTTP request to the target server to get the specified URI, and applies the regex against the response (including headers and payload) to extract instances that match the substring. Each returned substring that matches the backreference will be a discovered instance.
- HTTP URL: A URL specifying the port and path, or just the path: e.g. https://##HOSTNAME##:8443/customers or /customers (to use port 80)
- Regular Expression: specifies the text to match and the capture group. Each matching occurrence of the capture group is returned as an instance.
Example: Find all customers
Imagine that a web page "/customer-list" that contains the ID of all customers, and returns output similar to the following:
customer id: 1234 customer id: 2345 customer id: 3456
A datasource needs those customer IDs as its instances. In this case, the HTTP Active Discovery method would specify parameters as below:
Active Discovery will send an HTTP request "/customer-list" to the host, and apply the regex "customer id: (\d+)" to the response. This regex will capture three IDs (1234, 2345, 3456) in the page and return them as instances to be monitored.
When working in port mode, the user specifies a port list, a URI, and a regex (note: the regex in port mode doesn't need to capture a substring). Active Discovery will send an HTTP request to each port in the port list, and apply the regex to the response (including headers and payload). The port will be returned as an instance if a substring in the HTTP response from that port matches the regex.
Example: Find all Apache instances
For example, if a company runs Apache on different ports on different servers, possibly with multiple Apache processes on the same server, port mode can be used to detect this.
An Apache server supports a status page (/server-status) that will report statistics about the server usage. The Apache datasource Active Discovery can be defined as follows:
Active Discovery will send "/server-status" to each port in the range 80 through 83, and check if the response has a substring matching the regular expression ">Apache Status<". If so, it will return that port as one of instances.