DhcpMonitor

Use this monitor to check the availability and functionality of DHCP servers. The monitor class DhcpMonitor is executed by Pollerd and opens the background process listening for incoming DHCP responses. A DHCP server is tested by sending a DISCOVER message. If the DHCP server responds with an OFFER, the service is marked as up. The background listening process is started only if the DhcpMonitor is used. You can modify the behavior for testing the DHCP server in the poller-configuration.xml configuration file.

Make sure no DHCP client is running on the Horizon server and using port UDP/67 and UDP/68. If UDP/67 and UDP/68 are already in use, you will find warning messages in your log files. You can test if a process is listening on UDP/68 with sudo ss -lnpu sport = :68.

Monitor Facts

Class Name

org.opennms.netmgt.poller.monitors.DhcpMonitor

Remote Enabled

true

This monitor implements the Common Configuration Parameters.

DhcpMonitor configuration

Table 1. DhcpMonitor parameters in poller-configuration.xml.

Parameter

Description

Required

Default value

macAddress

The MAC address which Horizon uses for a DHCP request

optional

00:06:0D:BE:9C:B2

relayMode

Puts the poller in relay mode

optional

false

myIpAddress

This parameter will usually be set to the IP address of the Horizon server, If relayMode is set to true. In relay mode, the DHCP server being polled will unicast its responses directly back to the IP address specified by myIpAddress rather than broadcasting its responses. This lets DHCP servers be polled even though they are not on the same subnet as the Horizon server, and without the aid of an external relay.

optional

127.0.0.1

extendedMode

When extendedMode is false, the DHCP poller will send a DISCOVER and expect an OFFER in return. When extendedMode is true, the DHCP poller will first send a DISCOVER. If no valid response is received it will send an INFORM. If no valid response is received it will then send a REQUEST. OFFER, ACK, and NAK are all considered valid responses in extendedMode.

optional

false

requestIpAddress

This parameter applies only to REQUEST queries sent to the DHCP server when extendedMode is true. The IP address specified will be requested in the query.

optional

127.0.0.1

rrd-repository

The location to write RRD data. Generally, you will not want to change this from the default.

required

${OPENNMS_HOME}/share/rrd/response

rrd-base-name

The name of the RRD file to write (minus the extension, .rrd or .jrb)

required

dhcp

ds-name

This is the name as reference for this particular data source in the RRD file.

required

dhcp

02 01 dhcp monitor messages broadcast
Figure 1. Visualization of DHCP message flow in broadcast mode
02 02 dhcp monitor messages unicast
Figure 2. Visualization of DHCP message flow in relay mode

Example testing DHCP server in the same subnet

Example configuration on how to configure the monitor in the poller-configuration.xml. The monitor will try to send a maximum of 3 DISCOVER messages and waits 3 seconds for the DHCP server OFFER message.

Configure a DHCP service in poller-configuration.xml
<service name="DHCP" interval="300000" user-defined="false" status="on">
 <parameter key="retry" value="2" />
 <parameter key="timeout" value="3000" />
 <parameter key="relayMode" value="false"/>
 <parameter key="extendedMode" value="false"/>
 <parameter key="rrd-repository" value="/opt/opennms/share/rrd/response" />
 <parameter key="rrd-base-name" value="dhcp" />
 <parameter key="ds-name" value="dhcp" />
</service>

<monitor service="DHCP" class-name="org.opennms.netmgt.poller.monitors.DhcpMonitor"/>

Example testing DHCP server in a different subnet in extended mode

You can use the same monitor in poller-configuration.xml as in the example above.

Configure DhcpMonitor to test DHCP server in a different subnet. The OFFER from the DHCP server is sent to myIpAddress.
<service name="DHCP" interval="300000" user-defined="false" status="on">
 <parameter key="retry" value="2" />
 <parameter key="timeout" value="3000" />
 <parameter key="relayMode" value="true"/>
 <parameter key="extendedMode" value="false"/>
 <parameter key="myIpAddress" value="1.2.3.4"/>
 <parameter key="rrd-repository" value="/opt/opennms/share/rrd/response" />
 <parameter key="rrd-base-name" value="dhcp" />
 <parameter key="ds-name" value="dhcp" />
</service>

<monitor service="DHCP" class-name="org.opennms.netmgt.poller.monitors.DhcpMonitor"/>
If in extendedMode, the time required to complete the poll for an unresponsive node is increased by a factor of 3. Thus it is a good idea to limit the number of retries to a small number.