Page 1 of 2
[Design Advice Needed] Push POST notifications into Nagios
Posted: Wed Nov 19, 2014 5:16 am
by wally
Hi Nagioers,
I'd like to integrate Nagios with my own notification mechanism based on HTTP POST requests.
I installed Heroku on the NagiosXI Server, and I am correctly receiving notification in Heroku via HTTP callbacks. The mechanisms is basically a webhook: POST requests are received by Heroku and I'd like to push this notifications and data directly into Nagios dashboard.
I already have Nagios using a Python plugin to pull data from an API, and I could do the same to pull data from the local Heroku, but this time I'd like to avoid the polling using a script.
What I'd like is having Heroku (or any other web server) receiving the POST request from my system, and push that directly into Nagios.
Any advice on this design?
I googled a lot but I'm pretty new to Nagios so I'm kinda lost in the ocean of plugins and mods. I did not find any solution for what I want to do.
Thanks in advance!

Re: [Design Advice Needed] Push POST notifications into Nagi
Posted: Wed Nov 19, 2014 5:21 pm
by sreinhardt
To summarize, you have XI and heroku installed on the same machine. Heroku gets web requests, and you would like to forward the contents of these requests to nagios? Sorry if I'm misunderstanding, I get that you want to do something with notifcations and http requests, just not 100% sure exactly what you are looking to gain.
Re: [Design Advice Needed] Push POST notifications into Nagi
Posted: Thu Nov 20, 2014 5:15 am
by wally
Hi Sreinhardt,
you got the point, that's exactly what I am trying to achieve:
"To summarize, you have XI and heroku installed on the same machine. Heroku gets POST web requests, and you would like to forward the contents of these requests to nagios?" >>>>>>>>> but I want to do that avoiding the periodic polling from Nagios, I want the webserver to forward the content to Nagios directly.
In summary, is not Nagios PULLING information from the Heroku web server, but is the Heroku web server PUSHING direcly to Nagios.
Could it be done?
Thanks!
Re: [Design Advice Needed] Push POST notifications into Nagi
Posted: Thu Nov 20, 2014 5:38 pm
by sreinhardt
Well sure it can be done, with software that is already created is the better question. Currently nagios does not have a way to ingest http logs or post requests not designed for it, in a truely meaningful way. In all honesty, I would really suggest you look at log server. It could either use syslog locally to collect heroku web logs and index them for you, or you could have heroku send to a raw socket and use log server to collect that information. Log server also would let you set filters and ways to parse out the data into much much more meaninful sections like date, url, content size, etc. You can also push alerts to nagios XI or core passively if you want! Either way is going to require some work, but I think you will find a much better use case with log server for what you are sounding like you want to do.
Re: [Design Advice Needed] Push POST notifications into Nagi
Posted: Thu Nov 20, 2014 6:59 pm
by wally
So in case I use a log server, let's say Heroku, what would be the best way to transfer this information into NagiosXI ? Do I need to use a script (e.g. Python) to periodically sample the data from the Heroku logs, or is there an alternative way?
Last question: do you have a link where all the options to transfer data into Nagios are explained, so I can have a look and understand what's best for me?
Thanks!
Re: [Design Advice Needed] Push POST notifications into Nagi
Posted: Fri Nov 21, 2014 2:41 pm
by sreinhardt
I honestly don't know of a link that would provide all possible ways to add data to nagios, as there are many. Direct, non active checks that actually put data directly into nagios would be:
submissions through the nagios command pipe at /usr/local/nagios/var/rw/nagios.cmd
passive checks with nsca\nrdp\nrds\nsca
check results folder /usr/local/nagios/share/spool/checkresults/
You would not need anything special, rsyslogd, which log server uses by default should already be installed. Log server will provide you with a script that you can use to tell rsyslog to forward specific files. This way all your logs are always forwarded, provided rsyslog is on, and you do not need anything more to check them!
Re: [Design Advice Needed] Push POST notifications into Nagi
Posted: Fri Nov 28, 2014 5:45 am
by wally
So I had a look at the Nagios command pipe and passive checks, and they look pretty similar. Passive checks sounds like a best effort service, while the command pipe can be given more promptness by increasing the frequency of checking. Am i correct?
Thanks!
Re: [Design Advice Needed] Push POST notifications into Nagi
Posted: Mon Dec 01, 2014 12:11 pm
by abrist
wally wrote: Am i correct?
Essentially, though there is very little performance difference between the two.
Re: [Design Advice Needed] Push POST notifications into Nagi
Posted: Mon Dec 01, 2014 12:41 pm
by wally
The thing is: I already have a Python script polling data from my API and posting results in the Nagios dashboard, and for this I can set the frequency of execution of my script in Nagios. Basically this is a PULL method from the Nagios perspective.
I was looking into the external-command/passive pipe in order to have a PUSH method (again from Nagios perspective), but it sounds like that even if I put a command into the pipe, the service is either best effort of served with a frequency (60 secs by default). It sounds to me that it's not an event-driven pipe, so not sure what's the point for me in implementing this PUSH mechanisms that in the end is not a real PUSH..
Am I correct in my analysis?
Thanks!

Re: [Design Advice Needed] Push POST notifications into Nagi
Posted: Mon Dec 01, 2014 1:20 pm
by abrist
Writing a command to the pipe should get scheduled asap. Most commands I write to the pipe are processed within just a second or two of writing to it.