本文整理汇总了Python中graphs.Graph.add_row方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.add_row方法的具体用法?Python Graph.add_row怎么用?Python Graph.add_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphs.Graph
的用法示例。
在下文中一共展示了Graph.add_row方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_graphs
# 需要导入模块: from graphs import Graph [as 别名]
# 或者: from graphs.Graph import add_row [as 别名]
def _create_graphs(self):
# opcode graph
opcode_graph = Multigraph("%sopcodes" % self.mg_prefix, 'OPCodes', category='bind9')
for opcode, count in self.opcodes.iteritems():
opcode_graph.add_row('opcode_%s' % opcode, opcode, type='COUNTER')
opcode_graph.add_data('opcode_%s' % opcode, count)
yield opcode_graph
# server statistics graph
nsstat_graph = Multigraph("%snsstat" % self.mg_prefix, 'Server Statistics', category='bind9',
args="-l 0", vlabel='Usage (Queries / Second)')
for k, v in sorted(self.nsstat.iteritems()):
nsstat_graph.add_row(k, k, 'DERIVE', 'AREASTACK')
nsstat_graph.add_data(k, v)
yield nsstat_graph
# socket statistics graph
sockstat_graph = Multigraph("%ssockstat" % self.mg_prefix, 'Socket I/O Statistics', category='bind9',
args="-l 0", vlabel='Derived Count')
for k, v in sorted(self.sockstat.iteritems()):
sockstat_graph.add_row(k, k, type='DERIVE', draw='AREASTACK', min=0)
sockstat_graph.add_data(k, v)
yield sockstat_graph
# view graphs
resq_graph = Multigraph("%sresqtypes" % self.mg_prefix, 'Queries', category='bind9',
args='-l 0', vlabel="Queries / second")
resstat_graph = Multigraph("%sresstat" % self.mg_prefix, 'Resolver statistics', category='bind9',
args='-l 0', vlabel="Queries / second")
cachedb_graph = Multigraph("%scachedb" % self.mg_prefix, 'CacheDB', category='bind9',
args='-l 0', vlabel="Count")
# sum the totals over all views for the overview graph
resq_totals = self._sum_dicts([x[1]['resqtype'] for x in self.views])
resstat_totals = self._sum_dicts([x[1]['resstats'] for x in self.views])
cachedb_totals = self._sum_dicts([x[1]['cachedb'] for x in self.views])
# finish overview graphs
for k, v in sorted(resq_totals.iteritems()):
resq_graph.add_row(k, k, type='DERIVE', draw='AREASTACK', min=0)
resq_graph.add_data(k, v)
for k, v in sorted(resstat_totals.iteritems()):
resstat_graph.add_row(k, k, type='DERIVE', draw='AREASTACK', min=0)
resstat_graph.add_data(k, v)
for k, v in sorted(cachedb_totals.iteritems()):
cachedb_graph.add_row(k, k, type='DERIVE', draw='AREASTACK', min=0)
cachedb_graph.add_data(k, v)
for view_name, stats in self.views:
q_graph = Graph("Queries for view '%s'" % view_name, category='bind9', args='-l 0')
for k, v in sorted(stats['resqtype'].iteritems()):
q_graph.add_row(k, k, type='DERIVE', draw='AREASTACK')
q_graph.add_data(k, v)
resq_graph.add_subgraph("%sresqtypes.%s" % (self.mg_prefix, view_name), q_graph)
r_graph = Graph("Resolver statistics for view '%s'" % view_name, category='bind9', args='-l 0')
for k, v in sorted(stats['resstats'].iteritems()):
r_graph.add_row(k, k, type='DERIVE', draw='AREASTACK')
r_graph.add_data(k, v)
resq_graph.add_subgraph("%sresstat.%s" % (self.mg_prefix, view_name), r_graph)
cdb_graph = Graph("Cache DB for view '%s'" % view_name, category='bind9', args='-l 0')
for k, v in sorted(stats['cachedb'].iteritems()):
cdb_graph.add_row(k, k, type='DERIVE', draw='AREASTACK')
cdb_graph.add_data(k, v)
cachedb_graph.add_subgraph("%scachedb.%s" % (self.mg_prefix, view_name), cdb_graph)
yield resq_graph
yield resstat_graph
yield cachedb_graph
# memory graph with total and inuse values
mem_graph = Multigraph("%smemory" % self.mg_prefix, 'Memory usage', category='bind9',
args="-l 0 --base 1024", vlabel="Memory in use")
for k, v in self.memory:
if k == "TotalUse":
mem_graph.add_row(k, k, draw='LINE1', type='DERIVE', min=0)
else:
mem_graph.add_row(k, k, draw='AREASTACK')
mem_graph.add_data(k, v)
yield mem_graph