NAME Apache::VMonitor - Visual System and Server Processes Monitor SYNOPSIS # Configuration in httpd.conf SetHandler perl-script PerlHandler Apache::VMonitor # startup file or section: use Apache::VMonitor(); $Apache::VMonitor::BLINKING = 1; $Apache::VMonitor::REFRESH = 0; $Apache::VMonitor::VERBOSE = 0; $Apache::VMonitor::TOP = 1; $Apache::VMonitor::MOUNT = 1; $Apache::VMonitor::FS_USAGE = 1; $Apache::VMonitor::NETLOAD = 1; @Apache::VMonitor::NETDEVS = qw(lo eth0); DESCRIPTION This module emulates the reporting functionalities of top(), mount(), df() and ifconfig() utilities. It has a visual alert capabilities and configurable automatic refresh mode. refresh mode From within a displayed monitor (by clicking on a desired refresh value) or by setting of $Apache::VMonitor::REFRESH to a number of seconds between refreshes you can control the refresh rate. e.g: $Apache::VMonitor::REFRESH = 60; will cause the report to be refreshed every single minute. Note that 0 (zero) turns refreshing off. top() emulation Just like top() it shows all the system CPU and memory usage: CPU Load, Mem and Swap usage. The top() section includes a swap space usage visual alert capability. The color of the swap report will be changed: 1) 5Mb < swap < 10 MB color: light red 2) 20% < swap (swapping is bad!) color: red 3) 70% < swap (swap almost used!) color: red + blinking Note that you can turn off blinking with: $Apache::VMonitor::BLINKING = 0; The module doesn't alert when swap is being used just a little (<5Mb), since it happens most of the time, even when there is plenty of free RAM. Then just like in real top() there is a report of the processes, but it shows all the relevant information about httpd processes only! The report includes process' id, size, shared, virtual and resident size, and a report about the used segments: text, shared lib, date and stack. At the end there is a calculation of the total memory being used by all httpd processes as reported by kernel, plus a result of an attempt to approximately calculate the real memory usage when sharing is in place. How do I calculate this: 1. For each process sum up the difference between shared and system memory. 2. Now if we add the share size of the process with maximum shared memory, we will get all the memory that actually is being used by all httpd processes but the parent process. Please note that this might be incorrect for your system, so you use this number on your own risk. I have verified this number, by writing it down and then killing all the servers. The system memory went down by approximately this number. Again, use this number wisely! If you don't want the top() section to be displayed set: $Apache::VMonitor::TOP = 0; The default is to display this section. mount() emulation This section reports about mounted filesystems, the same way as if you have called mount() with no parameters. If you want the mount() section to be displayed set: $Apache::VMonitor::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 percents. In addition it reports about available and used filenodes in numbers and percents. This section has a capability of visual alert which is being triggered when either some filesystem becomes more than 90% full or there are less 10% of free filenodes left. When that happens the filesystem related line will go bold and red and a mounting point will blink if the blinking is turned on. You can the blinking off with: $Apache::VMonitor::BLINKING = 0; If you don't want the df() section to be displayed set: $Apache::VMonitor::FS_USAGE = 0; The default is to display this section. ifconfig() emulation This section emulates the reporting capabilities of the ifconfig() utility. It reports how many packets and bytes were received and transmitted, their total, counts of errors and collisions, mtu size. in order to display this section you need to set two variables: $Apache::VMonitor::NETLOAD = 1; and to set a list of net devices to report for, like: @Apache::VMonitor::NETDEVS = qw(lo eth0); The default is NOT to display this section. abbreviations and hints The monitor uses many abbreviations, which might be knew for you. If you enable the VERBOSE mode with: $Apache::VMonitor::VERBOSE = 1; this section will reveal all the full names of the abbreviations at the bottom of the report. The default is NOT to display this section. CONFIGURATION To enable this module you should modify a configuration in httpd.conf, if you add the following configuration: SetHandler perl-script PerlHandler Apache::VMonitor The monitor will be displayed when you request http://localhost/sys-monitor or alike. You can control the behavior of this module by configuring the following variables in the startup file or inside the section. Module loading: use Apache::VMonitor(); Monitor reporting behavior: $Apache::VMonitor::BLINKING = 1; $Apache::VMonitor::REFRESH = 0; $Apache::VMonitor::VERBOSE = 0; Control over what sections to display: $Apache::VMonitor::TOP = 1; $Apache::VMonitor::MOUNT = 1; $Apache::VMonitor::FS_USAGE = 1; $Apache::VMonitor::NETLOAD = 1; What net devices to display if $Apache::VMonitor::NETLOAD is ON: @Apache::VMonitor::NETDEVS = qw(lo); Read the DESCRIPTION section for a complete explanation of each of these variables. PREREQUISITES You need to have Apache::Scoreboard and GTop installed. And of course a running mod_perl enabled apache server. SEE ALSO the Apache manpage, the mod_perl manpage, the Apache::Scoreboard manpage, the GTop manpage AUTHORS Stas Bekman COPYRIGHT The Apache::VMonitor module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.