本文整理汇总了Python中pyrrd.rrd.RRD.update方法的典型用法代码示例。如果您正苦于以下问题:Python RRD.update方法的具体用法?Python RRD.update怎么用?Python RRD.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyrrd.rrd.RRD
的用法示例。
在下文中一共展示了RRD.update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RRDB
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
class RRDB(object):
def __init__(self, filename):
self.db = RRD(filename)
def store(self, values):
self.db.bufferValue(int(time.time()), *values)
self.db.update()
@classmethod
def generate_archives(cls, step, rows=1440,
day_periods=[2, 14, 60, 180, 720]):
rras = []
for days in day_periods:
# how many primary data points (we get one each step)
# go into a consolidated data point
PDPs = 86400 * days / step / rows
rras.extend([
RRA(cf='AVERAGE', xff=0.1, rows=rows, steps=PDPs),
RRA(cf='MIN', xff=0.1, rows=rows, steps=PDPs),
RRA(cf='MAX', xff=0.1, rows=rows, steps=PDPs),
])
return rras
@classmethod
def create_db(cls):
raise NotImplementedError("Create DB is not implemented")
def graph(self, outfile):
raise NotImplementedError("graph method should be overriden")
示例2: rrdtool_log
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
def rrdtool_log(self, count, category, key):
""" Log a message to an category's corresponding rrdtool databse """
# rrdtool doesn't like spaces
key = key.replace(' ', '_')
filename = rrd_dir + '/' + category + '/' + key + '.rrd'
if not category in rrd_categories:
raise ValueError, "Invalid category %s" % category
if not os.path.isfile(filename):
self.rrdtool_create(filename)
# rrdtool complains if you stuff data into a freshly created
# database less than one second after you created it. We could do a
# number of things to mitigate this:
# - sleep for 1 second here
# - return from this function and not log anything only on the
# first time we see a new data key (a new country, a new
# filename).
# - pre-create our databases at startup based on magical knowledge
# of what keys we're going to see coming over the AMQP line
#
# For now, we're just going to return.
return
# TODO -- Is this an expensive operation (opening the RRD)? Can we make
# this happen less often?
rrd = RRD(filename)
rrd.bufferValue(str(int(time.time())), str(count))
# This flushes the values to file.
# TODO -- Can we make this happen less often?
rrd.update()
示例3: _rrdtool_log
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
def _rrdtool_log(self, count, filename):
""" Workhorse for rrdtool logging. Shouldn't be called directly. """
if not os.path.isfile(filename):
self.rrdtool_create(filename)
# rrdtool complains if you stuff data into a freshly created
# database less than one second after you created it. We could do a
# number of things to mitigate this:
# - sleep for 1 second here
# - return from this function and not log anything only on the
# first time we see a new data key (a new country, a new
# filename).
# - pre-create our databases at startup based on magical knowledge
# of what keys we're going to see coming over the AMQP line
#
# For now, we're just going to return.
return
# TODO -- Is this an expensive operation (opening the RRD)? Can we make
# this happen less often?
rrd = RRD(filename)
rrd.bufferValue(str(int(time.time())), str(count))
# This flushes the values to file.
# TODO -- Can we make this happen less often?
rrd.update()
示例4: main
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
def main(self, argv):
"""
Create an RRD file with values 0-9 entered at 1 second intervals from
1980-01-01 00:00:00 (the first date that rrdtool allows)
"""
from pyrrd.rrd import DataSource, RRA, RRD
start = int(datetime(1980, 1, 1, 0, 0).strftime('%s'))
dss = []
rras = []
filename = os.path.join(self.build_dir, 'test.rrd')
rows = 12
step = 10
dss.append(
DataSource(dsName='speed', dsType='GAUGE', heartbeat=2 * step))
rras.append(RRA(cf='AVERAGE', xff=0.5, steps=1, rows=rows))
rras.append(RRA(cf='AVERAGE', xff=0.5, steps=12, rows=rows))
my_rrd = RRD(filename, ds=dss, rra=rras, start=start, step=step)
my_rrd.create()
for i, t in enumerate(
range(start + step, start + step + (rows * step), step)):
self.log.debug(
'DATA: %s %s (%s)' % (t, i, datetime.fromtimestamp(t)))
my_rrd.bufferValue(t, i)
# Add further data 1 second later to demonstrate that the rrd
# lastupdatetime does not necessarily fall on a step boundary
t += 1
i += 1
self.log.debug('DATA: %s %s (%s)' % (t, i, datetime.fromtimestamp(t)))
my_rrd.bufferValue(t, i)
my_rrd.update()
示例5: insert
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
def insert(self):
"""
Inserts new data in the RRD database
"""
rrd = RRD(os.path.join("history/", "%s.rrd" % self.value_id))
rrd.bufferValue(self.time, self.value_value)
rrd.update()
print self.time, self.value_value
示例6: RrdProcess
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
def RrdProcess(rrdfile, samples):
'''Reads given samples and stores them in the RRD database.'''
# TODO: Optionally update the database only periodically.
rrd = RRD(rrdfile)
for sample in samples:
logging.debug("Saving sample %s", sample)
rrd.bufferValue(sample.time, sample.temperature, sample.humidity,
sample.mq9, sample.dust_pc, sample.dust_raw)
rrd.update(debug=True)
# Flush the print statements executed so far.
sys.stdout.flush()
示例7: __init__
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
class StatsRecorder:
def __init__(self, filename):
if os.path.isfile(filename):
self.rrd = RRD(filename)
else:
dataSources = []
dataSources.append( DataSource(dsName='q1', dsType='GAUGE', heartbeat=600, minval=0) )
dataSources.append( DataSource(dsName='q2', dsType='GAUGE', heartbeat=600, minval=0) )
dataSources.append( DataSource(dsName='q3', dsType='GAUGE', heartbeat=600, minval=0) )
dataSources.append( DataSource(dsName='lo', dsType='GAUGE', heartbeat=600, minval=0) )
dataSources.append( DataSource(dsName='hi', dsType='GAUGE', heartbeat=600, minval=0) )
dataSources.append( DataSource(dsName='total', dsType='GAUGE', heartbeat=600, minval=0) )
roundRobinArchives = []
roundRobinArchives.append(RRA(cf='AVERAGE', xff=0.5, steps=1, rows=8640)) # 24h at 1 sample per 10 secs
roundRobinArchives.append(RRA(cf='AVERAGE', xff=0.5, steps=90, rows=2880)) # 1 month at 1 sample per 15 mins
roundRobinArchives.append(RRA(cf='AVERAGE', xff=0.5, steps=2880, rows=5475)) # 5 years at 1 sample per 8 hours
self.rrd = RRD(filename, step=10, ds=dataSources, rra=roundRobinArchives, start=int(time.time()))
self.rrd.create()
self.bucket = { 'a': [], 'b': [] }
self.current_bucket = 'a'
def add(self, value):
self.bucket[self.current_bucket].append(value)
def save(self):
bucket = self.current_bucket
if self.current_bucket == 'a':
self.current_bucket = 'b'
else:
self.current_bucket = 'a'
stats = corestats.Stats(self.bucket[bucket])
q1 = stats.percentile(25)
q2 = stats.percentile(50)
q3 = stats.percentile(75)
lo = stats.min()
hi = stats.max()
total = stats.count()
self.bucket[bucket] = []
self.rrd.bufferValue(str(int(time.time())), q1, q2, q3, lo, hi, total)
self.rrd.update()
示例8: __init__
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
class Storage:
# our storage object
_rrd = None
def __init__(self, filename="heatpumpMonitor.rrd"):
if not os.path.isfile(filename):
self._rrd = self._createRRD(filename)
else:
self._rrd = RRD(filename)
def _createRRD(self, filename):
""" create an rrd file which fits our requirements """
# Let's setup some data sources for our RRD
dss = []
for source in dataSources:
dss.append(DS(dsName=source, dsType='GAUGE', heartbeat=900))
# An now let's setup how our RRD will archive the data
rras = []
# 1 days-worth of one-minute samples --> 60/1 * 24
rra1 = RRA(cf='AVERAGE', xff=0, steps=1, rows=1440)
# 7 days-worth of five-minute samples --> 60/5 * 24 * 7
rra2 = RRA(cf='AVERAGE', xff=0, steps=5, rows=2016)
# 30 days-worth of one hour samples --> 60/60 * 24 * 30
rra3 = RRA(cf='AVERAGE', xff=0, steps=60, rows=720)
# 1 year-worth of half day samples --> 60/60 * 24/12 * 365
rra4 = RRA(cf='AVERAGE', xff=0, steps=720, rows=730)
rras.extend([rra1, rra2, rra3, rra4])
# With those setup, we can now created the RRD
myRRD = RRD(filename, step=step, ds=dss, rra=rras, start=int(time.time()))
myRRD.create(debug=False)
return myRRD
def add(self, aDict):
""" adds the provided values to the rrd database with the current datetime """
# we need to put the dict an correct line
tmp = []
for source in dataSources:
tmp.append(aDict.get(source) or "U")
self._rrd.bufferValue(int(time.time()), *tmp)
self._rrd.update(debug=False)
示例9: update
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
def update(namerrd,vals,updatedtime):
try:
myRRD = RRD(namerrd)
countitem = len(vals)
#myRRD.update(debug=False)
if (countitem == 1):
var1 = vals[0]
myRRD.bufferValue(updatedtime ,var1)
myRRD.update()
elif (countitem == 2):
var1 = vals[0]
var2 = vals[1]
myRRD.bufferValue(updatedtime,var1,var2)
myRRD.update()
elif (countitem == 3):
var1 = vals[0]
var2 = vals[1]
var3 = vals[2]
myRRD.bufferValue(updatedtime,var1,var2,var3)
myRRD.update()
return (True,'Update is successfull. ')
except Exception,e:
return (False,str(e))
示例10: ExternalBackendTestCase
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
class ExternalBackendTestCase(TestCase):
def setUp(self):
ds = [
DataSource(dsName="speed", dsType="COUNTER", heartbeat=600)]
rra = [
RRA(cf="AVERAGE", xff=0.5, steps=1, rows=24),
RRA(cf="AVERAGE", xff=0.5, steps=6, rows=10)]
self.rrdfile = tempfile.NamedTemporaryFile()
self.rrd = RRD(self.rrdfile.name, ds=ds, rra=rra, start=920804400)
self.rrd.create()
def test_updateError(self):
self.rrd.bufferValue(1261214678, 612)
self.rrd.bufferValue(1261214678, 612)
self.assertRaises(ExternalCommandError, self.rrd.update)
try:
self.rrd.update()
except ExternalCommandError, error:
self.assertEquals(str(error),
("ERROR: illegal attempt to update using time 1261214678 "
"when last update time is 1261214678 (minimum one second step)"))
示例11: DEF
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
myRRD.create()
myRRD.bufferValue('920805600', '12363')
myRRD.bufferValue('920805900', '12363')
myRRD.bufferValue('920806200', '12373')
myRRD.bufferValue('920806500', '12383')
myRRD.bufferValue('920806800', '12393')
myRRD.bufferValue('920807100', '12399')
myRRD.bufferValue('920807400', '12405')
myRRD.bufferValue('920807700', '12411')
myRRD.bufferValue('920808000', '12415')
myRRD.bufferValue('920808300', '12420')
myRRD.bufferValue('920808600', '12422')
myRRD.bufferValue('920808900', '12423')
#An example of how to use the RRDCached attribute on Update.
#Note you can only use it on updates for the time being.
myRRD.update(rrdcached="unix:/tmp/rrdcached.sock")
# Let's set up the objects that will be added to the graph
def1 = DEF(rrdfile=myRRD.filename, vname='myspeed', dsName=ds1.name)
cdef1 = CDEF(vname='kmh', rpn='%s,3600,*' % def1.vname)
cdef2 = CDEF(vname='fast', rpn='kmh,100,GT,kmh,0,IF')
cdef3 = CDEF(vname='good', rpn='kmh,100,GT,0,kmh,IF')
vdef1 = VDEF(vname='mymax', rpn='%s,MAXIMUM' % def1.vname)
vdef2 = VDEF(vname='myavg', rpn='%s,AVERAGE' % def1.vname)
line1 = LINE(value=100, color='#990000', legend='Maximum Allowed')
area1 = AREA(defObj=cdef3, color='#006600', legend='Good Speed')
area2 = AREA(defObj=cdef2, color='#CC6633', legend='Too Fast')
line2 = LINE(defObj=vdef2, color='#000099', legend='My Average', stack=True)
gprint1 = GPRINT(vdef2, '%6.2lf kph')
# Now that we've got everything set up, let's make a graph
示例12: RRDManip
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
class RRDManip(object):
def __init__(self, filename, step=None,
dataSources=None, roundRobinArchives=None):
"""
实例化 RRDManip 类对象。
:param filename: the name of the RRD you to manipulative
:param dataSources: 相关的 data Source 队列
:param roundRobinArchives: 相关的 rra 队列
"""
if not isinstance(dataSources, list) and \
not isinstance(dataSources, tuple):
dataSources = [dataSources]
if not isinstance(roundRobinArchives, list) and \
not isinstance(roundRobinArchives, tuple):
roundRobinArchives = [roundRobinArchives]
self.dataSources = dataSources
self.roundRobinArchives = roundRobinArchives
self.filename = filename
self.step = step
self.rrd = None
def ensure_rrd(self):
"""
Ensures that an RRD file is created.
"""
if os.path.isfile(self.filename):
# the rrd file alread exist
self.rrd = RRD(self.filename)
else:
self.create_rrd()
def create_rrd(self):
"""
Creates an RRD file.
"""
dataSources = [DataSource(**ds) for ds in self.dataSources]
roundRobinArchives = [RRA(**rra) for rra in self.roundRobinArchives]
# start 时间设定为当前时间的一天前,86400 即一天内包含的秒数
past_one_day = int(time.time()) - 86400
self.rrd = RRD(self.filename, start=past_one_day, step=self.step,
ds=dataSources, rra=roundRobinArchives)
self.rrd.create()
def update(self, timestamp, values):
"""
Feeds data values into an RRD.
"""
timestamp = int(timestamp)
if not isinstance(values, list) and not isinstance(values, tuple):
values = [values]
self.rrd.bufferValue(timestamp, *values)
try:
self.rrd.update()
except:
# 防止 脏数据 污染 update vslues
self.rrd.values = []
def fetch(self, cf='AVERAGE', resolution=None, start=None, end=None, returnStyle="ds"):
"""
Fetch data values from an RRD.
:param returnStyle: 指定返回的数据格式,包括有'ds' 和 'time'
"""
return self.rrd.fetch(cf, resolution, start, end, returnStyle)
示例13: update
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
def update(self, data):
''' Update the RRD '''
my_rrd = RRD(self._rrd_file)
my_rrd.bufferValue(time.time(), *data)
my_rrd.update()
示例14: draw_graph
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
def draw_graph(data, group):
## Graph bytes_in, bytes_out, request, by time+group
filename = 'network.rrd'
graphfile_traffic = 'traffic%s.png' %group
# graphfileLg_traffic = 'traffic-large.png'
graphfile_request = 'request%s.png' %group
# graphfileLg_request = 'request-large'
#define times
hour = 60 * 60
day = 24 * 60 * 60
week = 7 * day
month = day * 30
quarter = month * 3
half = 365 * day / 2
year = 365 * day
delta = settings.DELTA * hour
step = 1
endTime = int(time.time()) - 600
startTime = endTime - 360000
maxSteps = int((endTime-startTime)/step)
# create RRD file
# DSTYPE
# Counter:Use this format with value of snmp MIB like traffic counter or
# packet number for a interface.
# Gauge:Use this format for value like temperature, indicator of pressure.
# Derive:Use this format if you variation or settings.DELTA between a moment and
# an another moment like the rate of of people entering or leaving a
# room and derive works exactly like COUNTER but without overflow checks.
# Absolute:Use this format when you count the number of mail after an alert.
#
# HEARTBEAT
# Is define the frequency between each update of value in the database but some time
# it is possible to have UNKNOWN value.
# MIN AND MAX are optional parameters witch define the range of your data source (DS).
# If your value is out of the range the value will be defined as UNKNOWN.
# If you don not know exactly the range of you value you can set the MIN and MAX value with
# U for unknown
dss = []
ds1 = DS(dsName='bytes_out', dsType='ABSOLUTE', heartbeat=200)
ds2 = DS(dsName='bytes_in', dsType='ABSOLUTE', heartbeat=200)
ds3 = DS(dsName='request', dsType='COUNTER', heartbeat=200)
dss.extend([ds1, ds2, ds3])
rras1 = []
rra1 = RRA(cf='AVERAGE', xff=0.5, steps=1, rows=1440)
rra2 = RRA(cf='AVERAGE', xff=0.5, steps=6, rows=2016)
rra3 = RRA(cf='AVERAGE', xff=0.5, steps=60, rows=720)
rras1.extend([rra1, rra2, rra3])
myRRD = RRD(filename, step=step, ds=dss, rra=rras1, start=startTime)
myRRD.create(debug=False)
## RRD update
counter = 0
for i in data:
counter += 1
bytes_in = i['bytes_in']
bytes_out = i['bytes_out']
requests = i['request']
times = i['time']
print bytes_out/1000000
myRRD.bufferValue(times, bytes_out, bytes_in, requests)
if counter % 100 == 0:
myRRD.update(debug=True)
myRRD.update(debug=True)
## RRD graph
def1 = DEF(rrdfile=myRRD.filename, vname='output', dsName=ds1.name)
def2 = DEF(rrdfile=myRRD.filename, vname='input', dsName=ds2.name)
def3 = DEF(rrdfile=myRRD.filename, vname='request', dsName=ds3.name)
vdef11 = VDEF(vname='max_out', rpn='%s,MAXIMUM' % def1.vname)
vdef12 = VDEF(vname='avg_out', rpn='%s,AVERAGE' % def1.vname)
vdef21 = VDEF(vname='max_in', rpn='%s,MAXIMUM' % def2.vname)
vdef22 = VDEF(vname='avg_in', rpn='%s,AVERAGE' % def2.vname)
vdef31 = VDEF(vname='max_request', rpn='%s,MAXIMUM' % def3.vname)
vdef32 = VDEF(vname='avg_request', rpn='%s,AVERAGE' % def3.vname)
line1 = LINE(2, defObj=def1, color='#2029CC', legend='Out')
line2 = LINE(2, defObj=def2, color='#00FF00', legend='In')
line3 = LINE(2, defObj=def3, color='#FF0000', legend='Request')
gprint11 = GPRINT(vdef11, 'max\\: %5.1lf %Sbps')
gprint12 = GPRINT(vdef12, 'avg\\: %5.1lf %Sbps\\n')
gprint21 = GPRINT(vdef21, 'max\\: %5.1lf %Sbps')
gprint22 = GPRINT(vdef22, 'avg\\: %5.1lf %Sbps\\n')
gprint31 = GPRINT(vdef31, 'max\\: %5.1lf %S')
gprint32 = GPRINT(vdef32, 'avg\\: %5.1lf %S\\n')
# ColorAttributes
ca = ColorAttributes()
ca.back = '#CCCDE2' #background
ca.canvas = '#FFFFFF'#the background of the actual graph
ca.shadea = '#000000'#left and top border
ca.shadeb = '#111111'#right and bottom border
#.........这里部分代码省略.........
示例15: draw_total
# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import update [as 别名]
def draw_total(res):
## graph total(bytes_out, bytes_in, request) by time
# define name
filename = 'total.rrd'
graphfile_total_traffic = 'total_traffic.png'
# graphfileLg_total_traffic = 'total_traffic-large.png'
graphfile_total_request = 'total_request.png'
# graphfileLg_total_request = 'total_request-large'
#define times
hour = 60 * 60
day = 24 * 60 * 60
week = 7 * day
month = day * 30
quarter = month * 3
half = 365 * day / 2
year = 365 * day
delta = settings.DELTA * hour
step = 1
endTime = int(time.time()) - 600
startTime = endTime - 360000
maxSteps = int((endTime-startTime)/step)
## Create RRD
dss = []
ds1 = DS(dsName='total_bytes_out', dsType='ABSOLUTE', heartbeat=200)
ds2 = DS(dsName='total_bytes_in', dsType='ABSOLUTE', heartbeat=200)
ds3 = DS(dsName='total_request', dsType='ABSOLUTE', heartbeat=200)
dss.extend([ds1, ds2, ds3])
rras1 = []
rra1 = RRA(cf='AVERAGE', xff=0.5, steps=1, rows=1440)
rra2 = RRA(cf='AVERAGE', xff=0.5, steps=6, rows=2016)
rra3 = RRA(cf='AVERAGE', xff=0.5, steps=60, rows=720)
rras1.extend([rra1, rra2, rra3])
myRRD = RRD(filename, step=step, ds=dss, rra=rras1, start=startTime)
myRRD.create(debug=False)
## RRD update
counter = 0
for i in res:
counter += 1
total_bytes_in = int(i['total_bytes_in'])
total_bytes_out = int(i['total_bytes_out'])
total_requests = int(i['total_request'])
t_times = int(i['time'])
print total_bytes_out/1000000
myRRD.bufferValue(t_times, total_bytes_out, total_bytes_in, total_requests)
if counter % 100 == 0:
myRRD.update(debug=True)
myRRD.update(debug=True)
## RRD graph
def1 = DEF(rrdfile=myRRD.filename, vname='output', dsName=ds1.name, cdef='AVERAGE')
def2 = DEF(rrdfile=myRRD.filename, vname='input', dsName=ds2.name, cdef='AVERAGE')
def3 = DEF(rrdfile=myRRD.filename, vname='request', dsName=ds3.name, cdef='AVERAGE')
# Out
vdef11 = VDEF(vname='max_out', rpn='%s,MAXIMUM' % def1.vname)
vdef12 = VDEF(vname='avg_out', rpn='%s,AVERAGE' % def1.vname)
vdef13 = VDEF(vname='min_out', rpn='%s,MINIMUM' % def1.vname)
line1 = LINE(2, defObj=def1, color='#2029CC', legend='Out')
gprint11 = GPRINT(vdef11, 'max\\: %5.1lf %Sbps')
gprint12 = GPRINT(vdef12, 'avg\\: %5.1lf %Sbps')
gprint13 = GPRINT(vdef13, 'min\\: %5.1lf %Sbps\\n')
# In
vdef21 = VDEF(vname='max_in', rpn='%s,MAXIMUM' % def2.vname)
vdef22 = VDEF(vname='avg_in', rpn='%s,AVERAGE' % def2.vname)
line2 = LINE(2, defObj=def2, color='#00FF00', legend='In')
gprint21 = GPRINT(vdef21, 'max\\: %5.1lf %Sbps')
gprint22 = GPRINT(vdef22, 'avg\\: %5.1lf %Sbps\\n')
# Request
vdef31 = VDEF(vname='max_request', rpn='%s,MAXIMUM' % def3.vname)
vdef32 = VDEF(vname='avg_request', rpn='%s,AVERAGE' % def3.vname)
line3 = LINE(2, defObj=def3, color='#FF0000', legend='Request')
gprint31 = GPRINT(vdef31, 'max\\: %5.1lf %S')
gprint32 = GPRINT(vdef32, 'avg\\: %5.1lf %S\\n')
# ColorAttributes
ca = ColorAttributes()
ca.back = '#CCCDE2' #background
ca.canvas = '#FFFFFF'#the background of the actual graph
ca.shadea = '#000000'#left and top border
ca.shadeb = '#111111'#right and bottom border
ca.mgrid = '#6666CC' #major grid
ca.axis = '#000000' #axis of the graph
ca.frame = '#CCCDE2' #line around the color spots
ca.font = '#000000' #color of the font
ca.arrow = '#CC0000' # arrow head pointing up and forward
##
#.........这里部分代码省略.........