Setup Basic System Monitoring with Sysstat.
A common task for System Administrators is to monitor and care for a server.
Thats fairly easy to do at a moments notice, but how to keep a record of this information over time?
On way to monitor your server is to use the Sysstat package.
http://perso.orange.fr/sebastien.godard/
Sysstat is actually a collection of utilities designed to collect information about the performance of a linux installation, and record them over time.
Its fairly easy to install too, since it is included as a package on many distributions.
To install on Centos 4.3, just type the following:
yum install sysstat
We now have the sysstat scripts install on the system. Lets try the sar command.
sar Linux 2.6.16-xen (xen30) 08/17/2006 11:00:02 AM CPU %user %nice %system %iowait %idle 11:10:01 AM all 0.00 0.00 0.00 0.00 99.99 Average: all 0.00 0.00 0.00 0.00 99.99
Several bits of information, such as Linux kernel, hostname, and date are reported. More importantly, the various ways CPU time being spent on the system is shown. %user, %nice, %system, %iowait, and %idle describe ways that the CPU may be utilized.
%user and %nice refer to your software programs, such as Mysql or Apache.
%system refers to the Kernel's internal workings.
%iowait is time spent waiting for Input/Output, such as a disk read or write. Finally, since the kernel accounts for 100% of the runnable time it can schedule, any unused time goes into %idle.
The information above is shown for a 1 second interval. How can we keep track of that information over time?
If our system was consistently running heavy in %iowait, we might surmise that a disk was getting overloaded, or going bad. At least, we would know to investigate.
So how do we track the information over time? We can schedule sar to run at regular intervals, say, every 10 minutes. We then direct it to send the output to sysstat's special log files for later reports. The way to do this is with the Cron daemon.
By creating a file called 'sysstat' in /etc/cron.d, we can tell cron to run sar every day.
Fortunately, the Sysstat package that yum installed already did this step for us.
more /etc/cron.d/sysstat
- Login to post comments
