
= HttpPostMonitor
:description: Learn about the HttpPostMonitor in OpenNMS {page-component-title} that lets you to HTTP Post any content to a remote URI.

If you need to HTTP POST any arbitrary content to a remote URI (for example, HTTP POST to a web API endpoint), use the HttpPostMonitor.

== Monitor facts

[cols="1,7"]
|===
| Class Name
| `org.opennms.netmgt.poller.monitors.HttpPostMonitor`
|===

== Configuration and use

.Monitor-specific parameters for the HttpPostMonitor
[options="header"]
[cols="1,3,2"]
|===
| Parameter
| Description
| Default

3+| *Required*

| payload
| The body of the POST; for example, properly escaped XML or JSON.
| n/a

3+|*Optional*

| auth-password kbd:[{}]
| The password to use for HTTP BASIC auth.
| n/a

| auth-username kbd:[{}]
| The username to use for HTTP BASIC auth.
| n/a

| header[0-9]+
| Additional headers to send with the request.
Example of valid parameter names are header0, header1, and header180. +
`header` is not a valid parameter name.
| n/a

| banner kbd:[{}]
| 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 `~`.
| n/a

| charset
| Set the character set for the POST.
| UTF-8

| mimetype
| Set the mimetype for the POST.
| text/xml

| port
| The port for the web server to send the POST.
| 80

| scheme
| The connection scheme to use.
| http

| usesslfilter
| Enables or disables the SSL certificate validation.
Valid options: `true` or `false`
| false

| uri kbd:[{}]
| The uri to use during the POST.
| n/a

| use-system-proxy
| Specifies if the system-wide proxy settings be used.
The system proxy settings can be configured in <<system-properties/introduction.adoc#system-properties[system properties]
| false
|===

kbd:[{}] _indicates the parameter supports <<reference:service-assurance/introduction.adoc#ref-service-assurance-monitors-placeholder-substitution-parameters, placeholder substitution>>._

This monitor implements the <<reference:service-assurance/introduction.adoc#ref-service-assurance-monitors-common-parameters, Common Configuration Parameters>>.

== Examples

The following example creates a POST that contains the payload `World`.

Note that you must include the `monitor` section for each service in your definition.

[source, xml]
----
<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:

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

World
----
