HttpPostMonitor

If it is required to HTTP POST any arbitrary content to a remote URI, the HttpPostMonitor can be used. A use case is to HTTP POST to a SOAP endpoint. This monitor implements placeholder substitution in parameter values.

Monitor Facts

Class Name

org.opennms.netmgt.poller.monitors.HttpPostMonitor

Remote Enabled

false

Configuration and Use

Table 1. Monitor specific parameters for the HttpPostMonitor
Parameter Description Required Default value Placeholder substitution

payload

The body of the POST, for example properly escaped XML.

required

-

No

auth-password

The password to use for HTTP BASIC auth.

optional

-

Yes

auth-username

The username to use for HTTP BASIC auth.

optional

-

Yes

header[0-9]+

Additional headers to be sent along with the request. Example of valid parameter’s names are header0, header1 and header180.
header is not a valid parameter name.

optional

-

No

banner

A string that is matched against the response of the HTTP POST. If the output contains the banner, the service is determined as up. Specify a regex by starting with ~.

optional

-

Yes

charset

Set the character set for the POST.

optional

UTF-8

No

mimetype

Set the mimetype for the POST.

optional

text/xml

No

port

The port for the web server where the POST is send to.

optional

80

No

scheme

The connection scheme to use.

optional

http

No

usesslfilter

Enables or disables the SSL ceritificate validation. true - false

optional

false

No

uri

The uri to use during the POST.

optional

/

Yes

use-system-proxy

Should the system wide proxy settings be used? The system proxy settings can be configured in <<system-properties/introduction.adoc#ga-opennms-system-properties[system properties]

optional

false

No

This monitor implements the Common Configuration Parameters.

Examples

The following example would create a POST that contains the payload Word.

<service name="MyServlet" interval="300000" user-defined="false" status="on">
  <parameter key="banner" value="Hello"/>
  <parameter key="port" value="8080"/>
  <parameter key="uri" value="/MyServlet">
  <parameter key="payload" value="World"/>
  <parameter key="retry" value="1"/>
  <parameter key="timeout" value="30000"/>
</service>
<monitor service="MyServlet" class-name="org.opennms.netmgt.poller.monitors.HttpPostMonitor"/>

The resulting POST looks like this:

POST /MyServlet HTTP/1.1
Content-Type: text/xml; charset=utf-8
Host: <ip_addr_of_interface>:8080
Connection: Keep-Alive

World