Setup

This is a short description of how to setup Nagios Message Broker to work with your local Nagios installation.

Enabling Passive Checks

In order to enable passive checks in Nagios, you'll need to do the following:

  • Set accept_passive_service_checks directive to 1.
  • Set the passive_checks_enabled directive in your host and service definitions to 1.

Enabling External Commands

If you want to schedule service checks through Nagios Message Broker you have to enable external commands in Nagios.

In order to have Nagios process external commands, make sure you do the following:

  • Enable external command checking with the check_external_commands option.
  • Set the frequency of command checks with the command_check_interval option.
  • Specify the location of the command file with the command_file option.
  • Setup proper permissions on the directory containing the external command file, as described in the quickstart guide.

Configure Nagios Message Broker

Nagios Message Broker uses a XML configuration file which defines the MBeans, JMX notifications, matchers and actions. See also the schema file for further information.

<?xml version="1.0" encoding="UTF-8"?>
<nmb:xmlConfiguration xmlns:nmb="http://www.syabru.ch/nagios-msg-broker/1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.syabru.ch/nagios-msg-broker/1.0
        http://snippets.syabru.ch/nagios-msg-broker/schema/nagios-msg-broker-1_0.xsd">
  <nmb:jmx>
    <nmb:mBeanServer>
      <nmb:jmxServiceUrl>service:jmx:rmi:///jndi/rmi://localhost:35001/jmxrmi</nmb:jmxServiceUrl>
      <nmb:notification>
        <nmb:objectName>ch.syabru.nagios.broker:type=TestMockMBean</nmb:objectName>
        <nmb:match/>
        <nmb:action>
          <nmb:processServiceCheckResult>
            <nmb:hostName>localhost</nmb:hostName>
            <nmb:serviceDescription>Test Process Service Check Result</nmb:serviceDescription>
            <nmb:returnCode>0</nmb:returnCode>
            <nmb:pluginOutput>OK - Test</nmb:pluginOutput>
          </nmb:processServiceCheckResult>
          <nmb:scheduleServiceCheck>
            <nmb:hostName>localhost</nmb:hostName>
            <nmb:serviceDescription>Test Schedule Service Check Result</nmb:serviceDescription>
          </nmb:scheduleServiceCheck>
        </nmb:action>
      </nmb:notification>
    </nmb:mBeanServer>
  </nmb:jmx>
</nmb:xmlConfiguration>

Note: A service definition must exist in Nagios before you can submit passive check results for it! Nagios will ignore all check results for services that had not been configured before it was last (re)started.

Running Nagios Message Broker

The Nagios Message Broker can either be run from the command line or as a service/daemon.