HomeApache Monitoring
Apache Monitoring

Apache played a key role in the initial growth of the World Wide Web. And also a well known web server to run the server side scripts / web based languages like Perl, Python & PHP and website with static HTML pages. Nodelizer helps you to monitor following metric about apache installed on your server.

Metrics collected by Apache Integration
Metric
– Description
Uptime
– The amount of time the server has been running.
Total Accesses
– A total number of accesses served.
Total Traffic
– A total number of byte count served.
Requests Per Sec
– The average number of requests performed per second.
Bytes Per Sec
– The average number of bytes served per second.
Bytes Per Req
– The average number of bytes served per request.
Busy Workers
– The number of worker serving requests.
Idle Workers
– The number of idle workers.
Configuring

Note :

  • Nodelizer supports monitoring Apache 2.x.
  • rptmonitor parses the Apache mod_status output.
  • mod_status Apache module should be installed. To check if it is installed and enabled, you can skip to #5 and run the given URL.
  1. Enable the status Module :

    Apache is normally compiled with mod_status built in but not enabled. Check your apache configuration file

    • if your config file is located at /etc/httpd/conf/httpd.conf (mostly in case of Red Hat based distro), uncomment following line line :

      #LoadModule status_module modules/mod_status.so

      (Remove the # symbol to enable mod_status.)

    • mostly in debian based distro the config file can be found at /etc/apache2/mods-available/status.conf – You can enable mod_status on by running cmd :

      sudo a2enmod status

      OR

      sudo /usr/sbin/a2enmod status

    • but it can be in different other locations depending on the OS distro, so you may need to search for the correct conf file
  2. Configuration for status :

    • if your config file is located at /etc/httpd/conf/httpd.conf (mostly in case of Red Hat based distro)

      You then need to add/uncomment the following lines in your httpd.conf file to set up the location from which the status output can be parsed by rptmonitor :

      <Location /server-status>

      SetHandler server-status

      Order Deny,Allow

      Deny from all

      Allow from 127.0.0.1

      </Location>

      Some Apache default configuration has these lines commented out. The above configuration will make statistics available at http://localhost/server-status.

    • mostly in debian based distro the config file can be found at /etc/apache2/mods-enebaled/status.conf

      • for apache2 latest version :

        <Location “/server-status”>

        SetHandler server-status

        Require host example.com

        </Location>

      • for legacy apache2 version :

        <Location /server-status>

        SetHandler server-status

        Order deny,allow

        Deny from all

        Allow from localhost

        </Location>

    • Add your server’s public IP address in the Allow from – list(separated by a space) if you wish to monitor your server’s status with your Public IP Address or server’s domain name.

      Allow from localhost xxx.xxx.xxx.xxx yourserver.domian.name

      This will allow the status to be accessed from the URL : http://yourserver.domian.name/server-status or http://xxx.xxx.xxx.xxx:port/server-status – specify the port if default is not 80.

    • This setting should reflect what host or range of hosts you want to allow to view your server status page. We recommend setting that permission to localhost only so outsiders can’t see detailed information about your web server.

  3. Also add/uncomment the following line in your httpd.conf file :

    • ExtendedStatus On
    • Note : Certain Apache metrics are only available if ExtendedStatus is On. In apache version 2.3.6, loading mod_status will toggle ExtendedStatus On by default. The collection of extended status information may slightly slow down the server.
  4. Restart the Apache Web Server after saving changes.
  5. Check URL in your browser or with curl/wget :

  6. Edit the Agent’s config.cfg file.

    • Uncomment the line containing ‘apache_status_url:‘ and add the URL. For e.g. if your IP was 127.0.0.1 then it would be:

      • apache_status_url: http://127.0.0.1:80/server-status?auto
      • Note : “?auto” at the end is required in the URL(without quotes).
      • Set the correct port if Apache is configured on different port.
    • Provide username(apache_usrnm) & password(apache_pswd) if the status URL is protected. Remove # symbol to uncomment the lines.
  7. Restart rptmonitor :

    • For deb/rpm package supported Linux distros :

      sudo /etc/init.d/rptmonitor restart
    • For openSUSE(11.4+) with systemd :

      sudo systemctl restart rptmonitor.service
    • For other Linux distro, FreeBSD8+, Mac OS X+ :

      sudo python /usr/local/bin/rptmonitor/monitor.py restart