Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Python Scripting for System Administrators

You're reading from   Mastering Python Scripting for System Administrators Write scripts and automate them for real-world administration tasks using Python

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher Packt
ISBN-13 9781789133226
Length 318 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ganesh Sanjiv Naik Ganesh Sanjiv Naik
Author Profile Icon Ganesh Sanjiv Naik
Ganesh Sanjiv Naik
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Python Scripting Overview FREE CHAPTER 2. Debugging and Profiling Python Scripts 3. Unit Testing - Introduction to the Unit Testing Framework 4. Automating Regular Administrative Activities 5. Handling Files, Directories, and Data 6. File Archiving, Encrypting, and Decrypting 7. Text Processing and Regular Expressions 8. Documentation and Reporting 9. Working with Various Files 10. Basic Networking - Socket Programming 11. Handling Emails Using Python Scripting 12. Remote Monitoring of Hosts Over Telnet and SSH 13. Building Graphical User Interfaces 14. Working with Apache and Other Log Files 15. SOAP and REST API Communication 16. Web Scraping - Extracting Useful Data from Websites 17. Statistics Gathering and Reporting 18. MySQL and SQLite Database Administrations 19. Assessments 20. Other Books You May Enjoy

What this book covers

Chapter 1, Python Scripting Overview, covers the installation procedures for Python as well as the use of the Python interpreter tool. You will learn how to assign values to variables and be introduced to variables and strings. You will study the sequence data types, including lists, tuples, sets, and dictionaries. Also, you will learn how to parse command-line options in scripts.

Chapter 2, Debugging and Profiling Python Scripts, teaches you how to debug Python programs using debugger tools. You will also learn how to handle errors, and explore the concepts of profiling and timing.

Chapter 3, Unit Testing – Introduction to the Unit Testing Framework, is about unit testing in Python. We will create unit tests to test programs.

Chapter 4, Automating Regular Administrative Activities, will teach you how to automate the regular administrative activities of the system administrator. You will learn about accepting inputs, handling passwords, the execution of external commands, reading config files, adding warning codes to scripts, implementing CPU limits, web browser launching, use of the os module, and taking backups.

Chapter 5, Handling Files, Directories, and Data, is where you will learn about using the os module for various activities. You will learn about the data and some methods applied to that data, such as copying, moving, merging, and comparing. You will also learn about the tarfile module and how to use it.

Chapter 6, File Archiving, Encrypting, and Decrypting, delves into file archiving, creating archives, and TAR and ZIP creation. You will also learn about unpacking the .tar and .zip files using applications.

Chapter 7, Text Processing and Regular Expressions, looks at text processing and regular expressions in Python. Python has a very powerful library of things called called regular expressions, which do tasks such as searching and extracting data. You will learn how to use regular expressions with files. You will also learn how to read and write to files.

Chapter 8, Documentation and Reporting, will teach you how to document and report information using Python. You will also learn how to take input using Python scripts and how to print the output. Using Python, you can write scripts for automated information gathering. Writing scripts for receiving emails is easier in Python. You will learn how to format information.

Chapter 9, Working with Various Files, will go into the issue of handling various files, such as PDF files, Excel files, and CSV files. You will learn how to open, edit, and get data from these files using Python.

Chapter 10, Basic Networking – Socket Programming, will first introduce the basics of networking; then you will learn about sockets such as TCP, UDP, and more. You will also learn about how to program sockets to communicate and get information of protocols such as HTTP and FTP.

Chapter 11, Handling Emails Using Python Scripting, explores how to compose and send emails using Python scripts. Sending emails is a very common task in any software program. We can use Python's smtplib module for sending emails in Python programs. In this chapter, you will also learn about the different protocols used for sending emails on different servers.

Chapter 12, Remote Monitoring of Hosts Over Telnet and SSH, shows you how to carry out basic configurations on a server with the SSH protocol. We will begin by using the Telnet module, after which we will implement the same configurations using the preferred method, SSH.

Chapter 13, Building Graphical User Interface, looks at graphical user interface creation with the PyQt module.

Chapter 14, Working with Apache and Other Log Files, explains how to work with Apache log files. You will also learn about log-parsing applications; that is, identifying the particular types of log messages. You will also learn how to parse these files and how to handle multiple files; detecting any exceptions, storing data, and producing reports.

Chapter 15, SOAP and REST API Communication, concerns the basics of SOAP and REST, and the differences between them. You will also get to know the SOAP API and how to use it using different libraries. We will also study the REST API and standard libraries.

Chapter 16, Web Scraping – Extracting Useful Data from Websites, will teach you about extracting data from a website using Python’s libraries. You will also learn how to search for articles and source code using Python.

Chapter 17, Statistics Gathering and Reporting, is about advanced Python libraries that are used in scientific calculations. These libraries are NumPy, SciPy, and Matplotlib. You will learn about the concepts of data visualization and learn how to plot data.

Chapter 18, MySQL and SQLite Database Administrations, looks at database administration using MySQL and SQLite databases. You will learn about the requirements and design for this kind of administration, how to modify the plugin framework, and how to write producer and consumer code.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime