Posted by Steve on Mon 21 Nov 2005 at 12:32
As an ex-programmer with a reasonably good knowledge of the Perl programming language I recently re-read this book with an aim to reviewing it. Read on for my thoughts on this classic book.
The Target AudienceAbout The BookThe book claims to require the reader to possess "some" knowledge of the Perl language. I feel this was perhaps an overly ambitions goal, and that to gain fully from the book the reader should be reasonably familiar with common Perl idioms.
The earliest discussion does start of being simpler than the later chapters I think that despite the clear language a complete Perl-newcomer might be a little lost in places.
The GoodPerl For System Administration is a relatively slim volume coming it at around 444 pages. Despite that it manages to contain a lot of content and numerous examples.
As you may hope from the name the book is fairly open and doesn't limit itself to discussion of any one particular operating system. Instead there are both portable examples, and focused discussion which only apply to a specific operating systems. (Whilst there is no mention of Mac OS X because the book was published in 2000 the examples included apply to GNU/Linux, Solaris, and Microsoft Windows.)
The full table of contents is as follows:
- Introduction
- System Administration Is a Craft
- How Perl Can Help
- This Book Will Show You How
- What You Need
- Locating and Installing Modules
- It's Not Easy Being Omnipotent
- References for More Information
- Filesystems
- Perl to the Rescue
- Filesystem Differences
- Walking or Traversing the Filesystem
- Walking the Filesystem Using the File::Find Module
- Manipulating Disk Quotas
- Querying Filesystem Usage
- Module Information for This Chapter
- References for More Information
- User Accounts
- Unix User Identity
- Windows NT/2000 User Identity
- Building an Account System to Manage Users
- Module Information for This Chapter
- References for More Information
- User Activity
- MacOS Process Control
- NT/2000 Process Control
- Unix Process Control
- Tracking File and Network Operations
- Module Information for This Chapter
- References for More Information
- TCP/IP Name Services
- Host Files
- NIS, NIS+, and WINS
- Domain Name Service (DNS)
- Module Information for This Chapter
- References for More Information
- Directory Services
- What's a Directory?
- Finger: A Simple Directory Service
- The WHOIS Directory Service
- LDAP: A Sophisticated Directory Service
- ADSI (Active Directory Service Interfaces)
- Module Information for This Chapter
- References for More Information
- SQL Database Administration
- Interacting with an SQL Server from Perl
- Using the DBI Framework
- Using the ODBC Framework
- Server Documentation
- Database Logins
- Monitoring Server Health
- Module Information for This Chapter
- References for More Information
- Electronic Mail
- Sending Mail
- Common Mistakes in Sending Email
- Receiving Mail
- Module Information for This Chapter
- References for More Information
- Log Files - This chapter is available online
- Text Logs
- Binary Log Files
- Stateful and Stateless Data
- Disk Space Problems
- Log Analysis
- Module Information for This Chapter
- References for More Information
- Security and Network Monitoring
- Noticing Unexpected or Unauthorized Changes
- Noticing Suspicious Activities
- SNMP
- Danger on the Wire
- Preventing Suspicious Activities
- Module Information for This Chapter
- References for More Information
- Appendices
- The Five-Minute RCS Tutorial
- The Ten-Minute LDAP Tutorial
- The Eight-Minute XML Tutorial
- The Fifteen-Minute SQL Tutorial
- The Twenty-Minute SNMP Tutorial
The BadThroughout the book there are several unifying themes which are repeated several times. The most obvious theme is:
- Databases are good.
This statement is repeated in several different guises at various points, and is something that I enjoyed reading.
The usage of the word "database" shouldn't be taken literally to mean something like MySQL, Postgres, or Oracle. Instead think of files such as /etc/passwd which are text databases - containing fixed records.
Within the standard Unix filesystem there are countless examples of such files, and it is worth thinking of them as databases when it comes to querying and manipulating them. Common examples include the previously mentioned passwd file, the matching groups file /etc/group, system mail aliases /etc/aliases, the system hosts file /etc/hosts & etc.
Although SQL is introduced (and is briefly discussed in one of the appendices) there is no thorough coverage.
One of the great Perl strengths is the large community which supports it. The Comprehensive Perl Archive Network is one of the key attractions for me personally; it contains pre-written modules for almost everything you might wish to use with Perl.
Although there is an introduction to installaing modules from CPAN I was suprised to see how basic this was; giving no hint of installing from a distribution-specific package repository for example. Debian has many of the more common Perl modules available within its archive; and Debian packages can also be easily built directly.
SummaryA minor failing I feel I could mention is the lack of "strict" coding. Perl the interpreter has a series of warnings which you can enable to test for common coding errors. (Analogous to the usage of -Wall used to enable all of GCCs compile time warnings). These warnings are usually enabled by starting your script like this:
#!/usr/bin/perl use strict; use warnings;None of the examples used these facilities.
Whilst this lack of warnings, and extra strictness, might not be a problem for the code as described (or available for download) it is disappointing they are not present - both as a reminder to use them yourself, and to aid you in modifying the code for your own needs.
DetailsEven now as a fairly accomplished programmer and systems administrator I still find reading this book very useful.
It appeals to my nature of automation - I find it tedious to repeatedly perform the same tasks, and Perl is wonderfully suited to many common automation jobs.
Although scoring books is both difficult, and very subjective, I would find it hard to give this book a rating below 75%. If it were updated with a new edition in the future with a bit more fresh content it would certainly score closer to 85%.
Title Perl for System Administration Authors David N. Blank-Edelman Publisher O'Reilly ISBN 1-56592-609-9 Cover Price $34.95 Availability
This article can be found online at the Debian Administration website at the following bookmarkable URL:
This article is copyright 2005 Steve - please ask for permission to republish or translate.