Skip to content

Instantly share code, notes, and snippets.

@christiaan-janssen
Last active April 14, 2017 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiaan-janssen/dd90ea33462250bf7333a6c70e568b44 to your computer and use it in GitHub Desktop.
Save christiaan-janssen/dd90ea33462250bf7333a6c70e568b44 to your computer and use it in GitHub Desktop.
Poor mans load graphs
"""
Plot the load of a server with https://plot.ly
save load with:
while :
do
echo `uptime` >> load.txt
sleep 1m
done
"""
import plotly.plotly as py
from plotly.graph_objs import *
time =[]
x1 = []
x2 = []
x3 = []
with file('load.txt') as f:
for line in f:
time.append(line.split()[0]),
x1.append(line.split()[-3])
x2.append(line.split()[-2])
x3.append(line.split()[-1])
one_min = Scatter(
x=time,
y=x1,
name = "1 Min"
)
five_min = Scatter(
x=time,
y=x2,
name = "5 Min"
)
fifteen_min = Scatter(
x=time,
y=x3,
name = '15 Min'
)
data = Data([one_min,five_min,fifteen_min])
py.plot(data, filename = 'Server Load', fileopt='new')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment