HttpCollector

The HttpCollector collects performance data via HTTP and HTTPS. Attributes are extracted from the HTTP responses using a regular expression.

Collector facts

Class Name

org.opennms.netmgt.collectd.HttpCollector

Package

core

Supported on Minion

Yes

Configuration Files

$OPENNMS_HOME/etc/http-datacollection-config.xml

Configuration and use

Table 1. Collector-specific parameters for the HttpCollector
Parameter Description Default

Required

collection

The name of the HTTP Collection to use.

n/a

Optional

thresholding-enabled

Whether collected performance data should be tested against thresholds.

true

port

Override the default port in all of the URIs.

80

timeout

Connection and socket timeout in milliseconds

3000

retry

Number of retries

2

use-system-proxy

Should the system-wide proxy settings be used? Configure system proxy settings via system properties.

false

trust-store

Path to a keystore file that contains the CA or server certificates to trust for HTTPS URIs. When set, server certificates are validated; see HTTPS and mutual TLS.

n/a

trust-store-type

Type of the truststore file (for example, PKCS12 or JKS).

PKCS12

trust-store-password

Password of the truststore file.

n/a

key-store

Path to a keystore file that contains a client certificate and its private key. When set, the certificate is presented to servers that request one (mutual TLS).

n/a

key-store-type

Type of the keystore file (for example, PKCS12 or JKS).

PKCS12

key-store-password

Password of the keystore file.

n/a

key-password

Password of the private key, if it differs from the keystore password.

The key-store-password value.

hostname-verification

Whether to verify that the server certificate matches the host in the URI. This applies only when trust-store or key-store is set.

true

HTTPS and mutual TLS

By default, the HttpCollector accepts any server certificate for HTTPS URIs, without validation. This historical behavior is unchanged.

Setting trust-store and/or key-store switches the collector to validated TLS: the server certificate is checked against the truststore (or the JVM’s default trust anchors when only key-store is set), the certificate’s hostname is verified, and the client certificate from the keystore is presented to servers that request one (mutual TLS).

The keystore and truststore files must be readable by the Horizon process. If a Minion performs the collection, the files must also exist at the same path on that Minion; they are not distributed automatically.

To avoid storing passwords in plain text, store them in the Secure Credentials Vault and reference them as ${scv:alias:key}.

When key-store is set, HTTP redirects are followed only when the target keeps the same scheme, host, and port as the original URI, so that the client certificate is not presented to other services.

HTTP collection configuration

Understanding resource types helps when editing collector-specific configuration files.

Define HTTP Collections in etc/http-datacollection-config.xml.

This snippet provides a collection definition named opennms-copyright:

<http-collection name="opennms-copyright">
  <rrd step="300">
    <rra>RRA:AVERAGE:0.5:1:2016</rra>
    <rra>RRA:AVERAGE:0.5:12:1488</rra>
    <rra>RRA:AVERAGE:0.5:288:366</rra>
    <rra>RRA:MAX:0.5:288:366</rra>
    <rra>RRA:MIN:0.5:288:366</rra>
  </rrd>
  <uris>
    <uri name="login-page">
      <url path="/opennms/login.jsp" matches=".*2002\-([0-9]+).*" response-range="100-399" dotall="true" >
      </url>
      <attributes>
        <attrib alias="copyrightYear" match-group="1" type="gauge"/>
      </attributes>
    </uri>
  </uris>
</http-collection>
Metadata expressions can also be used in attributes of the http-datacollection-config.xml configuration file. This lets the user to also reference credentials stored in the secure credentials.

Once added to etc/http-datacollection-config.xml, you can use the collect command available in the Karaf shell to test it:

opennms:collect org.opennms.netmgt.collectd.HttpCollector 127.0.0.1 collection=opennms-copyright port=8980