Home > How to monitor your Web Server

How to monitor your Web Server

Heike Jurzik
By Heike Jurzik on Jun 03, 2019

Is your web server up and running? Are the SSL certificates still valid? Is the server's performance alright? In this article we're going to show you how to monitor your web server with Checkmk.


1. Monitoring HTTP(S) Connections

The check_http plug-in comes in handy when testing HTTP and HTTPS connections – so, it works with any web server (Apache, Nginx, Lighttpd, etc.). It can check response times, search for certain strings or regular expressions, and follow redirects. Also, this plug-in keeps an eye on your SSL certificates and reports expiration times. (Please note that check_http does not check if a certificate matches the server hostname or if there is a valid chain of trust.)

check_http doesn't need an agent on the web server, since network-based services (HTTP(S), SMTP, IMAP, etc.) can be monitored directly (active checks). To set up this plug-in, go to Host & Service parameters ➳ Active checks and create new rules (one per service). check_http can either monitor the availability of a website (content check) or SSL certificates.

1.1 Check Content

Enter the name of the website you want to monitor; this results in a service with the same name later. Next, activate the Check the URL option. By default, a URL is always addressed via the IP address, so for monitoring virtual hosts activate the checkbox below and enter the FQDN (fully qualified domain name). Only if the virtual host has a different IP, tick the Omit specifying an IP address box.

Port 80 (HTTP) is the default for this check – change the number to 443 to enable SSL. In that case you also need to activate the option Use SSL/HTTPS for the connection, otherwise you'll see a warning (400 Bad Request). The plug-in can test how long the web server takes to respond to queries. If necessary, adjust the time for warning and critical by clicking the option Expected response time and adjusting the values.

check_http-3

1.2 Monitoring SSL Certificates

Enter the hostname (i.e. the service name) and scroll down to activate the Check SSL Certificate Age option. Define the minimum number of days that it has to be valid before Checkmk sends out a notification. On top of that, the Status Detail field in our web interface will tell you the exact expiration date of a certificate.

 check_http-2

Again, if it's a virtual host, you need to enter the FQDN (fully qualified domain name) in the Check Certificate of a different IP/DNS name field. Also, enable the option Enable SSL/TLS hostname extension support (SNI) if you use multiple SSL certificates on the same IP address (SNI, Server Name Indication).

2. Monitoring Apache

Another approach is monitoring the web server software itself. If you're running Apache, then you can use the apache_status plug-in to collect detailed information. It fetches data from the Apache status module, i.e.:

  • Number of busy workers
  • Number of idle workers
  • Server's uptime
  • Time the server was started/restarted

Enabling the ExtendedStatus directive will track additional data, for example the status and the number of requests of each worker, the number of bytes served by the workers, etc.

Before you activate and configure the Checkmk plug-in, make sure to enable the status module and open the URL example.com/server-status in your web browser to confirm you can access the data. Next, install the apache_status plug-in by copying it to the plug-ins directory of your agent (CRE) or by using the agent bakery (CEE).

The plug-in tries to detect Apache servers automatically. If that fails, or if you'd like to monitor only specific servers, you can list your servers, the protocol (HTTP or HTTPS), and their port numbers in a configuration file (/etc/check_mk/apache_status.cfg).

Please note that the plug-in's state is always OK – the interesting bit is the performance data and its the visualization (i.e. in the Perf-O-Meter).

apache_graphs

3. Monitoring Nginx

Quite similar works the monitoring of the Nginx web server. Once you have enabled the ngx_http_stub_status_module, you can collect performance data and visualize them with the nginx_status plug-in in Checkmk.

Note: This module works with Nginx up to version 1.13.0. It has been superseded by ngx_http_api_module in later versions.

Before you configure the plug-in, make sure the Nginx module is enabled. On most Linux distributions this should be the case; you can confirm this on the shell with the following command:

~# nginx -V 2>&1 | grep -o with-http_stub_status_module
with-http_stub_status_module

Next, you adjust the Nginx configuration as described in the documentation. Tip: Enter your Checkmk server's IP address instead of 127.0.0.1 to allow it to connect to the site example.com/nginx_status.

Once this works, you can install the plug-in on the agent machine – either by copying it to the plug-in directory (/usr/lib/check_mk_agent/plug-in) or using the agent bakery. Like the apache_status plug-in, nginx_status can have a configuration file (/etc/check_mk/nginx_status.cfg) if the autodetection of the web server fails.

The state of this check is always OK, the plug-in only keeps track of active connections, requests/connections per second, and the connection status. The service details show performance indicators including graphs.

nginx_metrics

Wanted: IT Monitoring Superheroes

Do you have an interesting story about working with Checkmk?

We'd like to hear from you!

Learn more
checkmk superhero
We want to give you a good experience on this website.

In light of the General Data Protection Regulation, we are asking our audience to consent to the use of cookies by Checkmk and its partners to continue to our site.These cookies are used to personalize your user experience and support and improve the site. Please click “I Agree” below to consent to the use of this technology on the Checkmk website. Visit our Privacy Policy to learn more.

Your choices regarding cookies on this site.
Your preferences have been updated.
In order for the changes to take effect completely please clear your browser cookies and cache. Then reload the page.