Building a pull-based config change notification system with Python and Slack, part 2 (Diffios)

In this part I would like to get a full report on Slack regarding what changed and who changed it.
Diffios will help me with the first part, while using the log buffer should help me with the who bit.

A short introduction to diffios:

tode@ubuntu:~$ python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import diffios
baseline = "oldconfig.bak"
comparison = "modifiedconfig.bak"
ignore = "ignore.txt"
diff = diffios.Compare(baseline, comparison, ignore)
print(diff.delta())
--- baseline
+++ comparison
+ logging buffered informational

This is pretty self-explanatory, but as you can see these two config files are only different in that i’ve added the logging buffered informational in between the writes and Diffio shows the delta. The ignore.txt files includes only 2 words: „Current configuration” because it doesn’t make sense to put size of config (which appears in the running config file) as delta.
Let’s update our report script now and run part2.py again:

Ok now we know what’s been changed, now on to who’s changed it. I can use the command show archive log config all

After the script is updated again, here’s the Slack output.

to be continued in Building a pull-based config change notification system with Python and Slack part 3 : Interacting with devices in Slack

Skomentuj

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Wyloguj /  Zmień )

Zdjęcie na Google

Komentujesz korzystając z konta Google. Wyloguj /  Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Wyloguj /  Zmień )

Zdjęcie na Facebooku

Komentujesz korzystając z konta Facebook. Wyloguj /  Zmień )

Połączenie z %s