Last active
April 14, 2017 12:19
-
-
Save christiaan-janssen/dd90ea33462250bf7333a6c70e568b44 to your computer and use it in GitHub Desktop.
Poor mans load graphs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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