T
T
Thomas Storm2015-09-30 10:23:16
Python
Thomas Storm, 2015-09-30 10:23:16

Python for an engineer?

Hello!
I took self-study courses in python, and so that the useful skill does not disappear, I want to put my knowledge into practice.
I would like to ask the community:
1) What engineering problems did you solve with the help of python? Why not bash/powershell?
2) Are there any resources where you can look at the implementation of Python scripts in administration? github?
Please answer to the point and do not send to gogol.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
X
xSkyFoXx, 2015-09-30
@v_sadist

1) What engineering problems have you solved with python? Why not bash/powershell?

Like any other general purpose language, almost any automation task can be implemented in python. Just watch yourself and see what you would like to automate in work or everyday life. For example, I parse server logs, isolate errors from them and visualize it for myself over http.
Actually, Ansible . In addition, it is written in python itself, so any new plugins or some advanced automations you will need to write in python.

T
throughtheether, 2015-09-30
@throughtheether

What engineering problems have you solved with python?
Generating configuration files for jinja switches. Simple web interfaces (flask, bottle). Parsing logs and exported data (lxml). Resource accounting (base on sqlite + web interface + uploading reports).
UPD : I forgot to mention, traffic generation with scapy in order to catch a bug.
Why not bash/powershell?
It was easier to write once in python and run where necessary.

T
tetafro, 2015-10-08
@tetafro

Why not bash/powershell?

Python code is much simpler and more logical. It is easier to remember the syntax, it is easier to read what has been written before. Plus, web interfaces are easy to write, and then do the same as before in the console, but only with the mouse in the browser.

A
Alexander Afanasiev, 2015-10-09
@XanderEVG

I wrote a script that downloads, sorts by days of weeks and months, deletes outdated backups from Checkpoint devices. he also wrote a script that added a line to the ACL for 20 switches (I wonder how this problem is usually solved? ciscoworks seems to be able to ...) and a lot more on the little things.
why not bash? with backups, I first wrote it in bash, then rewrote it in python. somehow more beautiful or something, easier. and I can't bash at all :D

D
des1roer, 2015-09-30
@des1roer

purely admin tasks - cron backup, request processing and logging

D
Dmitry Vapelnik, 2015-10-08
@dvapelnik

I wrote a daemon for myself that collects statistics on the consumption of resources by Docker containers and then gives the data to Munin in the form of a moisture. I am sure that the code is not perfect because I am not a python developer, but I use it only for my urgent administration tasks https://github.com/dvapelnik/docker-spectator

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question