Hi,

What started to be a exploration project is now turning out to be pretty useful for me in day to day analysis. Back in days when I worked in support, there was nothing to predict or really worry about historical events for any future work, just grep for logs and you are done with the last flap and analysis.

Customers / Networks now look for more data, while there are systems which do the telemetry and prediction, from an analysis point of view, as an engineer I want to know if the device or a circuit over an interface is stable over a period of time or even if it flaps what is the likely time and day it flaps in a week for a smoother migration.

Requirement : Plot a simple graph analyzing the interface flaps over a period of one week for aΒ  specific interface and decide the actions next from the log messages.[in this case i used a junos device]

Well grepping the logs is not something new for a seasoned engineer but having visual data will prove to be useful for a cutover or migration.

There are systems which can do this work on a day to day basis, most of us have them installed, I never used them to come to a conclusion that if it would be helpful for a migration or upgrade , I dont want to see a traffic dip and count or use a bash script which counts the flaps by cutting with complicated awk/sed and regular expressions , its a way and this is a another way.

Let me first give you the github link, if anyone wants to view or try out the code.

https://github.com/yukthr/auts/blob/master/random_programs/plot_graph_interface_flap.py

 

There are 3 parts to this requirement

 

-> I dont have logs from theΒ  production device , so have written a small program which can mimic the data randomly, i used random module for this from python.

-> Analyse the logs and convert to a list for easier plotting, I used a cStringio module for this

-> Finally, I used matplotlib to plot the interface flap.

Here is the screenshot, I upload screenshots for two reasons, first its way too colorful than boring git paage πŸ˜‰ and second its easy to review

When I use cstring in the program, this is what i see out of the logs which I parsed, so that we take index[1] which represent Date from the list.

Finally, we see the plot like this

From the flap its quite evident that any migration planned for this interface is not safe and it needs to be fixed as the frequency is way too high, we can extend this to any thing even to plot flapΒ  in a hour to get an idea, there are many things that graphs can give us in NMS systems, but am planning to analyze data directly from the device for my needs instead of digging through the whole lot of graphs, in that way its easy.

 

Regards

Rakesh M