@Abuse_Tracker Don't say I didn't warn you... 😛 Super simple CLI MX load grapher. This requires the asciichartpy and meraki modules (you can install both via pip). It'll run for 60 minutes, pulling the load value once a minute and adding it to the graph. #!/usr/bin/python3
from curses import wrapper
from asciichartpy import plot
from meraki import meraki
import time
print("Hello and welcome to the MX Utilization Grapher Utility - Curses Edition")
api_key = input("Please enter your API key: ")
network_id = input("Please enter the Network ID for the MX: ")
serial_number = input("Please enter the serial number of the MX: ")
mx_perf = [0]
def main(stdscr):
stdscr.addstr(0, 0, "Initializing.")
stdscr.refresh()
for each in range(0, 3):
perf_score = meraki.getmxperf(api_key, network_id, serial_number, suppressprint=True)
mx_perf.append(perf_score['perfScore'])
time.sleep(1)
stdscr.addstr(".")
stdscr.refresh()
for each in range(1, 60): # Change 60 to however long, in minutes you want to run this
perf_score = meraki.getmxperf(api_key, network_id, serial_number, suppressprint=True)
mx_perf.append(perf_score['perfScore'])
stdscr.clear()
stdscr.addstr(0, 0, plot(mx_perf))
# display a counter to show how many minutes the graph has been running
stdscr.addstr(str(each))
stdscr.refresh()
# control how wide the displayed graph is
if len(mx_perf) > 60:
mx_perf.pop(1)
# Sleep for 60 seconds
# Perf Score is only updated once a minute anyway
time.sleep(60)
wrapper(main)
... View more