jbreams / nagmq Goto Github PK
View Code? Open in Web Editor NEWNagios Message Queue Plugin
License: Other
Nagios Message Queue Plugin
License: Other
As far as I could see there's no mention in the README or anywhere about needing libev, jansson, and which version of 0MQ is needed.
Obviously continually re-running ./configure will tell you some of this but it's a bit tedious, and the latency is high if you're building in a clean chroot (e.g. mock on RHEL)
Hi,
I compiled NagMQ module for Nagios 3 and Nagios 4 and integrated it, it seems to work correctly but when it is integrated, on both Nagios versions, the standard console is not updated although I see from the debug logs and status.dat that commands are issued and monitoring performed.
Is that an expected behaviour?
Thanks,
~Q
Hello
Unless I'm doing something wrong, seems like there is a 'm4' folder missing:
marc@monoxide:% git clone https://github.com/jbreams/nagmq.git% cd nagmq/
Cloning into 'nagmq'...
remote: Counting objects: 2126, done.
remote: Compressing objects: 100% (945/945), done.
remote: Total 2126 (delta 1038), reused 2068 (delta 986)
Receiving objects: 100% (2126/2126), 964.24 KiB | 638 KiB/s, done.
Resolving deltas: 100% (1038/1038), done.
marc@monoxide:
marc@monoxide:~/nagmq% autoreconf -i
aclocal: error: couldn't open directory 'm4': No such file or directory
autoreconf: aclocal failed with exit status: 1
The request module of the event broker doesn't work when running in its own dedicated thread. Works fine when running in the recv thread.
Hi,
I've found a little issue : when you try to reload or stop Nagios with NagMQ, it do a segfault @ 0 (null pointer).
You can reproduce this case by using this configuration :
{
"publish": {
"enable": true,
"bind": "tcp://*:7777"
},
"pull": {
"enable": false
},
"reply": {
"enable": false
}
}
So :
The problem is in the function handle_startup() (in file mods/common.c) :
The function pthread_create() is called only if a "pull" or a "reply" socket is requested (line 328) but the function pthread_join() is called all the time when Nagios closes (line 353) :
zmq_close(pubext);
zmq_term(zmq_ctx);
pthread_join(threadid, NULL); // segfault because threadid is not initialised
}
return 0;
}
Here is a little patch :)
zmq_close(pubext);
zmq_term(zmq_ctx);
if(enablereq || enablepull)
pthread_join(threadid, NULL);
}
return 0;
}
Regards,
Michaël
RHEL 6.8
Nagios 4.2.0
selinux permissive
When I have the broker module enabled in the nagios.cfg nagios dies with a SIGSEGV in about a minute after starting.
an strace -f doesn't give much insight.
I'm wondering if you could take a stab at what might be causing it.
After seeing this error:
$ sudo mqexec /etc/nagios/nagmq.config -v
Error getting config Unexpected format character '?'
I've found that my default Ubuntu repositories didn't have a recent enough version of lib jansson.
Ubuntu 12.04.4 LTS 2.2.1-1
According to the documentation the '?' extension for optional matching was introduced with version 2.3, I've updated to 2.5 at mqbroker executed.
New in version 2.3: Any s representing a key may be suffixed with a ? to make the key optional. If the key is not found, nothing is extracted. See below for an example.
I have Nagios 3.5.1 on Ubuntu 14.04.1. I tried
./configure --with-nagios3-headers=~/nagios/include
It gets past the libev.h and jansson.h dependencies but then fails to recognize our Nagios 3.5.1 header files.
checking icinga.h usability... no
checking icinga.h presence... no
checking for icinga.h... no
checking nagios/nagios.h usability... no
checking nagios/nagios.h presence... no
checking for nagios/nagios.h... no
checking nagios/lib/libnagios.h usability... no
checking nagios/lib/libnagios.h presence... no
checking for nagios/lib/libnagios.h... no
configure: error: in `/home/rmagahiz/nagmq':
configure: error: Must supply headers/source to Nagios - see the README requirements section.
See `config.log' for more details
$ ls ~/nagios/include
broker.h common.h downtime.h locations.h.in nagios.h nebmodules.h perfdata.h snprintf.h.in
cgiauth.h compat.h epn_nagios.h logging.h nebcallbacks.h nebstructs.h shared.h sretention.h
cgiutils.h config.h getcgi.h macros.h neberrors.h netutils.h skiplist.h statusdata.h
comments.h config.h.in locations.h Makefile nebmods.h objects.h snprintf.h
I don't believe this is used in Nagios 3. I can get past this configure error if I download the Nagios 4.0.8 source and specify both --with-nagios3-headers and --with-nagios4-src, but then the make fails to find nebstructs.h
I tried to build against an alternate zeromq installation when I did my zmq2 vs zmq3 compatability testing, but the --with-zmq-headers=/tmp/zmq2 option did not work.
Hi Jonathan,
When one tries to schedule downtime using nag.py with specific start and end times, the actual downtime is scheduled for the wrong period.
E.g.:
$ nag.py -s "02-18 07:05" -d 1 add downtime check_win_memory_phsical@myhost
[check_win_memory_phsical@myhost]: Adding downtime for 0:01:00
The resultant downtime comment in Nagios appears as:
"This service has been scheduled for fixed downtime from 03-26-2036 14:33:16 to 03-26-2036 14:34:16. Notifications for the service will not be sent out during that time period."
This appears to be caused by time.strptime having a default year of 1900 when the year is not specified.
Setting starttime and endtime formats with %y- results in a correctly scheduled downtime window. E.g.:
$ diff nag.dbg.py /opt/nagmq-1.3/bin/nag.py
225,226c225
< starttime = datetime.strptime(opts.starttime, '%y-%m-%d %H:%M')
< print (starttime)
---
> starttime = datetime.strptime(opts.starttime, '%m-%d %H:%M')
247c246
< endtime = datetime.strptime(opts.endtime, '%y-%m-%d %H:%M')
---
> endtime = datetime.strptime(opts.endtime, '%m-%d %H:%M')
249c248
<
---
>
$ ./nag.dbg.py -s "14-02-18 07:14" -d 1 add downtime check_win_memory_phsical@myhost
2014-02-18 07:14:00
[check_win_memory_phsical@myhost]: Adding downtime for 0:01:00
The downtime comment in Nagios appears as:
"This service has been scheduled for fixed downtime from 02-18-2014 07:14:00 to 02-18-2014 07:15:00. Notifications for the service will not be sent out during that time period."
Hope things are going well,
ben
i am using nagmq broker with icinga but having a problem with nagmq sockets when issuing icinga reload.
no sockets are recreated if i issue reload:
if i do icinga restart then everything works as expected:
Nothing present in the icinga.debug log - loading and unloading of the module seems fine.
Reason = 1 (restart)
Reason = 2 (reload)
Any one else had this problem with nagios/icinga.
thanks.
Hi, I configured NagMQ and now I can send data from Nagios 3.5.1 to Logstash. I've been trying to include custom object variables but I cannot see them in the JSON messages received by Logstash.
An example nagios config
define service {
use local-service ; Name of service template to use
host_name localhost
service_description Total Processes
check_command check_local_procs!250!400!RSZDT
_test_field Hello
_extra_test_f fields
}
And an example message
{
"host_name":"localhost",
"service_description":"Total Processes",
"check_type":0,
"current_attempt":1,
"max_attempts":4,
"state":0,
"state_str":"OK",
"last_state":0,
"last_state_str":"OK",
"last_hard_state":0,
"last_hard_state_str":"OK",
"last_check":1449655226,
"last_state_change":1449236005,
"latency":0.08800,
"timeout":60,
"type":"service_check_processed",
"start_time":{
"tv_sec":1449655226,
"tv_usec":88354
},
"end_time":{
"tv_sec":1449655226,
"tv_usec":95962
},
"early_timeout":0,
"execution_time":0.00760,
"return_code":0,
"output":"PROCS OK: 104 processes with STATE = RSZDT",
"long_output":null,
"perf_data":null,
"timestamp":{
"tv_sec":1449655227,
"tv_usec":126969
},
"@Version":"1",
"@timestamp":"2015-12-09T10:00:27.143Z",
"host":"c89abd8a93a3"
}
Can you assist me in solving this issue?
The status output of nag.py should show whether each target is acknowledged, checks are disabled, flapping, etc.
I was wondering if it makes sense to use NagMQ to distribute checks to a bunch of Nagios servers behind a load balancer, current solutions for HA Nagios are really complex and do not scale beyond master/slave configuration.
If NagMQ can distribute results to multiple Nagios servers while avoiding redundant checks, this will enable horizontal scalability and at the same time high availability. The usual master/slave Nagios workaround can only scale until the master host is overloaded.
Any thoughts on how the configuration files should be both on the Nagios servers and on the Nagios clients?
Thanks!
[root@box nagmq]# make
Making all in mods
make[1]: Entering directory /opt/nagmq/mods' make all-am make[2]: Entering directory
/opt/nagmq/mods'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../dnxmq -I/opt/nagios-4.2.0/include -I/opt/nagios-4.2.0 -I/usr/local/include -I/usr/local/include -Werror=implicit-function-declaration -g -O2 -MT nagmq_la-nagmq_req.lo -MD -MP -MF .deps/nagmq_la-nagmq_req.Tpo -c -o nagmq_la-nagmq_req.lo test -f 'nagmq_req.c' || echo './'
nagmq_req.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../dnxmq -I/opt/nagios-4.2.0/include -I/opt/nagios-4.2.0 -I/usr/local/include -I/usr/local/include -Werror=implicit-function-declaration -g -O2 -MT nagmq_la-nagmq_req.lo -MD -MP -MF .deps/nagmq_la-nagmq_req.Tpo -c nagmq_req.c -fPIC -DPIC -o .libs/nagmq_la-nagmq_req.o
nagmq_req.c:875: error: expected ‘)’ before ‘’ token
nagmq_req.c:924: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘’ token
nagmq_req.c: In function ‘do_list_comments’:
nagmq_req.c:933: error: ‘comment’ undeclared (first use in this function)
nagmq_req.c:933: error: (Each undeclared identifier is reported only once
nagmq_req.c:933: error: for each function it appears in.)
nagmq_req.c:933: error: ‘clck’ undeclared (first use in this function)
nagmq_req.c:951: error: implicit declaration of function ‘parse_comment’
make[2]: *** [nagmq_la-nagmq_req.lo] Error 1
make[2]: Leaving directory /opt/nagmq/mods' make[1]: *** [all] Error 2 make[1]: Leaving directory
/opt/nagmq/mods'
make: *** [all-recursive] Error 1
[root@box nagmq]#
Nagios 4.2.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.