Skip to content

selsky/nagmq

This branch is 74 commits behind jbreams/nagmq:master.

Folders and files

NameName
Last commit message
Last commit date
Jun 30, 2012
Dec 23, 2013
Dec 19, 2013
Dec 23, 2013
Dec 1, 2012
Mar 6, 2012
Apr 4, 2012
Dec 18, 2013
Jan 15, 2013
Dec 23, 2013
Nov 22, 2012
Nov 22, 2012
Jan 1, 2013
Dec 18, 2013
Dec 20, 2013
Mar 12, 2012
May 2, 2012
Dec 23, 2013
Dec 23, 2013
Apr 7, 2013
Feb 26, 2012

Repository files navigation

NagMQ README

NagMQ is an event broker that exposes the internal state and events of Nagios to endpoings on a ZeroMQ message bus.

Nagios objects and events are available as JSON. The broker exposes three sockets, all of which are optional:

  • Publisher - Publishes events coming out of the event broker in real-time
  • Pull - Receives passive checks and commands, like the Nagios command pipe
  • Request - Sends state data on demand to clients

There is a distributed DNX-style executor (mqexec) designed to have as many workers (possibly at the edge as an NRPE-replacement) and job brokers as you want. It can also submit its results to more than one Nagios instance. Each worker can filter what checks it runs based on any field in the service/host check and event handler initiate messages from the publisher.

It also comes with sample scripts written in Python to provide replacements for nsca, nrpe, and a handy CLI which talk to the bus instead of status.dat.

NagMQ is licensed under the Apache Version 2 license; see LICENSE in the source distribution for details.

Visit https://groups.google.com/d/forum/nagmq for questions and announcements.

Compilation and Installation

Compile this from the Git repo by running:

$ autoreconf -i
$ ./configure
$ make
$ make install

Add the path to the installed broker to your nagios.cfg with the path to the NagMQ config file as the broker parameter:

# EVENT BROKER MODULE(S)
...
broker_module=/usr/local/lib/nagmq/nagmq.so /etc/nagios/nagmq.config
#broker_module=/somewhere/module1.o
#broker_module=/somewhere/module2.o arg1 arg2=3 debug=0

The NagMQ config file should be a JSON file that tells what message busses the broker should connect/bind to. Each endpoint can connect and or bind to any number of addresses - if you want to connect or bind to more than one address, list them as an array.:

{
        "publish": {
                "bind": "ipc:///var/nagios/nagmqevents.sock",
                "override": [ "service_check_initiate", "host_check_initiate" ]
        },
        "pull": {
                "bind": [ "ipc:///var/nagios/nagmqcommands.sock", "tcp://*:5556" ],
                "tcpacceptfilters": [ "localhost", "failoverhost" ]
        },
        "reply": {
                "bind": [ "ipc:///var/nagios/nagmqstate.sock", "tcp://*:5557" ],
                "tcpacceptfilters": [ "localhost", "failoverhost" ]
        },
        "executor": {
                "filter": {
                        "match": "localhost",
                        "field": "host_name"},
                "jobs": "ipc:///var/nagios/mqexecjobs.sock",
                "results": "ipc:///var/nagios/mqexecresults.sock"
        },
        "cli": {
                "pull": "tcp://localhost:5556",
                "reply": "tcp://localhost:5557"
        },
        "devices": [
                [ { "backend": { "type": "push", "bind":"tcp://*:5558", "noblock":true,
                        "tcpacceptfilters": [ "localhost", "failoverhost" ] },
                        "frontend": { "type": "sub", "connect":"ipc:///var/nagios/nagmqevents.sock",
                                "subscribe": [ "service_check_initiate", "host_check_initiate" ] } },
                { "backend": { "type": "pull", "connect":"tcp://masterhost:5558" },
                        "frontend": { "type":"push", "bind": "ipc:///var/nagios/mqexecjobs.sock" } },
                { "backend": { "type": "push", "connect":"tcp://masterhost:5556" },
                        "frontend": { "type":"pull", "bind": "ipc:///var/nagios/mqexecresults.sock" } } ]
        ]
}

Start the dnxmq broker and worker:

$ mqbroker /etc/nagios/nagmq.config $ mqexec /etc/nagios/nagmq.config

Restart Nagios, and you'll be able to connect to the message busses and get data into and out of the broker!

If you do NOT wish to use dnxmq, remove the "override" directive from the sample "publisher" config.

About

Nagios Message Queue Plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 89.9%
  • Python 9.6%
  • Other 0.5%