1 AUTHOR: Randy McMurchy <LFS-User_at_mcmurchy_dot_com>
5 LICENSE: Creative Commons Attribution-NonCommercial-ShareAlike License
6 http://creativecommons.org/licenses/by-nc-sa/1.0/
8 SYNOPSIS: Installing the sysstat package for system performance monitoring
12 This hint provides instructions for the installation of Sebastien Godard's
13 sysstat package and for setting up a cron schedule to keep daily reports of
14 of system activity. The sysstat package includes the "sar" utilities found on
15 major commerical Unix flavors.
23 Nothing is required except a base LFS system.
32 2. Package Dependencies
33 3. Package Installation
39 Stripping the binaries
40 Installing the init script
41 4. Setting Up A Crontab
42 5. Using The Sysstat Utilities
49 The sysstat package provides system performance monitoring and daily activity
50 report gathering. This package provides all the capabilites found in the sar
51 utilities installed on major commercial Unix flavors. The package is stable,
52 easy to install and set up and can be used with all Linux kernels.
54 The sysstat utilities provide information from the kernel proc filesystem,
55 and as such, cannot display statistics that Linux does not provide, or can
56 they be more accurate than Linux is.
58 The sysstat package has been designed with National Language Support (NLS) in
59 mind, using the GNU gettext package. At the present time, English, French,
60 German, Spanish, Portuguese, Afrikaans, Norwegian, Italian, Russian,
61 Romanian, Polish, Slovak and Japanese translations are available.
63 Check out the SYSSTAT utilities home page at:
64 http://perso.wanadoo.fr/sebastien.godard/
66 ========================
67 2. PACKAGE DEPENDENCIES:
68 ========================
70 The only dependency of the sysstat package is a cron scheduler. This is
71 optional. However, without a cron scheduler, daily activity reports can not
74 I use Paul Vixie's old cron package as this package most closely resembles
75 the cron facilities I am used to. I've not looked at Fcron yet, but my
76 understanding is it aims to replace Vixie Cron and operates in a very similar
77 manner. Instructions for downloading and installing both packages can be
78 found at the following URLs.
82 http://www.linuxfromscratch.org/hints/downloads/files/vixie-cron.txt
83 Alternate download location: http://www.mcmurchy.com/lfs/vixie-cron-3.0.1.tar.bz2
87 http://www.linuxfromscratch.org/blfs/view/stable/general/fcron.html
89 ========================
90 3. PACKAGE INSTALLATION:
91 ========================
97 The current stable release of the sysstat package is sysstat-5.05 and can be
98 downloaded using the following URL's:
102 ftp://ibiblio.org/pub/linux/system/status/sysstat-5.0.5.tar.gz
106 http://perso.wanadoo.fr/sebastien.godard/sysstat-5.0.5.tar.gz
112 You may wish to view the README file included in the root of the source tree
113 before we begin. This file provides an overview of the installation process,
114 as well as a list of all files which will be installed on your system.
116 The configuration process is interactive. You'll be prompted to supply the
117 required configuration information. I'll try to explain (if necessary) the
118 information as we go along. After the "make config" command below, everything
119 else you see is what you will be prompted for, with the supplied parameter I
120 use. If there is no parameter listed after the prompt, I simply hit "Enter"
123 Note: I manually put the ==> arrow in after the prompt and before the
124 supplied parameter. You won't see this arrow, it's only there to separate the
125 prompt from the supplied parameter.
127 Begin the configuration script by running the following command:
131 Installation directory: [/usr/local] ==> /usr
132 System activity directory: [/var/log/sa] ==>
133 Clean system activity directory? [n] ==>
134 Enable National Language Support (NLS)? [y] ==>
135 Linux SMP race in serial driver workaround? [n] ==> (typically not required,
137 sa2 uses daily data file of previous day? [n] ==>
138 Number of daily data files to keep: [7] ==> (should be less than 29)
139 Group for manual pages: [root] ==>
140 Set crontab to start sar automatically? [n] ==> (we'll do this later,
147 Simply running the "make" command will build the package.
153 There are no "check" rules in the various subdirectory makefiles, so there's
154 nothing to check. Running the "make check" command is pointless.
160 ****************************************************************************
162 ***** The remainder of this hint must be performed by the root user *****
164 ****************************************************************************
166 Simply issue a "make install" command to install the package.
168 -----------------------
169 Stripping the Binaries:
170 -----------------------
172 If desired, strip the unnecessary symbols from the installed binaries by
173 issuing the following commands:
175 strip --strip-all /usr/bin/sar /usr/bin/iostat /usr/bin/mpstat
176 strip --strip-debug /usr/lib/sa/sadc
178 ---------------------------
179 Installing the Init Script:
180 ---------------------------
182 An init script is required for the sysstat package, but not for conventional
183 reasons. Typically, a package init script is used to start a daemon. For the
184 sysstat package, an init script is provided simply to run the sadc program
185 at boot time. This is required so that the LINUX RESTART message can be
186 inserted into the daily data file, indicating that the relevant kernel
187 counters have been reinitialized.
189 If your plans for the sysstat package do not include using cron to store
190 daily information in activity files, an init script is not necessary.
192 To create a BLFS-compliant boot script, issue the following command:
194 cat > /etc/rc.d/init.d/sysstat << "EOF"
197 # Begin $rc_base/init.d/sysstat
199 # Based on sysklogd script from LFS-3.1 and earlier.
200 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
201 # SYSSTAT bootscript submitted by Randy McMurchy - LFS-User_at_mcmurchy_dot_com
202 # SYSSTAT bootscript commands by Sebastien Godard <sebastien dot godard at wanadoo dot fr>
209 echo "Calling the system activity data collector (sadc)..."
210 /usr/lib/sa/sadc -F -L -
215 echo "Usage: $0 start"
220 # End $rc_base/init.d/sysstat
223 Now create the required symbolic link(s) to the init script in your required
224 start-up directory(ies). The following is an example:
226 ln -sf ../init.d/sysstat /etc/rc.d/rc3.d/S10sysstat
228 Do substitute your desired startup directory(ies) and S##.
230 ========================
231 4. SETTING UP A CRONTAB:
232 ========================
234 To keep daily reports of system activity, you'll need to add entries to the
235 crontab table for whatever user you use for maintenance activities. I use
236 root's crontab entry for this. If you use a user other than root, make the
237 appropriate ownership changes to the /var/log/sa directory.
239 Sample crontab entries can be found in the crontab.sample file found in the
240 root of the sysstat source tree. I use the following:
242 # minute hour monthday month weekday command
244 # activity reports every 20 minutes everyday
245 0 * * * * /usr/lib/sa/sa1 1200 3 &
247 # Daily summary prepared at 19:05
248 5 19 * * * /usr/lib/sa/sa2 -A &
250 See the man pages for sa1 and sa2 for more information on these commands.
251 If you use an external crontab file to create/modify the entries, don't
252 forget to submit the crontab file after you are finished.
254 ==============================
255 5. USING THE SYSTAT UTILITIES:
256 ==============================
258 The utilities included with the sysstat package include sar, iostat, mpstat,
259 sa1, sa2 and sadc. The sar, iostat and mpstat utilities are meant to be used
260 as command-line utilities. The others are used within the cron system.
262 Reference the respective man pages for each of these command's capabilities,
263 switches and parameters. After you've installed the package, and started
264 collecting activity statistics, simply running the sar command will list the
265 current day's activity summary. Here's a sample display of sar's output when
266 when run without any switches or parameters:
268 13:00:00 CPU %user %nice %system %iowait %idle
269 13:00:00 all 0.09 0.00 0.06 0.01 99.85
270 13:20:00 all 0.09 0.00 0.05 0.01 99.85
271 13:40:00 all 0.09 0.00 0.05 0.00 99.85
272 14:00:00 all 0.09 0.00 0.06 0.01 99.85
273 14:20:00 all 2.68 0.00 1.56 0.54 95.22
274 14:40:00 all 4.14 0.00 7.69 0.28 87.89
275 15:00:00 all 16.20 0.00 5.43 1.30 77.07
276 15:20:00 all 0.71 0.00 0.38 0.09 98.82
277 15:40:00 all 4.67 0.00 6.18 0.11 89.04
278 16:00:00 all 5.80 0.00 6.11 0.14 87.96
279 16:20:00 all 16.01 0.00 8.75 0.16 75.07
280 16:40:00 all 4.25 0.00 10.47 0.04 85.23
281 17:00:00 all 10.40 0.00 13.39 0.04 76.17
282 17:20:00 all 13.43 0.00 9.62 0.05 76.89
283 17:40:00 all 6.89 0.00 9.24 0.03 83.85
284 18:00:00 all 6.99 0.00 12.48 0.18 80.35
285 18:20:00 all 5.56 0.00 8.28 0.05 86.11
286 18:40:00 all 2.95 0.00 4.23 0.02 92.80
287 19:00:00 all 1.68 0.00 2.69 0.04 95.59
288 19:20:00 all 0.68 0.00 0.15 0.02 99.15
289 19:40:00 all 0.67 0.00 0.15 0.01 99.17
290 20:00:00 all 1.28 0.00 1.70 0.02 97.00
291 20:20:00 all 0.69 0.00 0.15 0.01 99.15
292 20:40:00 all 1.11 0.00 1.38 0.01 97.50
293 21:00:00 all 0.71 0.00 0.15 0.00 99.14
294 21:20:00 all 4.29 0.00 9.81 0.05 85.86
295 21:40:00 all 15.37 0.00 8.93 0.04 75.67
296 22:00:00 all 14.50 0.00 5.21 0.08 80.21
297 22:20:00 all 24.87 0.00 25.53 0.01 49.59
298 22:40:00 all 5.52 0.00 8.14 0.03 86.31
299 23:00:00 all 0.94 0.00 0.30 0.04 98.72
300 23:20:00 all 1.24 0.00 0.51 0.04 98.21
301 23:40:00 all 0.46 0.00 0.08 0.00 99.46
302 Average: all 2.51 0.00 2.40 0.05 95.04
304 (The average is skewed in this example, as this output only shows eleven
307 Here is sample output of the very tail end of a program compilation, using
308 the command "sar 2 5" (get 5 statistics displays, every 2 seconds):
310 Linux 2.6.4 (rmlinux) 06/10/04
312 14:26:28 CPU %user %nice %system %iowait %idle
313 14:26:30 all 97.50 0.00 2.50 0.00 0.00
314 14:26:32 all 41.29 0.00 3.48 5.47 49.75
315 14:26:34 all 0.00 0.00 0.00 0.00 100.00
316 14:26:36 all 0.00 0.00 0.00 0.00 100.00
317 14:26:38 all 0.00 0.00 0.00 0.00 100.00
318 Average: all 27.77 0.00 1.20 1.10 69.93
320 There are many, many switches and parameters to use with the sar command
321 to provide many other performance statistics.
327 I find the sysstat package very useful. As a Linux system administrator, you
328 hardly can live without it. Sure, there are other utilities that can provide
329 the same information (top, procinfo, etc.), but the sysstat package provides
330 the capability for retaining historical information.
332 It's my belief that the sysstat package belongs in the BLFS book, as there is
333 currently no performance monitoring and statistics gathering package
334 available. Perhaps one day the decision will be made to include the sysstat
335 package in the BLFS book. Until then, I'll keep this hint updated with
336 anything I discover that needs mentioning. Enjoy!
341 Sébastien Godard <sebastien dot godard at wanadoo dot fr> for creating and
342 maintaining the package.