References > Template Reference > Apache > Apache

Apache

This template retrieves Apache server statistics from the built-in Apache server-status web page using Perl scripts.

Works with the Orion Agent for Linux.

Prerequisites

Perl, access to the Apache server-status page.

You need libwww-perl installed. You can install on CentOS using this command: yum install perl-libwww-perl.noarch

Credentials

SSH account on the web server.

Prerequisites for Orion agent for Linux

If using this template with the Orion agent for Linux, you may need to configure the Apache server for access. See the section for Access Configuration. The Linux/Unix Script monitor is used for all component monitors. See the Linux/Unix Script monitor for full details and configurations.

Access Configuration

You need to configure Apache to allow access to the server-status page:

  1. Login to your Apache server using SSH or telnet client. Grant yourself root permissions (so root).
  2. Use the command: yum install perl-libwww-perl
  3. Locate httpd.conf: find /etc -iname httpd.conf The file is typically located in /etc/httpd/conf/httpd.conf.
  4. Locate the following section:
    #<Location /server-status>
    #    SetHandler server-status
    #    Order deny,allow
    #    Deny from all
    #    Allow from .example.com
    #</Location>
    
  5. Uncomment the code. Edit the Allow from rule substituting the IP address or hostname of your Apache server for localhost. Use localhost only if the Apache server services the loopback interface. Also make sure the ExtendedStatus is On: ExtendedStatus On
    <Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost
    </Location>
    ExtendedStatus On
    
  6. Restart the Apache httpd: service httpd restart
    or
    Reload the configuration: service httpd reload

Arguments for monitors

Before using this template, the correct arguments should be set in all monitors.

All monitors require the following arguments:

perl ${SCRIPT} server server_port

where

  • server – This is the hostname or IP address of the target Apache server. You should set this argument to ${IP} which automatically replaces this argument with the target host IP address.
  • server_port - This is the Apache port under which the site is running. By default it is set to port 80.

The following is an example using the Scripts Arguments field:

perl ${SCRIPT} ${IP} 8080

If you receive the error Cannot connect to local host, refer to this article to solve.

Monitored Components

For details on monitors, see SAM Component Monitor Types.

ServerUptime

This counter returns the time that the server has been up.

Format of time: (days)d (hours)h (minutes)m (seconds)s

IdleWorkers

This counter returns the number of free workers ready to handle client connections. This counter should be as high as possible.

If you have no idle workers, or very few, Apache may be using all the processes it is allowed and new incoming requests must wait for older requests to finish before they can be handled. If this is the case, increasing the maximum allowed processes in your configuration file might help with performance.

TotalAccess

This counter returns the total number of accesses.

TotalTraffic

This counter returns the total number of kilobytes this server has served.

ServerRequestPerSecond

This counter returns the average rate of all requests per second.

The result is calculated as the total number of requests throughout the life of the server (count) and divided by the total uptime in seconds (up_time).

ServerKbytesPerSec

This counter returns the average rate of kilobytes served per second.

ServerKbytesPerRequest

This counter returns the average number of bytes per request.

BusyWorkers

This counter returns the number of busy workers serving requests. This counter should be as low as possible.