Monitoring web services
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 set to make HTTP and HTTPS requests of a web server, to ensure that it returns an appropriate and timely response. This is useful in situations where it's required to check whether a website is still functioning, particularly if there are times when it comes under heavy load or suffers denial of service attacks.
Getting ready
You should have a Nagios Core 3.0 or newer server with at least one host configured already. We'll use the example of sparta.naginet
, 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 of 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...