Documentation forServer & Application Monitor

Apache

This SAM template retrieves Apache server statistics from the built-in Apache server-status web page using Perl scripts on a Linux system.

Note the following details about this template:

  • It supports the Orion Agent for Linux.
  • Application monitors created from this template may appear down on RedHat-derived systems, such as CentOS, because the apache2 process monitor checks for a specific process, apache2. That process name varies across Linux distributions. Edit the template and modify apache2 references, as necessary.

Prerequisites

libwww-perl is installed. To install on CentOS, use this command: yum install perl-libwww-perl.noarch

Perl can access the Apache server-status page.

Credentials

SSH account on the web server.

Prerequisites for Orion agent for Linux

To use this template with the Orion agent for Linux, you may need to configure the Apache server for access, as described next. The Linux/Unix Script monitor is used for all component monitors.

Access Configuration

Configure Apache to allow access to the server-status page:

  1. Log into 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.
    <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. Set this argument to ${IP} so it 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, see this article.

Component monitors

This template includes counter component monitors, plus one process monitor.

ServerUptime

Returns the time that the server has been up in this format: (days)d (hours)h (minutes)m (seconds)s

IdleWorkers

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

Returns the total number of accesses.

TotalTraffic

Returns the total number of kilobytes this server has served.

ServerRequestPerSecond

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

Returns the average rate of kilobytes served per second.

ServerKbytesPerRequest

Returns the average number of bytes per request.

BusyWorkers

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

apache2

This process monitor tests if a specific process is running, and reports the CPU and physical memory used by the process.

When the Orion agent for Linux agent is installed, this monitor uses the Orion agent to poll managed nodes. Otherwise, it uses SNMP for polling. If these counters are unavailable, then there may be a problem with a script on the agent, the named service may be stopped, or there may be a problem with SNMP configuration.

The Apache process name may vary across Linux distributions, including RedHat-derived systems such as CentOS. Edit the template and modify apache2 references, as necessary.