nag2mqtt - Nagios event broker to MQTT gateway

Contents:

About

nag2mqtt consists of a Nagios Event Broker (NEB) module and a small perl daemon. The NEB module publishes all check results in the local filesystem (using tmpfs is highly recommended). These file are than publish by the perl daemon to a MQTT broker.

By publishing the check results via MQTT it is possible to visualize the Nagios check states and performance data in SNMD using the snmd-widgets-nagios widgets.

Authors

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Installation

Prerequisites

You need a running Nagios Core setup or an extension like Check_MK.

Perl

nag2sms has several dependencies on Perl modules available in CPAN. Although most modules are already packaged, Debian lacks a package for the AnyEvent::MQTT module. You can build it by using dh-make-perl:

  • install packages libanyevent-perl and dh-make-perl to build the missing Debian packages from CPAN modules
# apt-get install libanyevent-perl dh-make-perl
  • build Net::MQTT required for AnyEvent::MQTT
$ cpan2deb Net::MQTT --version 1.163170
  • install Net::MQTT
# dpkg -i libnet-mqtt-perl_1.163170_all.deb
  • build AnyEvent::MQTT
$ cpan2deb AnyEvent::MQTT --depends libnet-mqtt-perl
  • install AnyEvent::MQTT
# dpkg -i libanyevent-mqtt-perl_1.172121-1_all.deb

Installation

To install nag2mqtt on Debian GNU/Linux it is recommended to use the prebuild package:

# dpkg -i nag2mqtt_0.4_amd64.deb
# apt-get install -f

For non-Debian systems you need to build nag2mqtt from the sources.

Configuration

NEB Plugin

nag2mqttd

You need to configure the nag2mqtt.conf to fit your needs (Perl syntax):

/etc/nag2mqtt/nag2mqtt.conf
# Directory used by NEB plugin (neb2mqtt.so)
#$conf{base_dir} = q(/run/nag2mqtt/publish);

# MQTT topic used by nag2mqttd
#$conf{base_topic} = q(nagios);

# MQTT broker host
#$mqtt_conf{host} = q(localhost);

# MQTT last will topic
#$mqtt_conf{will_topic} = q(nagios/hosts/).hostname;

# MQTT client ID
#$mqtt_conf{client_id} = q(nag2mqtt);

# MQTT user name
#$mqtt_conf{user_name} = 'foo';

# MQTT password
#$mqtt_conf{password} = 'secret';


# DO NOT REMOVE
1;