In this recipe, we'll set up a service check to monitor the responsiveness of an HTTP and HTTPS server. We'll use the
check_http command and the plugin of the same name provided in the Nagios Plugins setup for making HTTP and HTTPS requests of a web server, and ensure that it returns an appropriate and timely response. This is useful in situations where it's necessary to check if a website is still functioning, particularly if there are times it comes under heavy load or suffers denial of service attacks.
You should have a Nagios Core 4.0 or newer server with at least one host configured already. We'll use the example of
sparta.example.net, a host defined in its own file. You should also understand the basics of how hosts and services relate, which is covered in the recipes in Chapter 1, Understanding Hosts, Services, and Contacts.
An appropriate first step is making sure that the services we intend to check are accessible from the monitoring server running...