THE OPEN PITT What's cooking in Linux and Open Source in Western Pennsylvania =========================================================================== Issue 34 April 2007 www.wplug.org =========================================================================== In this issue: Book Review: Spring Into Linux System Monitoring with dstat March Roundup --------------------------------------------------------------------------- Book Review: Spring Into Linux by Bobbie Lynn Eicher Author: Janet Valade Publisher: Addison-Wesley Professional ISBN: 0-13-185354-6 $29.99, 336 pages, 2005 The "Spring Into..." series of books is designed with the goal of bringing people up to speed quickly on various technological topics. As part of that mission, each entry in the series focuses on allowing experienced professionals to pick up and work with new topics quickly. Each specific topic takes up at most a few pages, which helps to hold the level of detail down to the most crucial elements. On the whole, Janet Valade's effort at providing a basic introduction is solidly designed and executed. Each chapter includes an introduction at the beginning and a summary at the end, making it easier for readers to see where the current topic fits into context and decide whether a particular chapter covers a topic they need. Most topics are covered in a single page, expanding to two pages when necessary. The layout of the text consistently favors clarity and ease of locating topics as needed. While they could possibly have saved a few pages by trying to cram more material onto each, instead each new topic presented begins at the top of a new page, clearly labeled with a header that makes the subject clear, rather than requiring readers to skim through and get a sense of it themselves. If something is mentioned briefly but described more completely elsewhere, the author makes it immediately clear where to turn for a more detailed explanation, saving readers the hassle of searching through the table of contents and index. It's fortunate that the layout is so excellent, because the ordering of chapters and topics is sometimes strange. Considering that most users new to an operating system are eager to get a look at the programs for daily tasks, it's odd that this discussion is delayed until after coverage of topics like the command line and changing file permissions. Likewise, teaching the use of the command line prior to explaining what the root account is and why it should be avoided by novices seems like a careless oversight. Though the writing and tone are clear in general, there's occasional inconsistency about the assumed skill of the reader and a few important details slip by. The descriptions of how to use applications are more basic than the skills expected in areas such as the use of the command line, though this may be based on assumptions about which readers will be interested in those chapters. Also, while she only covers the use of the bash shell, the author never actually makes it clear how to check which shell you're in, which could easily confuse users who happen to find themselves at a terminal with a different shell active. It may suffer from a few imperfections, but the sheer ease of navigation makes _Spring into Linux_ an excellent book for professionals seeking a concise guide to using their new operating system. Bobbie Lynn Eicher is a long-time member of WPLUG and holds a B.S. in Computer Science from the University of Pittsburgh. --------------------------------------------------------------------------- System Monitoring with dstat by Patrick Wagstrom If you've been around Linux for a while, you're almost certainly familiar with the venerable top program--a system monitor that provides an ever- updating glance of what's going on in your system. When a system is behaving poorly, top will show you the load numbers. However, do you really know what they mean? If you answered "the sum of the number of processes in the run queue and those currently executing averaged over 1, 5, and 15 minutes," you'd be correct. For a single-processor system, if the load is greater than 1, it usually means that your system has more work than it can perform at the current moment. However, the increase in speed of CPUs over the past decade has far outpaced the increase in speed of hard disks and memory. Today you may have a system that claims to be heavily loaded, but in reality the processor is mostly idle. Where is the holdup in the system then? We could look around the /proc filesystem or use tools like vmstat, iostat, and netstat for more information, but wouldn't it be nice if all the information you needed were available with one program? That's exactly what dstat does. To start out with dstat, download it from . Try running it without any options at the command line. As shown in the example output below, you'll see five sets of information--CPU usage, disk activity, network activity, memory activity, and system activity. Sample dstat Output ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system-- usr sys idl wai hiq siq|_read _writ|_recv _send|__in_ _out_|_int_ _csw_ 21 4 73 1 0 1| 30k 43k| 0 0 |2143B 3846B| 218 553 6 2 92 0 0 0| 0 256k|2546B 0 | 0 0 | 350 597 7 0 92 0 0 1| 0 0 |2546B 0 | 0 0 | 344 450 7 1 92 0 0 0| 0 0 |3084B 284B| 0 0 | 326 483 6 0 94 0 0 0| 0 0 |3288B 1188B| 0 0 | 370 569 Unlike top, the details of CPU usage are given in six columns. The column headed "usr" shows the percentage of time taken by user processes. System processor usage by the kernel is indicated by "sys," and "idl" is the percentage of time the CPU is sitting idle. Wait time is marked "wai" and shows the time tasks are waiting for I/O, such as hard disk activity, to complete. Expect to see degraded performance if this value is high. Time spent processing hardware and software interrupts is indicated by "hiq" and "siq." These statistics are averaged over all processors in the system; luckily, you can select which processors to display information for by using the -C flag. Next up is disk information. By default, this is the total disk I/O across the entire system. For systems with multiple disks, you'll find the -D option to split up disks useful. If you use software RAID or LVM, you can even view individual disks or partitions within the group. After disk information comes network usage. Similar to the other statistics, this can be broken up by interface with the -N option, which is quite helpful when running a network firewall with multiple devices. The final two default groups are slightly more esoteric, but useful indicators of system performance. Paging refers to the process of moving data into and out of RAM. For example, when an executable is loaded there will be movement of code from disk into memory. When memory is nearly full, data must be paged out to disk. While some paging is inevitable, too much will bog down your system. Finally, the system grouping has "int," the number of interrupts processed since the last update. These are caused by a number of different devices such as hard drives, network cards, Firewire devices, or the internal timer. They do exactly what the name says; they interrupt the current execution and jump to code to handle the event in question. Too many may cause a high number of context switches, which is what "csw" stands for. A context switch occurs when the CPU switches from one task to another. Just like a human being switching tasks, this takes a small amount of time. Add up too many, and you can have a problem. In addition to the built-in features, dstat has a plugin interface that makes it fairly easy to add modules covering other statistics. Under Ubuntu, dstat comes with modules for WiFi properties, CPU frequency, thermal properties, and a whole slew more. While it may not give as much detail as some of the other tools available, together with its plugins it provides a nice and fast way to get an overview of the system and is a valuable part of any system administrator's toolbox. Patrick Wagstrom is a Ph.D. candidate at Carnegie Mellon University researching communication and collaboration in Open Source development. He has been using Linux since 1994. --------------------------------------------------------------------------- March Roundup Mar. 10 General User Meeting: The theme for this meeting was "How do I do that?" with demos of ways to perform common tasks under Linux. Patrick Wagstrom tackled the issue of managing your digital photos. He showed how you can import them from your camera, edit, organize, and publish them online using F-Spot or Google's Picasa. Patrick also demonstrated how to handle multiple users on the same machine using GNOME's Fast User Switching applet as well as the more traditional display manager login. Office tasks were covered by Vance Kochenderfer, who showed the basics of how to lay out a newsletter in the OpenOffice.org word processor and a brochure with the Scribus desktop publishing application. He capped this off with a demo of some abilities of Konqueror, KDE's web browser/file manager/kitchen sink, such as ripping audio CDs, extracting and creating ZIP files, and securely transferring files over a network. =========================================================================== The Open Pitt is published by the Western Pennsylvania Linux Users Group Editor: Vance Kochenderfer Copyright 2007 Western Pennsylvania Linux Users Group. Any article in this newsletter may be reprinted elsewhere in any medium, provided it is not changed and attribution is given to the author and WPLUG.