3. Monitor Apache via HTTP

    Who this guide is for

    This guide is designed for new Zabbix users and contains the minimum set of steps required to enable basic monitoring of your Apache installation. If you are looking for deep customization options or require more advanced configuration, see section of Zabbix manual.

    Prerequisites

    Before proceeding with this installation guide, you must download and install Zabbix server and Zabbix frontend according to instructions for your OS.

    Prepare Apache

    1. Check, which Apache version you are using:

    On RHEL-based system, run:

    On Debian/Ubuntu, run:

      2. Make sure that the Status module is enabled in your Apache instance.

      On RHEL-based system, run:

      1. httpd -M | grep status
      2. status_module (shared)

      On Debian/Ubuntu, run:

      If you don’t see status_module in the list, enable the module by running:

      On RHEL-based system, run:

      On Debian/Ubuntu, run:

      1. sudo /usr/sbin/a2enmod status

      3. Edit Apache configuration file to allow access to status reports from Zabbix server IP.

      On an RHEL-based system: /etc/httpd/conf.modules.d/status.conf:

      On Debian/Ubuntu: :

      1. sudo vi /etc/apache2/mods-enabled/status.conf

      Add the following lines to the file (replace 198.51.100.255 with your Zabbix server IP address):

      • Order Deny,Allow Deny from all Allow from 198.51.100.255 </Location>

      4. Restart Apache

      On an RHEL-based system, run:

      1. sudo systemctl restart httpd

      On Debian/Ubuntu, run:

      5. To check, if everything is configured correctly, run (replace 198.51.100.255 with your Zabbix server IP address):

      The response should contain Apache web server statistics.

      1. Log in to Zabbix frontend.

      2. Create a host in Zabbix web interface.

      This host will represent your Apache server.

      3. In the Interfaces parameter, add Agent interface and specify your Apache instance IP address. You don’t need to install Zabbix agent on the machine, the interface will only be used for resolving {HOST.CONN} macro. This macro is used in template items to locate Apache instance.

      4. In the Templates parameter, type or select Apache by HTTP.

      5. Switch to the Macros tab and select Inherited and host macros mode. Check that values of the macros {$APACHE.STATUS.PORT} and {$APACHE.STATUS.SCHEME} suit your installation settings. By default, the port is 80 and the scheme is http. Change macro values if you use different port and/or scheme.

      3. Monitor Apache via HTTP - 图2

      View collected metrics

      Congratulations! At this point, Zabbix is already monitoring your Apache web server.

      To view collected metrics, open the Monitoring->Hosts menu section and click on the Dashboards next to the host.

      This action will take you to the host dashboard with most important metrics collected from Apache /server-status page.

      Alternatively, from the Monitoring->Hosts, you can click on the Latest data to view all the latest collected metrics in a list.

      3. Monitor Apache via HTTP - 图5

      Zabbix can notify you about a problem with your infrastructure using a variety of methods. This guide provides configuration steps for sending email alerts.

      1. Go to the User settings -> Profile, switch to the tab Media and add your email.

      2. Follow the guide for .

      Next time, when Zabbix detects a problem you should receive an alert via email.

      Test your configuration

      To simulate real problem and receive a test problem alert:

      1. Open the Apache server host configuration in Zabbix.

      2. Switch to the Macros tab and select Inherited and host macros.

      3. Press Change next to {$APACHE.STATUS.PORT} macro and set a different port.

      4. Press Update to save host configuration.

      5. In a few minutes, Zabbix will detect the porblem Apache service is down, because now it cannot connect to the instance. It will appear in the Monitoring->Problems section.

      3. Monitor Apache via HTTP - 图7

      If the alerts are , you will also receive the problem notification.

      See also:

      • Web server hardening - recommended settings for greater web server security.
      • - how to start monitoring additional metrics.
      • HTTP items - how to monitor custom metrics using HTTP agent.
      • - how to create multi-step alert scenarios (e.g., first send message to the system administrator, then, if a problem is not resolved in 45 minutes, send message to the data center manager).