HTTPMonitor
Subscribe

From OpenNMS

(Redirected from HTTP monitor)
Jump to: navigation, search

Contents

HTTP Monitor Parameters

ds-name
user-agent
basic-authentication
host-name
response-text 
Text to look for in the response body. This will be matched against every line, and it will be considered a success at the first match. If there is a "~" at the beginning of the parameter, the rest of the string will be used as a regular expression pattern match, otherwise the match will be a substring match. Note: the regular expression match is anchored at the beginning and end of the line, so you will likely need to put a ".*" on both sides of your pattern unless you are going to be matching on the entire line.
response
rrd-repository
port
timeout
retry
url
verbose

Example config

<!-- Test for virtual host opennms.com running -->
<service name="HTTP" interval="300000" user-defined="false" status="on">
  <parameter key="retry" value="1"/>
  <parameter key="timeout" value="3000"/>
  <parameter key="port" value="80"/>
  <parameter key="host-name" value="opennms.com"/>
  <parameter key="url" value="/solutions"/>
  <parameter key="response" value="200-202,299"/>
  <parameter key="response-text" value="~.*[Cc]onsulting.*"/>
</service>

<!-- Test for instance of OpenNMS 1.2.9 running -->
<service name="OpenNMS" interval="300000" user-defined="false" status="on">
  <parameter key="retry" value="1"/>
  <parameter key="timeout" value="3000"/>
  <parameter key="port" value="8080"/>
  <parameter key="url" value="/opennms/event/list"/>
  <parameter key="basic-authentication" value="admin:admin"/>
  <parameter key="response" value="200"/>
</service>

Note that the default acceptable responses are the following: When monitoring the "/" URL path: 100-499 When monitoring any other URL path: 100-399

Non-root URLs

In order to configure a poller that tests a non-root URL, you need to configure capsd to discover the service and pollerd to poll the discovered service (two different things). Below is an example using ColdFusion.

capsd-configuration.xml

It's perfectly acceptable to have multiple instances of the same protocol-plugin class-name, but they will need different protocol attributes. For example, you may have several protocol-plugins defined for HTTP, all using the same HttpPlugin class. You will, however, need to make sure that they have distinct protocol attributes.

<protocol-plugin protocol="ColdFusion"
                 class-name="org.opennms.netmgt.capsd.HttpPlugin"
                 scan="on" user-defined="false">
  <property key="port" value="80"/>
  <property key="timeout" value="3000"/>
  <property key="retry" value="2"/>
  <property key="url" value="/cfide/administrator/index.cfm"/>
</protocol-plugin>

poller-configuration.xml

now that you've discovered the service, you'll need to poll it. Note that, just as for capsd discovery, it's prefectly accpetable to have multiple instances of the same poller class, but they will need different names. For example, you may have several pollers testing HTTP services, all using the same HttpMonitor class. You will, however need to make sure that they have distinct service names.

<service name="ColdFusion" interval="300000"
         user-defined="false" status="on">
  <parameter key="retry" value="3"/>
  <parameter key="timeout" value="10000"/>
  <parameter key="port" value="80"/>
  <parameter key="url" value="/cfide/administrator/index.cfm"/>
</service>

Important Notes:

  • The name attribute of the service in poller-configuration.xml needs to match the protocol attribute of the protocol-plugin in capsd-configuration.xml.
  • The ds-name attribute (not shown in this example) also needs to be unique for each service, or you'll find response time from one service overwriting response time from another.
  • You'll also need a line to map the new service to a monitor class (see at the end of the file):
<monitor service="ColdFusion"         class-name="org.opennms.netmgt.poller.monitors.HttpMonitor"/>

Note: This only works in 1.2.4 or later.

Stupid HttpMonitor Tricks

Testing_Filtering_Proxies_With_HTTPMonitor

Links