Perl for System Administration: Managing multi-platform environments with Perl

Overview

Some people plan to become administrators. The rest of us are thrust into it: we are webmasters, hobbyists, or just the default "technical people" on staff who are expected to keep things running. After some stumbling around repeating the same steps over and over again (and occasionally paying the price when we forget one), we realize that we must automate these tasks, or suffer endless frustration. Thus enters Perl.The Perl programming language is ideal for writing quick yet powerful scripts that automate many ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (43) from $1.99   
  • New (6) from $19.92   
  • Used (37) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$19.92
Seller since 2008

Feedback rating:

(169)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
1565926099 BRAND NEW NEVER USED IN STOCK 125,000+ HAPPY CUSTOMERS SHIP EVERY DAY WITH FREE TRACKING NUMBER

Ships from: fallbrook, CA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
$23.99
Seller since 2005

Feedback rating:

(29)

Condition: New
New Ships From Canada. 430 pages. Book Description: Some people plan to become administrators. The rest of us are thrust into it: we are webmasters, hobbyists, or just the ... default "'"technical people"'" on staff who are expected to keep things running. After some stumbling around repeating the same steps over and over again (and occasionally paying the price when we forget one), we realize that we must automate these tasks, or suffer endless frustration. Thus enters Perl. The Perl programming language is ideal for writing quick yet powerful scripts that automate many administrative tasks. It's modular, it's powerful, and it's perfect for managing systems and services on many platforms. Perl for System Administration is designed for all levels of administrators--from hobbyists to card-carrying SAGE members--sysadmins on multi-platform sites. Written for several different platforms (Unix, Windows NT, and Mac OS), it's a guide to the pockets of administration where Perl can be most useful fo. Read more Show Less

Ships from: Ottawa, Canada

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$23.99
Seller since 2005

Feedback rating:

(29)

Condition: New
2000 Paperback 430 pages. Book Description: Some people plan to become administrators. The rest of us are thrust into it: we are webmasters, hobbyists, or just the default ... "technical people" on staff who are expected to keep things running. After some stumbling around repeating the same steps over and over again (and occasionally paying the price when we forget one), we realize that we must automate these tasks, or suffer endless frustration. Thus enters Perl. The Perl programming language is ideal for writing quick yet powerful scripts that automate many administrative tasks. It's modular, it's powerful, and it's perfect for managing systems and services on many platforms. Perl for System Administration is designed for all levels of administrators--from hobbyists to card-carrying SAGE members--sysadmins on multi-platform sites. Written for several different platforms (Unix, Windows NT, and Mac OS), it's a guide to the pockets of administration where Perl can be most useful for sites large and small, inc Read more Show Less

Ships from: Ottawa, Canada

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$25.48
Seller since 2009

Feedback rating:

(872)

Condition: New
1565926099 *BRAND NEW* Ships Same Day or Next!

Ships from: Springfield, VA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$50.00
Seller since 2014

Feedback rating:

(164)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
$50.00
Seller since 2014

Feedback rating:

(164)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

Some people plan to become administrators. The rest of us are thrust into it: we are webmasters, hobbyists, or just the default "technical people" on staff who are expected to keep things running. After some stumbling around repeating the same steps over and over again (and occasionally paying the price when we forget one), we realize that we must automate these tasks, or suffer endless frustration. Thus enters Perl.The Perl programming language is ideal for writing quick yet powerful scripts that automate many administrative tasks. It's modular, it's powerful, and it's perfect for managing systems and services on many platforms.Perl for System Administration is designed for all levels of administrators—from hobbyists to card-carrying SAGE members—sysadmins on multi-platform sites. Written for several different platforms (Unix, Windows NT, and Mac OS), it's a guide to the pockets of administration where Perl can be most useful for sites large and small, including:

  • Filesystem management
  • User administration with a dash of XML
  • DNS and other network name services
  • Database administration using DBI and ODBC
  • Directory services and frameworks like LDAP and ADSI
  • Using email for system administration
  • Working with log files of all kinds
Each chapter concentrates on a single administrative area, discusses the possible pitfalls, and then shows how Perl comes to the rescue. Along the way we encounter interesting Perl features and tricks, with many extended examples and complete programs. The scripts included in the book can simply be used as written or with minimal adaptation. But it's likely that readers will also get a taste of what Perl can do, and start extending those scripts for tasks that we haven't dreamed of.Perl for System Adminstration doesn't attempt to teach the Perl language, but it is an excellent introduction to the power and flexibility of Perl, and it whets the appetite to learn more. It's for anyone who needs to use Perl for system administration and needs to hit the ground running.


A guide for administrators running Unix, Windows NT, or Mac OS platforms demonstrates the use of the programming language in file system management, directory services, user administration, log files, and security and network monitoring

Read More Show Less

Editorial Reviews

Booknews
Blank-Edelman (computer science, Northeastern University) has served as system/network administrator for several multiplatform environments in the Boston area. This readable, self-help type book about Perl language and its uses is directed at non-specialists who know some Perl and work in system administration. Five tutorials, in RCS, LDAP, XML, SQL, and SNMP, are included. The paper binding is designed to open flat. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Internet Book Watch
Perl For System Administration is designed for all levels of administrators, from novice single-box Linux users to seasoned SAGE members. While covering several different platforms including Unix, Windows NT, and Mac OS, Perl For System Administration also covers such core issues as filesystem management, user administration, directory services, database administration, log files, security, and network monitoring. Superbly written and presented, Perl For System Administration will enable the beginner to launch confidently into Perl for administrative tasks, and has much to offer even the more experienced manager.
—Internet Book Watch
Read More Show Less

Product Details

  • ISBN-13: 9781565926097
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 7/28/2000
  • Series: O'Reilly PERL Series
  • Pages: 446
  • Product dimensions: 7.06 (w) x 9.22 (h) x 0.90 (d)

Meet the Author

David N. Blank-Edelman is the Director of Technology at the Northeastern University College of Computer and Information Science. He has spent the last 25 years as a system/network administrator in large multi- platform environments, including Brandeis University, Cambridge Technology Group, and the MIT Media Laboratory. He was also the program chair of the LISA 2005 conference and one of the LISA 2006 Invited Talks co-chairs.

Read More Show Less

Read an Excerpt


Chapter 9: Log Files

If this weren't a book on systems administration, an entire chapter on log files would seem very peculiar indeed. But systems administrators have a very special relationship with log files. Like Doctor Doolittle, the peculiar character from children's literature who could talk to the animals, systems administrators are expected to be able communicate with a large menagerie of software and hardware. Much of this communication takes place through log files, so we become log file linguists. Perl was born to deal with log files, so it can be a big help in this process.

It is impossible to touch on all of the different kinds processing and analysis one can do with logs. Entire books have been devoted to just statistical analysis of this sort of data. However this chapter should give you some general approaches to the topic and Perl tools to whet your appetite for more.

Text Logs

Logs come in different flavors, and so we need several approaches for dealing with them. The most common type of log file is one composed entirely of lines of text. Popular server packages like Apache (web), INN (Usenet news), and Sendmail (e-mail) spew log text in voluminous quantities. Most logs on UNIX machines look similar because they are created by a centralized logging facility known as syslog. For our purposes, we can treat files created by syslog like any other text file.

Here's a very simple Perl program to scan for the word `error' in a text-based log file:


open(LOG,"logfile") or die "Unable to open logfile:$!\n"; 
while(<LOG>){ 
      print if /\berror\b/i; 
} 
close(LOG);

Perl-savvy readers are probably itching to turn it into a one-liner. For those folks:


perl -ne 'print if /\berror\b/i' logfile

Binary Log Files

Sometimes you don't get off that easy writing programs to deal with log files. Instead of nice, easily parseable text lines, some logging mechanisms produce nasty, gnarly binary files with proprietary formats that can't be parsed with a single line of Perl. Luckily, Perl isn't afraid of these miscreants. Let's look at a few approaches we can take when dealing with these files. We're going to look at two different examples of binary logs: UNIX's wtmp file and NT/2000's event logs.

Back in Chapter 3, User Accounts, we touched briefly on the notion of logging in and logging out of a UNIX host. Login and logout activity is tracked in a file called wtmp on most UNIX variants. It is common to check this file whenever there is a question about a user's connection habits (e.g. from what hosts does this person usually log in from?).

On NT/2000, the event logs play a more generalized role. They are used as a central clearinghouse for logging practically all activity that takes place on these machines including login/logout activity, OS messages, security events and etc. Their role is most closely analogous to the UNIX syslog service we mentioned earlier.

Using unpack( )

Perl has a function called unpack( ) especially designed to parse binary and structured data. Let's take a look at how we might use it to deal with the wtmp files. The format of wtmp differs from UNIX variant to UNIX variant. For this specific example we'll look at the wtmp files found on SunOS 4.1.4 and Digital UNIX 4.0 because they are pretty simple. Here's a plain text translation of the first three records in a SunOS 4.1.4 wtmp file:


0000000    ~  \0  \0  \0  \0  \0  \0  \0   r   e   b   o   o   t  \0  \0 
0000020   \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0 
0000040    ,   /   ;   4   c   o   n   s   o   l   e  \0   r   o   o   t 
0000060   \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0 
0000100   \0  \0  \0  \0   ,   /   ; 203   c   o   n   s   o   l   e  \0 
0000120   \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0 
0000140   \0  \0  \0  \0  \0  \0  \0  \0   ,   /   < 230  Insert dump here

Unless you are already familiar with the structure of this file, that "ASCII dump" (as it is called) of the data looks mostly like line noise or some other kind of semi-random garbage. So how do we become acquainted with this file's structure?

The easiest way to understand the format of this file is to look at the source code for programs that read and write to it. If you are not literate in the C language, this may seem like a daunting task. Luckily we don't actually have to understand or even look at most of the source code, we can just examine the portion that defines the file format.

All of the operating system programs which read and write to the wtmp file get their file definition from a single, short C include file which likely to be found at /usr/include/utmp.h. The part of the file we need to look at begins with a definition of the C data structure that will be used to hold the information. If you search for "struct utmp {" you'll find the portion we need. The next lines after "struct utmp {" define each of the fields in this structure. These lines should be each be commented using the "/* text */" C comment convention.

Just to give you an idea of how different two versions of wtmp can be, compare the relevant excerpts from utmp.h on these two operating systems:

SunOS 4.1.4:


struct utmp { 
       char    ut_line[8];   /* tty name */ 
       char    ut_name[8];   /* user id */ 
       char    ut_host[16];  /* host name, if remote */ 
       long    ut_time;     /* time on */ 
};

Digital UNIX 4.0:


struct utmp { 
       char    ut_user[32];  /* User login name */ 
       char    ut_id[14];    /* /etc/inittab id- IDENT_LEN in init */ 
       char    ut_line[32];  /* device name (console, lnxx) */ 
       short   ut_type;      /* type of entry */ 
       pid_t   ut_pid;       /* process id */ 
       struct exit_status { 
           short e_termination; /* Process termination status */ 
           short e_exit;        /* Process exit status */ 
       } ut_exit;            /* The exit status of a process 
                              * marked as DEAD_PROCESS. 
                              */ 
       time_t  ut_time;      /* time entry was made */ 
       char    ut_host[64];  /* host name same as MAXHOSTNAMELEN */ 
};

These files provide all of the clues we need to compose the necessary unpack( ) statement. unpack( ) takes a data format template as its first argument. It uses this template to determine how to disassemble the (usually) binary data it receives in its second argument. unpack( ) will take apart the data as instructed, returning a list where each element of the list corresponds to an element of your template.

Let's construct our template piece-by-piece based on the C structure from the SunOS utmp.h include file above. There are many possible template letters we can use. I've translated the ones we'll use below, but you should check the pack( ) section of the perlfunc manual page for more information. Constructing these templates is not always straightforward because C compilers occasionally pad values out to satisfy alignment constraints. The command pstruct that ships with Perl can often help deal with quirks likes these...

Read More Show Less

Table of Contents

Preface

Chapter 1: Introduction

Chapter 2: Filesystems

Chapter 3: User Accounts

Chapter 4: User Activity

Chapter 5: TCP/IP Name Services

Chapter 6: Directory Services

Chapter 7: SQL Database Administration

Chapter 8: Electronic Mail

Chapter 9: Log Files

Chapter 10: Security and Network Monitoring

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

Colophon

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted September 19, 2000

    A Must-Have

    Here's a book that's well worth the price of admission. Mac, Windows and UNIX are all covered, as are simple, common issues on up to advanced monitoring and analysis. Also includes directory interfaces, including LDAP and Micro$oft's new ADSI.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)