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.

Monitor facts

Class Name

org.opennms.netmgt.poller.monitors.HttpPostMonitor

Remote Enabled

false

Configuration and Usage
Table 1. Monitor specific parameters for the HttpPostMonitor
Parameter Description Required Default value

payload

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

required

-

auth-password

The password to use for HTTP BASIC auth.

optional

-

auth-username

The username to use for HTTP BASIC auth.

optional

-

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

-

charset

Set the character set for the POST.

optional

UTF-8

mimetype

Set the mimetype for the POST.

optional

text/xml

port

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

optional

80

scheme

The connection scheme to use.

optional

http

usesslfilter

Enables or disables the SSL ceritificate validation. true - false

optional

false

uri

The uri to use during the POST.

optional

/

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