xenstats |
Subversion Repositories: |
Rev 1 | Rev 3 | |
---|---|---|
Line 15... | Line 15... | |
for domain in domains: |
for domain in domains: | |
name,id,mem,cpu,state,cputime=re.split("[\t ]+",domain) |
name,id,mem,cpu,state,cputime=re.split("[\t ]+",domain) | |
cputime=int(float(cputime)*1000) |
cputime=int(float(cputime)*1000) | |
rrd=basename+name+".rrd" |
rrd=basename+name+".rrd" | |
if not os.access(rrd,os.F_OK): |
if not os.access(rrd,os.F_OK): | |
# 10 days of exact archive, 42 days of 1 hr RRD, 1000 days of 1 day RRD |
#this should preserve rrd file reset when there is some problem | |
os.system("rrdtool create "+rrd+" --step 60 DS:cpu:COUNTER:666:0:10000"+ |
time.sleep(10) | |
" RRA:LAST:0.5:1:15000"+ |
if not os.access(rrd,os.F_OK): | |
" RRA:MIN:0.5:60:1000 RRA:MIN:0.5:1440:1000"+ |
# 10 days of exact archive, 42 days of 1 hr RRD, 1000 days of 1 day RRD | |
" RRA:MAX:0.5:60:1000 RRA:MAX:0.5:1440:1000"+ |
os.system("rrdtool create "+rrd+" --step 60 DS:cpu:COUNTER:666:0:10000"+ | |
" RRA:AVERAGE:0.5:60:1000 RRA:AVERAGE:0.5:1440:1000") |
" RRA:LAST:0.5:1:15000"+ | |
os.system("rrdtool update %s %s:%s"%(rrd,now,cputime)) |
" RRA:MIN:0.5:60:1000 RRA:MIN:0.5:1440:1000"+ | |
" RRA:MAX:0.5:60:1000 RRA:MAX:0.5:1440:1000"+ | ||
" RRA:AVERAGE:0.5:60:1000 RRA:AVERAGE:0.5:1440:1000") | ||
| ||
#this should preserve rrd file reset when there is some problem | ||
if os.access(rrd,os.F_OK): | ||
os.system("rrdtool update %s %s:%s"%(rrd,now,cputime)) | ||
|
| |
|
|