I'm fairly new to Nagios, so forgive the basic nature of the question.
I need to hit an http endpoint using check_http and read some data back. I can configure the check in a service, however, does it need a corresponding host entry as well? My assumption is this would run on the Nagios server itself and doesn't need a host to run the http check with, but I'm just starting out and am not sure...I'm using this as my documentation:
https://assets.nagios.com/downloads/nag ... tions.html
Thanks for helping clear things up.
Need to check an http endpoint...do I really need a host?
Re: Need to check an http endpoint...do I really need a host
Hi @jkj2000, welcome to the forums!
Here's the updated version of the documentation. This is for Nagios Core 4.
https://assets.nagios.com/downloads/nag ... tions.html
Yes, you do need a host to tie a service check to. This is just how Nagios was constructed. It is assumed that there is going to be a host, and that host has so many services running on it. Things are a little different today, where sometimes we might want to monitor a website where we don't necessarily have access to the host(s) serving the site.
To that end, you can define the check_command used for the host check. If you only need to check one metric from check_http, it might be that you can replace the default check_ping command with the check_http command in the host definition. If you need to check multiple metrics, then you could do something like create the host, create your service checks, and since the site likely doesn't respond to pings, you can disable host checks.
Let me know if one of those options works for you. If not, we can explore other options.
Here's the updated version of the documentation. This is for Nagios Core 4.
https://assets.nagios.com/downloads/nag ... tions.html
Yes, you do need a host to tie a service check to. This is just how Nagios was constructed. It is assumed that there is going to be a host, and that host has so many services running on it. Things are a little different today, where sometimes we might want to monitor a website where we don't necessarily have access to the host(s) serving the site.
To that end, you can define the check_command used for the host check. If you only need to check one metric from check_http, it might be that you can replace the default check_ping command with the check_http command in the host definition. If you need to check multiple metrics, then you could do something like create the host, create your service checks, and since the site likely doesn't respond to pings, you can disable host checks.
Let me know if one of those options works for you. If not, we can explore other options.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Need to check an http endpoint...do I really need a host
Thanks @mbellerue, for the excellent explanation. I'll take your advice to heart. Our Nagios setup right now has several existing hosts, and I wonder if I should create my new service with a 'host' value of one of those-- after all, it is just a check_http call and any existing host should be able to run it.
That said, do check_http commands actually run from the specified host mentioned in the service, or do they run from the Nagios server itself? I know that certain commands using nrpe (for, say CPU utilization checks) have to run on the actual hosts but for check_http calls I wasn't sure if the specified hosts also run them or if the Nagios server does it and the 'host' entry in the service definition is just a placeholder.
That said, do check_http commands actually run from the specified host mentioned in the service, or do they run from the Nagios server itself? I know that certain commands using nrpe (for, say CPU utilization checks) have to run on the actual hosts but for check_http calls I wasn't sure if the specified hosts also run them or if the Nagios server does it and the 'host' entry in the service definition is just a placeholder.
Re: Need to check an http endpoint...do I really need a host
So if you look at your /usr/local/nagios/etc/objects/commands.cfg, and look at any command that starts as $USER1$/some_plugin, that plugin will run on your Nagios server. So likely you have a check_http command that is defined as $USER1$/check_http, followed by some arguments. That will run on your Nagios server.
NRPE is an agent. In your commands.cfg you will find $USER1$/check_nrpe, followed by some arguments. The way check_nrpe works is that it makes a call to the remote host, and executes the plugin on the remote server. Same thing with NCPA, which is a newer agent (my personal favorite), and uses the check_ncpa.py plugin.
In both of the above instances, I've described Active Checks. There are also Passive Checks. I bring this up is because you are talking about agents now, and a lot of people think that just because the plugin is executing on the remote server, it's a Passive Check, which is not the case. Active checks are checks that are initiated by Nagios, whether Nagios runs the plugin for the check on the Nagios server itself, or Nagios reaches out to an agent to run the check. Nagios initiated the check, it's an Active check.
Passive checks are initiated, and run on remote servers. Only the check result is passed back to Nagios, usually through NRDP. The biggest reason people use passive checks is to ease the load on their Nagios systems. If you don't have hundreds of hosts, with thousands of checks, it's probably not a big deal. But sometimes throwing in a smattering of Passive checks can help keep the load down on Nagios.
That's a little more information than you asked for, but you were already right on the brink of it, so I thought I'd throw it out there anyway. Here are some links for further reading.
https://assets.nagios.com/downloads/nag ... hecks.html
https://assets.nagios.com/downloads/nag ... hecks.html
https://www.nagios.org/ncpa/#docs
NRPE is an agent. In your commands.cfg you will find $USER1$/check_nrpe, followed by some arguments. The way check_nrpe works is that it makes a call to the remote host, and executes the plugin on the remote server. Same thing with NCPA, which is a newer agent (my personal favorite), and uses the check_ncpa.py plugin.
In both of the above instances, I've described Active Checks. There are also Passive Checks. I bring this up is because you are talking about agents now, and a lot of people think that just because the plugin is executing on the remote server, it's a Passive Check, which is not the case. Active checks are checks that are initiated by Nagios, whether Nagios runs the plugin for the check on the Nagios server itself, or Nagios reaches out to an agent to run the check. Nagios initiated the check, it's an Active check.
Passive checks are initiated, and run on remote servers. Only the check result is passed back to Nagios, usually through NRDP. The biggest reason people use passive checks is to ease the load on their Nagios systems. If you don't have hundreds of hosts, with thousands of checks, it's probably not a big deal. But sometimes throwing in a smattering of Passive checks can help keep the load down on Nagios.
That's a little more information than you asked for, but you were already right on the brink of it, so I thought I'd throw it out there anyway. Here are some links for further reading.
https://assets.nagios.com/downloads/nag ... hecks.html
https://assets.nagios.com/downloads/nag ... hecks.html
https://www.nagios.org/ncpa/#docs
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Need to check an http endpoint...do I really need a host
Perfect, thanks so much for the information and additional docs. BTW, is this the appropriate forum for questions like mine? It appeared to be the most generalist one but if there's a better forum for it I'm happy to post there instead.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need to check an http endpoint...do I really need a host
Yep, here is great for these types of questionsjkj2000 wrote:Perfect, thanks so much for the information and additional docs. BTW, is this the appropriate forum for questions like mine? It appeared to be the most generalist one but if there's a better forum for it I'm happy to post there instead.