xenstats |
Subversion Repositories: |
Rev 1 | Rev 2 | |
---|---|---|
Line 12... | Line 12... | |
colors+=["DEDE00", "00FFFF", "FF90FF", "FF8040", "C040A0", "A0A0A0", "40A0A0", "40A0FF", "FFA040" ] |
colors+=["DEDE00", "00FFFF", "FF90FF", "FF8040", "C040A0", "A0A0A0", "40A0A0", "40A0FF", "FFA040" ] | |
|
| |
def graph(basename, subname, seconds): |
def graph(basename, subname, seconds): | |
rrds=glob.glob(basename+"*.rrd") |
rrds=glob.glob(basename+"*.rrd") | |
rrds=[x for x in rrds if os.stat(x)[8] > (time.time()-seconds)] |
rrds=[x for x in rrds if os.stat(x)[8] > (time.time()-seconds)] | |
|
cmdline="--imgformat PNG --unit % --vertical-label 'Xen CPU%'" | |
cmdline="--imgformat PNG --unit % --vertical-label CPU% " |
cmdline+="' %s' "%(subname) | |
#cmdline="--imgformat PNG --unit % --vertical-label CPU% --rigid --lower-limit 0 --upper-limit 100 " |
#cmdline="--imgformat PNG --unit % --vertical-label CPU% --rigid --lower-limit 0 --upper-limit 100 " | |
|
| |
for rrd,id in zip(rrds,range(len(rrds))): |
for rrd,id in zip(rrds,range(len(rrds))): | |
cmdline+="DEF:id%draw=%s:cpu:LAST "%(id,rrd) |
cmdline+="DEF:id%draw=%s:cpu:LAST "%(id,rrd) | |
cmdline+="CDEF:id%dpercent=id%draw,10,/ "%(id,id) |
cmdline+="CDEF:id%dpercent=id%draw,10,/ "%(id,id) | |
Line 29... | Line 29... | |
# print cmdline |
# print cmdline | |
os.system("rrdtool graph %s../graph/xen-%s.png --start -%d --end -69 %s"%(basename,subname,seconds,cmdline)) |
os.system("rrdtool graph %s../graph/xen-%s.png --start -%d --end -69 %s"%(basename,subname,seconds,cmdline)) | |
|
| |
basename=sys.argv[1] |
basename=sys.argv[1] | |
graph(basename, "hourly", 4000) |
graph(basename, "hourly", 4000) | |
graph(basename, "6hours", 24000) | ||
graph(basename, "daily", 100000) |
graph(basename, "daily", 100000) | |
graph(basename, "weekly", 800000) |
graph(basename, "weekly", 800000) | |
graph(basename, "monthly", 3200000) |
graph(basename, "monthly", 3200000) | |
graph(basename, "yearly", 40000000) |
graph(basename, "yearly", 40000000) | |
|
|