Python for system administrators

Course length: 2 days (16 hours)

Description: Python is used in a wide variety of settings. One popular use is as a language for carrying out a variety of system-administration tasks — from carrying out bulk file operations to monitoring systems to provisioning new servers. In particular, many Unix administrators have started to use Python instead of the traditional Unix shell.

This course is aimed at system administrators who want to be able to monitor and control their system more easily using Python. The course assumes knowledge and understanding of Unix/Linux based computers, and will provide system administrators with a set of Python-based tools that they can use to build administrative scripts and applications.

Audience: People who want to see how to use Python in their day-to-day administration of computers running Unix/Linux.  It is assumed that participants have basic knowledge of Python, perhaps through an introductory course.

  • Basic Python refresher
    • Strings, lists, dicts, and sets
    • Loops
    • Functions
    • List, dict, and set comprehensions
  • Modules and packages
    • Pypi and pip
    • Virtualenv
    • Working with files
    • Text files
    • Binary files
    • Cross-platform issues
    • “with” and files
    • CSV
    • JSON
  • Working with directories
    • Paths
    • Directory listings
    • glob
    • External programs
    • Invoking
    • Receiving and/or redirecting output
    • Sending input
  • The “os” modules
    • Cross-platform considerations
    • Permissions and SUID
    • os.path
    • os.stat
    • os.walk
  • datetime
    • File timestamps
    • Comparing timestamps
    • Hash functions
    • Popular file formats
    • INI
    • zip
    • tar
  • Command-line arguments with argparse
  • Sending and parsing E-mail
  • Logging
  • Networking
    • ftp
    • ssh/scp
    • fabric
    • requests
    • SNMP
  • Processes and threads
    • fork
    • parents and children
    • pipes
    • threads
    • multiprocessing
    • threads vs. processes
  • Signals
    • System monitors
    • Simple Web applications for monitoring
    • Provisioning and controlling virtual machines