What to do with Python?

Started by heath, February 21, 2021, 04:46:33 PM

Previous topic - Next topic

heath

The weather last week had us working from home, so I've taken the opportunity to dive into Python. I bought David Bombal's "Python Network Programming for Network Engineers (Python 3)" course on Udemy and have also been going through a bunch of videos on YouTube.  It's easier for me to learn if I have a goal in mind other than "just to learn it."  So I'm curious, what are the types of things you do with Python that makes it worth doing it with Python?  A lot of the examples I've seen can be done quite easily with my current management and monitoring tools.  So I'm curious what types of tasks that can be better done with Python I may not have thought of?

Dieselboy

#1
I knew nothing of python then went into a Cisco workshop to guide us through programming python for Cisco Webex Teams APIs. It was fun to create a bot there and make some automations. Cisco devnet have free modules that you can work through. You could make a goal of creating a bot that does something simple like auto-reply to a message. You could also create a chat bot and there are chatbot modules that you can integrate that way also. This is actually on my list of things to get around to looking into - create a chatbot for our corp website so visitors can chat to it and find out stuff.

I had a quick search for you - hope these help
https://developer.cisco.com/site/python/
https://developer.cisco.com/codeexchange/github/repo/CiscoDevNet/python_code_samples_network/

I dont remember if the exact course I followed is here but these two look very similar. They have intro's to python there:
https://developer.cisco.com/learning/tracks/addo
https://developer.cisco.com/learning/tracks/devnet-beginner

icecream-guy

ya can do most anything,  I like the idea of using python to access the API interface on devices, developing automation.
:professorcat:

My Moral Fibers have been cut.

Otanx

Specific items I have done recently:
- Python script using the Netbox API to grab all the devices that match a specific criteria, and import it into our Ansible inventory. This reduced another manual step in deployments that people would forget.
- Nagios plugin to deal with some non-standard SNMP values. The Nagios SNMP plugin does not handle dates. We wanted to alert if the date supplied by SNMP was within 15 days.
- Non work related: Wrote a script to find out when the next SpaceX launch is, and display that to a 32x64 bit screen. Also grab last launch success or failure, total number of Starlink satellites in the sky, and the current speed and location of the Roadster they put in space.

I also have several bash scripts I wrote, and am in the process of moving some of them to python. The big one their is the automated Nagios check creator script. When run it figures out what SNMP values we care about on the device, and creates checks for them.

-Otanx