The first mode is the one that's used most often, since it allows you to monitor almost all important system resources from one location. For your convenience, you can turn different sections on and off on the report, to make it possible for reports to fit into one screen.

This mode comes with the following features:

Automatic Refresh Mode
You can tell the application to refresh the report every few seconds. You can preset this value at server startup. For example, to set the refresh to 60 seconds, add the following configuration setting:

$Apache::VMonitor::Config{REFRESH} = 60;

A 0 (zero) value turns off automatic refresh.

When the server is started, you can always adjust the refresh rate through the user interface.

top Emulation: System Health Report
Like top, this shows the current date/time, machine uptime, average load, and all the system CPU and memory usage levels (CPU load, real memory, and swap partition usage).

The top section includes a swap space usage visual alert capability. As we will explain later in this chapter, swapping is very undesirable on production systems. This tool helps to detect abnormal swapping situations by changing the swap report row's color according to the following rules:

swap usage                     report color
5Mb < swap < 10 MB             light red
20% < swap (swapping is bad!)  red
70% < swap (almost all used!)  red + blinking (if enabled)

Note that you can turn on the blinking mode with:

$Apache::VMonitor::Config{BLINKING} = 1;

The module doesn't alert when swap is being used just a little (< 5 Mb), since swapping is common on many Unix systems, even when there is plenty of free RAM.

If you don't want the system section to be displayed, set:

$Apache::VMonitor::Config{SYSTEM} = 0;

The default is to display this section.

top Emulation: Apache/mod_perl Processes Status
Like top, this emulation gives a report of the processes, but it shows only information relevant to mod_perl processes. The report includes the status of the process (Starting, Reading, Sending, Waiting, etc.), process ID, time since the current request was started, last request processing time, size, and shared, virtual, and resident size. It shows the last client's IP address and the first 64 characters of the request URI.

This report can be sorted by any column by clicking on the name of the column while running the application. The sorting can also be preset with the following setting:

$Apache::VMonitor::Config{SORT_BY}  = "size";

The valid choices are pid, mode, elapsed, lastreq, served, size, share, vsize, rss, client, and request.

The section is concluded with a report about the total memory being used by all mod_perl processes as reported by the kernel, plus an extra number approximating the real memory usage when memory sharing is taking place. We discuss this in more detail in Chapter 10.

If you don't want the mod_perl processes section to be displayed, set:

$Apache::VMonitor::Config{APACHE} = 0;

The default is to display this section.

top Emulation: Any Processes
This section, just like the mod_perl processes section, displays the information as the top program would. To enable this section, set:

$Apache::VMonitor::Config{PROCS} = 1;

The default is not to display this section.

You need to specify which processes are to be monitored. The regular expression that will match the desired processes is required for this section to work. For example, if you want to see all the processes whose names include any of the strings "http", "mysql", or "squid", use the following regular expression:

$Apache::VMonitor::PROC_REGEX = 'httpd|mysql|squid';

Figure 5-1 visualizes the sections that have been discussed so far. As you can see, the swap memory is heavily used. Although you can't see it here, the swap memory report is colored red.

Figure 5-1

Figure 5-1. Emulation of top, centralized information about mod_perl and selected processes

mount Emulation
This section provides information about mounted filesystems, as if you had called mount with no parameters.

If you want the mountsection to be displayed, set:

$Apache::VMonitor::Config{MOUNT} = 1;

The default is not to display this section.

df Emulation
This section completely reproduces the df utility. For each mounted filesystem, it reports the number of total and available blocks for both superuser and user, and usage in percentages. In addition, it reports available and used file inodes in numbers and percentages.

This section can give you a visual alert when a filesystem becomes more than 90% full or when there are less than 10% of free file inodes left. The relevant filesystem row will be displayed in red and in a bold font. A mount point directory will blink if blinking is turned on. You can turn the blinking on with:

$Apache::VMonitor::Config{BLINKING} = 1;

If you don't want the df section to be displayed, set:

$Apache::VMonitor::Config{FS_USAGE} = 0;

The default is to display this section.

Figure 5-2 presents an example of the report consisting of the last two sections that were discussed (df and mount emulation), plus the ever-important mod_perl processes report.

Figure 5-2

Figure 5-2. Emulation of df, both inodes and blocks

In Figure 5-2, the /mnt/cdrom and /usr filesystems are more than 90% full and therefore are colored red. This is normal for /mnt/cdrom, which is a mounted CD-ROM, but might be critical for the /usr filesystem, which should be cleaned up or enlarged.

Abbreviations and hints
The report uses many abbreviations that might be new for you. If you enable the VERBOSE mode with:

$Apache::VMonitor::Config{VERBOSE} = 1;

this section will reveal the full names of the abbreviations at the bottom of the report.

The default is not to display this section.