Using Nagios for passive service/webservice monitoring

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
reevesdm
Posts: 4
Joined: Fri Oct 20, 2017 2:51 pm

Using Nagios for passive service/webservice monitoring

Post by reevesdm »

So I'm trying to find a solution for monitoring several different web services and reporting if any particular service goes down. I was reading the documentation on using NCPA for passive checking and sending reports to Nagios and it sounds like this is similar to what I need, but I need it to work on a service level, not a machine level. I think that NRDP is what I need for this, but I haven't been able to find documentation to support this. The end goal is for Nagios Core or Nagios XI to send an email or slack message to an administrator if a particular service hasn't checked in after so much time has passed.

Any help would be appreciated
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Using Nagios for passive service/webservice monitoring

Post by npolovenko »

Welcome to the forum, @reevesdm.
We would need to get some more information about your IT environment.
Is your goal to monitor web pages, say using HTTP and have Nagios send you a notification whenever the website is down? Or do you want to install some kind of agent on your website hosting system and monitor processes like Apache, Mongo, MYSQL, etc., and send you the alert whenever something goes wrong? Also, do most computers on your network run Windows or Linux? What platform do your web services run on?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
reevesdm
Posts: 4
Joined: Fri Oct 20, 2017 2:51 pm

Re: Using Nagios for passive service/webservice monitoring

Post by reevesdm »

Thanks for the welcome. From what I was told, we would like to have it so that our different web services/web sites all report in saying that they are alive to a monitoring process. Then, if the monitoring process has not heard an "I'm alive" signal from any of the services, it sends an alert to the appropriate person to take action to see why that service is down. Currently, most of these are restful web services in .NET Framework 4.0 that are in the back end of a public facing site, and we need to make sure they stay up. As far as I'm aware, these services will also live on servers running windows, but I can find that out.

I hope this is the information you were asking for.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Using Nagios for passive service/webservice monitoring

Post by mcapra »

A high-level overview; Feel free to ask questions if you need clarification :)
reevesdm wrote:From what I was told, we would like to have it so that our different web services/web sites all report in saying that they are alive to a monitoring process.
In the land of Nagios, these are typically referred to as passive checks.
reevesdm wrote:Then, if the monitoring process has not heard an "I'm alive" signal from any of the services, it sends an alert to the appropriate person to take action to see why that service is down.
In the land of Nagios, such criteria is referred to as the freshness of a check.

Step 1 is setting up NRDP on your Nagios Core instance. Some documentation for that can be found here:
https://support.nagios.com/kb/article/n ... ource.html

Step 2 is being able to ship your "I'm alive" signals back to Nagios. NRDP is a protocol designed for just such a use case and comes in many different flavors (Bash, Perl, Python to name a few). You could also leverage an agent like NCPA to ship your passive checks, but that's got quite a bit of overhead that a simple script (like the aforementioned ones) doesn't.

Step 3 is configuring a service/host check with your desired level of freshness.

You could just as easily install NSClient++ on your Windows environments and have Nagios reach out to that and execute active checks rather than worrying about all that freshness stuff. This is as close to real-time as Nagios gets; Reaching out to an agent on the machine (whether it be SNMP, NCPA, NRPE, WMI, whatever) and checking what the machine responds with.
Former Nagios employee
https://www.mcapra.com/
reevesdm
Posts: 4
Joined: Fri Oct 20, 2017 2:51 pm

Re: Using Nagios for passive service/webservice monitoring

Post by reevesdm »

Thanks for the reply mcapra.

Most of what you said is what I've found in my initial research and is what we were planning to do. My main question lies in step 2 with sending the signal to the Nagios server. Most of the implementations I saw were on the machine or server level and if possible, I'd like to do this on the service level. I'm hoping this would be something akin to adding some dll or nuget package to our service build path so that when a service is started up on any of our servers, it will start sending out checks.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Using Nagios for passive service/webservice monitoring

Post by mcapra »

I'm not much of a .NET guy, but I'd imagine someone with a reasonable understanding of .NET could port the aforementioned scripts into something that lives in .NET

Otherwise, you could register a scheduled task on your Windows machines at deploy/build time that runs a script that ships the web service's status back to Nagios. This would add more overhead though to the tune of figuring out what the web service's "status" actually is; If it's baked into the code you have a lot more to work with. That combined with the fact that you need to remove the task when the web service is decommissioned.
Former Nagios employee
https://www.mcapra.com/
reevesdm
Posts: 4
Joined: Fri Oct 20, 2017 2:51 pm

Re: Using Nagios for passive service/webservice monitoring

Post by reevesdm »

Thanks for the reply. I'm still pretty new to networking programming and monitoring, so I apologize if my questions seem basic. I might take a look at some of the plugins and their code on the nagios exchange and see if I can get any ideas for how to output signal from my service endpoints. Someone else probably already has done the solution I"m looking for. It will just take some digging to see if I can find it
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Using Nagios for passive service/webservice monitoring

Post by npolovenko »

Thanks, @mcapra!
@reevesdm, Let us know if you have any other questions.
And just to throw in my opinion. Perhaps your web services could be checked with simple active HTTP check? It's very simple idea but it will notify you whenever any of the web services go down. Nagios will ping + attempt to access web service's URL every n' minutes. If it finds out that the URL us down it will send an email to the person in charge. No additional installations needed.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked