当前位置: 首页>>代码示例>>Python>>正文


Python RRD.info方法代码示例

本文整理汇总了Python中pyrrd.rrd.RRD.info方法的典型用法代码示例。如果您正苦于以下问题:Python RRD.info方法的具体用法?Python RRD.info怎么用?Python RRD.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyrrd.rrd.RRD的用法示例。


在下文中一共展示了RRD.info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_infoReadMode

# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import info [as 别名]
 def test_infoReadMode(self):
     expectedOutput = """
         filename = "/tmp/tmpP4bTTy"
         rrd_version = "0003"
         step = 300
         last_update = 920804400
         header_size = 800
         ds[speed].index = 0
         ds[speed].type = "COUNTER"
         ds[speed].minimal_heartbeat = 600
         ds[speed].min = NaN
         ds[speed].max = NaN
         ds[speed].last_ds = "U"
         ds[speed].value = 0.0000000000e+00
         ds[speed].unknown_sec = 0
         rra[0].cf = "AVERAGE"
         rra[0].rows = 24
         rra[0].cur_row = 3
         rra[0].pdp_per_row = 1
         rra[0].xff = 5.0000000000e-01
         rra[0].cdp_prep[0].value = NaN
         rra[0].cdp_prep[0].unknown_datapoints = 0
         rra[1].cf = "AVERAGE"
         rra[1].rows = 10
         rra[1].cur_row = 2
         rra[1].pdp_per_row = 6
         rra[1].xff = 5.0000000000e-01
         rra[1].cdp_prep[0].value = NaN
         rra[1].cdp_prep[0].unknown_datapoints = 0
         """
     rrd = RRD(filename=self.rrdfile.name, mode="r", backend=bindings)
     output = StringIO()
     self.assertTrue(os.path.exists(self.rrdfile.name))
     rrd.info(useBindings=True, stream=output)
     for obtained, expected in zip(
         output.getvalue().split("\n"), expectedOutput):
         print "obtained:", obtained
         print "expected:", expected
         if obtained.startswith("filename"):
             self.assertTrue(expected.strip().startswith("filename"))
         else:
             self.assertEquals(obtained.strip(), expected.strip())
     sys.stdout = originalStdout
开发者ID:akatrevorjay,项目名称:pyrrd,代码行数:45,代码来源:test_bindings.py

示例2: RRD

# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import info [as 别名]
myRRD = RRD(filename, step=10, ds=dataSources, rra=roundRobinArchives, start=int(time.time()))
myRRD.create()

# Test for file existence
import os
os.path.isfile(filename)

# Values
# myRRD.bufferValue(str(time.time()), 'q1:q2:q3:lo:hi:total')
myRRD.bufferValue(str(int(time.time())), '1:2:3:0:5:100')
myRRD.bufferValue(str(int(time.time())), '1.2:2.2:3.2:0.2:5.2:90')
myRRD.update()


# Information    
myRRD.info()


# Graph
from pyrrd.graph import DEF, CDEF, VDEF, LINE, AREA, GPRINT
def1 = DEF(rrdfile=myRRD.filename, vname='myspeed', dsName=dataSource.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)
开发者ID:lhl,项目名称:pystatsd-flickr,代码行数:33,代码来源:rrd.py

示例3: BindingsBackendTestCase

# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import info [as 别名]
class BindingsBackendTestCase(TestCase):

    def setUp(self):
        self.ds = [
            DataSource(dsName="speed", dsType="COUNTER", heartbeat=600)]
        self.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=self.ds, rra=self.rra, 
                       start=920804400, backend=bindings)
        self.rrd.create()

    def test_infoWriteMode(self):
        expectedOutput = """
            rra = [{'rows': 24, 'database': None, 'cf': 'AVERAGE', 'cdp_prep': None, 'beta': None, 'seasonal_period': None, 'steps': 1, 'window_length': None, 'threshold': None, 'alpha': None, 'pdp_per_row': None, 'xff': 0.5, 'ds': [], 'gamma': None, 'rra_num': None}, {'rows': 10, 'database': None, 'cf': 'AVERAGE', 'cdp_prep': None, 'beta': None, 'seasonal_period': None, 'steps': 6, 'window_length': None, 'threshold': None, 'alpha': None, 'pdp_per_row': None, 'xff': 0.5, 'ds': [], 'gamma': None, 'rra_num': None}]
            filename = /tmp/tmpQCLRj0
            start = 920804400
            step = 300
            values = []
            ds = [{'name': 'speed', 'min': 'U', 'max': 'U', 'unknown_sec': None, 'minimal_heartbeat': 600, 'value': None, 'rpn': None, 'type': 'COUNTER', 'last_ds': None}]
            ds[speed].name = speed
            ds[speed].min = U
            ds[speed].max = U
            ds[speed].minimal_heartbeat = 600
            ds[speed].type = COUNTER
            rra[0].rows = 24
            rra[0].cf = AVERAGE
            rra[0].steps = 1
            rra[0].xff = 0.5
            rra[0].ds = []
            rra[1].rows = 10
            rra[1].cf = AVERAGE
            rra[1].steps = 6
            rra[1].xff = 0.5
            rra[1].ds = []
            """.strip().split("\n")
        output = StringIO()
        self.assertTrue(os.path.exists(self.rrdfile.name))
        self.rrd.info(useBindings=True, stream=output)
        for obtained, expected in zip(
            output.getvalue().split("\n"), expectedOutput):
            if obtained.startswith("filename"):
                self.assertTrue(expected.strip().startswith("filename"))
            else:
                self.assertEquals(obtained.strip(), expected.strip())

    def test_infoReadMode(self):
        expectedOutput = """
            filename = "/tmp/tmpP4bTTy"
            rrd_version = "0003"
            step = 300
            last_update = 920804400
            header_size = 800
            ds[speed].index = 0
            ds[speed].type = "COUNTER"
            ds[speed].minimal_heartbeat = 600
            ds[speed].min = NaN
            ds[speed].max = NaN
            ds[speed].last_ds = "U"
            ds[speed].value = 0.0000000000e+00
            ds[speed].unknown_sec = 0
            rra[0].cf = "AVERAGE"
            rra[0].rows = 24
            rra[0].cur_row = 3
            rra[0].pdp_per_row = 1
            rra[0].xff = 5.0000000000e-01
            rra[0].cdp_prep[0].value = NaN
            rra[0].cdp_prep[0].unknown_datapoints = 0
            rra[1].cf = "AVERAGE"
            rra[1].rows = 10
            rra[1].cur_row = 2
            rra[1].pdp_per_row = 6
            rra[1].xff = 5.0000000000e-01
            rra[1].cdp_prep[0].value = NaN
            rra[1].cdp_prep[0].unknown_datapoints = 0
            """
        rrd = RRD(filename=self.rrdfile.name, mode="r", backend=bindings)
        output = StringIO()
        self.assertTrue(os.path.exists(self.rrdfile.name))
        rrd.info(useBindings=True, stream=output)
        for obtained, expected in zip(
            output.getvalue().split("\n"), expectedOutput):
            print "obtained:", obtained
            print "expected:", expected
            if obtained.startswith("filename"):
                self.assertTrue(expected.strip().startswith("filename"))
            else:
                self.assertEquals(obtained.strip(), expected.strip())
        sys.stdout = originalStdout
开发者ID:akatrevorjay,项目名称:pyrrd,代码行数:92,代码来源:test_bindings.py

示例4: DEF

# 需要导入模块: from pyrrd.rrd import RRD [as 别名]
# 或者: from pyrrd.rrd.RRD import info [as 别名]
	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')
	myRRD.update()

print "myRRD info:",myRRD.info()
print "myRRD Data:",myRRD.getData()

def1 = DEF(rrdfile=myRRD.filename, vname='myspeed', dsName=dataSource.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')

gprint1 = GPRINT(vdef2, '%6.3lf kph')
开发者ID:leafsummer,项目名称:keeplearning,代码行数:32,代码来源:rrd_test.py


注:本文中的pyrrd.rrd.RRD.info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。