A Pythonista's adventure to SysAdmin Land
Farhaan Bukhsh (~farhaanbukhsh) |
This talk is more on the lines on how can Python help you to be a better System Administrator. This is more of a personal experience in which python has helped me to better understand the system and manage system resources. Python has also helped in scaling infrastructure and how people use it in the SysAdmin Land.
What will the audience get ?
The audience get an insight about how can basic python help them to manage their infrastructure. This talk can help audience to know about certain python tools and moreover how can they write better tools to simplify System Administration.
This talk might also help them to automate few of the monotonous task.
Topics of the talk
- Usage of our old friend 'os'
- Introduction to Fabric
- Use cases of Fabric
- Introduction to Salt
- Usage of Salt
- Understanding Psutils
- Use cases of Psutils
- Managing container
- Use case of docker
OS is an inbuilt module which is use to interface with the underlying operating system and can be use to automate some trivial jobs.
Fabric is an advance tool for system administration and it use to manage server, setting environment variable etc.
It provides a basic suite of operations for executing local or remote shell commands (normally or via sudo) and uploading/downloading files, as well as auxiliary functionality such as prompting the running user for input, or aborting execution.
Use case of Fabric
Salt is an open source infrastructure management tool. It supports remote command execution from a central point (master host) to multiple hosts (minions). It also supports system states which can be used to configure multiple servers using simple template files.
Use case of Salt
psutil (python system and process utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network, sensors) in Python. It is useful mainly for system monitoring, profiling, limiting process resources and the management of running processes. It implements many functionalities offered by command line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free, nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap.
Usage of Psutils
A lot of us write containerized application, Here the focus is on Docker, Docker extensively to write applications and using container on machine to provide sandbox environment. How python can be use to get info about the spawned container, spawn a container, stop the container.
Usage of python with docker
This talk requires the audience to know:
- Basics of System Administration or at least have an idea of it
import os : https://docs.python.org/2/library/os.html
Docker API: https://docs.docker.com/engine/api/v1.30/
My name is Farhaan Bukhsh, I am a Foss enthusiast and a I contribute to Pagure under Fedora. I graduated this year and started working as a Product Engineer with jnaapti. I have been volunteering for organisations like FSMK and Mozilla. I am a part of DGPLUG too. I have been volunteering at Pycon since 2014.
Pagure Contribution: https://github.com/pypingou/pagure/graphs/contributors
Pycon pune: https://youtu.be/5E_VekmbNGk
Pycon India(Lightning Talk): https://youtu.be/RW8A_alJQco?list=PL6GW05BfqWIe6rMoFFWmllPegB2gU069m&t=68