#!/usr/bin/python import sys import os import glob import time if len(sys.argv)!=2: print "Syntax: %s "%sys.argv[0] sys.exit(1) colors=["000000", "FF0000", "00FF00", "0000FF" ] colors+=["DEDE00", "00FFFF", "FF90FF", "FF8040", "C040A0", "A0A0A0", "40A0A0", "40A0FF", "FFA040" ] def graph(basename, subname, seconds): rrds=glob.glob(basename+"*.rrd") rrds=[x for x in rrds if os.stat(x)[8] > (time.time()-seconds)] cmdline="--imgformat PNG --unit % --vertical-label 'Xen CPU%'" cmdline+="' %s' "%(subname) #cmdline="--imgformat PNG --unit % --vertical-label CPU% --rigid --lower-limit 0 --upper-limit 100 " for rrd,id in zip(rrds,range(len(rrds))): cmdline+="DEF:id%draw=%s:cpu:LAST "%(id,rrd) cmdline+="CDEF:id%dpercent=id%draw,10,/ "%(id,id) cmdline+="CDEF:id%dzero=id%dpercent,DUP,UN,EXC,0,EXC,IF "%(id,id) for rrd,id in zip(rrds,range(len(rrds))): cmdline+="%s:id%dzero#%s:%s "%({0:"AREA"}.get(id,"STACK"),id,colors[id%len(colors)],rrd[len(basename):-4]) cmdline+="GPRINT:id%dpercent:AVERAGE:\"%s\" "%(id,"Average CPU usage\: %02.0lf%%\\j") # print cmdline os.system("rrdtool graph %s../graph/xen-%s.png --start -%d --end -69 %s"%(basename,subname,seconds,cmdline)) basename=sys.argv[1] graph(basename, "hourly", 4000) graph(basename, "6hours", 24000) graph(basename, "daily", 100000) graph(basename, "weekly", 800000) graph(basename, "monthly", 3200000) graph(basename, "yearly", 40000000) #!/usr/bin/python import sys import os import glob import time if len(sys.argv)!=2: print "Syntax: %s "%sys.argv[0] sys.exit(1) colors=["000000", "FF0000", "00FF00", "0000FF" ] colors+=["DEDE00", "00FFFF", "FF90FF", "FF8040", "C040A0", "A0A0A0", "40A0A0", "40A0FF", "FFA040" ] def graph(basename, subname, seconds): rrds=glob.glob(basename+"*.rrd") rrds=[x for x in rrds if os.stat(x)[8] > (time.time()-seconds)] cmdline="--imgformat PNG --unit % --vertical-label CPU% " #cmdline="--imgformat PNG --unit % --vertical-label CPU% --rigid --lower-limit 0 --upper-limit 100 " for rrd,id in zip(rrds,range(len(rrds))): cmdline+="DEF:id%draw=%s:cpu:LAST "%(id,rrd) cmdline+="CDEF:id%dpercent=id%draw,10,/ "%(id,id) cmdline+="CDEF:id%dzero=id%dpercent,DUP,UN,EXC,0,EXC,IF "%(id,id) for rrd,id in zip(rrds,range(len(rrds))): cmdline+="%s:id%dzero#%s:%s "%({0:"AREA"}.get(id,"STACK"),id,colors[id%len(colors)],rrd[len(basename):-4]) cmdline+="GPRINT:id%dpercent:AVERAGE:\"%s\" "%(id,"Average CPU usage\: %02.0lf%%\\j") # print cmdline os.system("rrdtool graph %s../graph/xen-%s.png --start -%d --end -69 %s"%(basename,subname,seconds,cmdline)) basename=sys.argv[1] graph(basename, "hourly", 4000) graph(basename, "daily", 100000) graph(basename, "weekly", 800000) graph(basename, "monthly", 3200000) graph(basename, "yearly", 40000000) WebSVN - xenstats - Diff - Rev 2 and 1 - /xengraph.py
  jablonka.czprosek.czf

xenstats

Subversion Repositories:
[/] [xengraph.py] - Diff between revs 1 and 2

Show entire file Ignore whitespace

Rev 1 Rev 2

Powered by WebSVN 2.2.1