本文整理汇总了Python中pymunin.MuninGraph.getFieldCount方法的典型用法代码示例。如果您正苦于以下问题:Python MuninGraph.getFieldCount方法的具体用法?Python MuninGraph.getFieldCount怎么用?Python MuninGraph.getFieldCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymunin.MuninGraph
的用法示例。
在下文中一共展示了MuninGraph.getFieldCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pymunin import MuninGraph [as 别名]
# 或者: from pymunin.MuninGraph import getFieldCount [as 别名]
def __init__(self, argv=(), env=None, debug=False):
MuninPlugin.__init__(self, argv, env, debug)
graphs = [
('supervisord_processes_memory_usage', 'Memory usage', 'Memory usage', 'Memory usage (MiB)', 'LINE2', 'GAUGE', None),
('supervisord_processes_cpu_percent_avg', 'CPU utilization as a percentage (avg)', 'CPU utilization as a percentage (avg)', 'Avg CPU percentage', 'LINE2', 'GAUGE', None),
('supervisord_processes_cpu_percent_max', 'CPU utilization as a percentage (max)', 'CPU utilization as a percentage (max)', 'Max CPU percentage', 'LINE2', 'GAUGE', None),
('supervisord_processes_num_context_switches_involuntary', 'Context switches (involuntary)', 'Context switches (involuntary)', 'Involuntary context switches', 'LINE2', 'GAUGE', None),
('supervisord_processes_num_context_switches_voluntary', 'Context switches (voluntary)', 'Context switches (voluntary)', 'Voluntary context switches', 'LINE2', 'GAUGE', None),
('supervisord_processes_num_fds', 'File descriptors used', 'File descriptors used', None, 'LINE2', 'GAUGE', '--lower-limit 0'),
('supervisord_processes_num_threads', 'Threads currently used', 'Threads currently used', None, 'LINE2', 'GAUGE', '--lower-limit 0'),
('supervisord_processes_num_connections', 'Socket connections opened', 'Socket connections opened', None, 'LINE2', 'GAUGE', '--lower-limit 0')
]
self._category = 'supervisord'
transport = supervisor.xmlrpc.SupervisorTransport(None, None, serverurl=self.envGet('url'))
proxy = xmlrpclib.ServerProxy('http://127.0.0.1', transport=transport)
# print proxy.supervisor.getState()
self.identity = '{0}_{1}'.format(proxy.supervisor.getIdentification(), proxy.supervisor.getPID())
self.entries = proxy.supervisor.getAllProcessInfo()
self._stats = defaultdict(dict)
for (graph_name, graph_title, graph_info, graph_vlabel, graph_draw, graph_type, graph_args) in graphs:
if self.graphEnabled(graph_name):
graph = MuninGraph('Supervisord - {0}'.format(graph_title),
self._category, info=graph_info, vlabel=graph_vlabel, args=graph_args)
for entry in self.entries:
if entry['statename'] not in ('RUNNING',):
continue
label_fmt = entry['group'] == entry['name'] and '{name}.{pid}' or '{group}:{name}'
graph.addField(entry['name'],
label_fmt.format(**entry), draw=graph_draw,
type=graph_type, info=graph_info,
min=graph_name.startswith('supervisord_processes_num_') and 0 or None)
if graph.getFieldCount() > 0:
self.appendGraph(graph_name, graph)
示例2: __init__
# 需要导入模块: from pymunin import MuninGraph [as 别名]
# 或者: from pymunin.MuninGraph import getFieldCount [as 别名]
#.........这里部分代码省略.........
'Global number of pub/sub channels with client subscriptions.'),)
),
('redis_rdb_changes', 'RDB Pending Changes',
'Number of pending changes since last RDB Dump of Redis Server.',
(('rdb_changes_since_last_save', 'changes', 'LINE2', 'GAUGE',
'Number of changes since last RDB Dump.'),)
),
('redis_rdb_dumptime', 'RDB Dump Duration (sec)',
'Duration of the last RDB Dump of Redis Server in seconds.',
(('rdb_last_bgsave_time_sec', 'duration', 'LINE2', 'GAUGE',
'Duration of the last RDB Dump in seconds.'),)
),
]
if self._stats.get('aof_enabled', 0) > 0:
graphs.extend((
('redis_aof_filesize', 'AOF File Size (bytes)',
'Redis Server AOF File Size in bytes.',
(('aof_current_size', 'size', 'LINE2', 'GAUGE',
'AOF File Size in bytes.'),)
),
('redis_aof_bufflen', 'AOF Buffer Length (bytes)',
'Redis Server AOF Buffer Length in bytes.',
(('aof_buffer_length', 'len', 'LINE2', 'GAUGE',
'AOF Buffer Length in bytes.'),)
),
('redis_aof_rewrite_bufflen', 'AOF Rewrite Buffer Length (bytes)',
'Redis Server AOF Rewrite Buffer Length in bytes.',
(('aof_rewrite_buffer_length', 'len', 'LINE2', 'GAUGE',
'AOF Rewrite Buffer Length in bytes.'),)
),
('redis_aof_rewritetime', 'AOF Rewrite Duration (sec)',
'Duration of the last AOF Rewrite of Redis Server in seconds.',
(('aof_last_rewrite_time_sec', 'duration', 'AREA', 'GAUGE',
'Duration of the last AOF Rewrite in seconds.'),)
),
))
for graph_name, graph_title, graph_info, graph_fields in graphs:
if self.graphEnabled(graph_name):
graph = MuninGraph("Redis - %s" % graph_title, self._category,
info=graph_info,
args='--base 1000 --lower-limit 0')
for fname, flabel, fdraw, ftype, finfo in graph_fields:
if self._stats.has_key(fname):
graph.addField(fname, flabel, draw=fdraw, type=ftype,
min=0, info=finfo)
if graph.getFieldCount() > 0:
self.appendGraph(graph_name, graph)
self._stats['db_total_keys'] = 0
self._stats['db_total_expires'] = 0
if self.graphEnabled('redis_db_totals'):
for db in db_list:
fname_keys = "%s_keys" % db
fname_expires = "%s_expires" % db
num_keys = self._stats[db].get('keys', 0)
num_expires = self._stats[db].get('expires', 0)
self._stats[fname_keys] = num_keys
self._stats[fname_expires] = num_expires
self._stats['db_total_keys'] += num_keys
self._stats['db_total_expires'] += num_expires
self._stats['db_total_persists'] = (self._stats['db_total_keys']
- self._stats['db_total_expires'])
graph_name = 'redis_db_totals'
if self.graphEnabled(graph_name) and len(db_list) > 0:
graph = MuninGraph("Redis - Number of Keys", self._category,
info="Number of keys stored by Redis Server",
args='--base 1000 --lower-limit 0')
graph.addField('db_total_expires', 'expire', 'GAUGE', 'AREASTACK',
min=0, info="Total number of keys with expiration.")
graph.addField('db_total_persists', 'persist', 'GAUGE', 'AREASTACK',
min=0, info="Total number of keys without expiration.")
graph.addField('db_total_keys', 'total', 'GAUGE', 'LINE2',
min=0, info="Total number of keys.", colour='000000')
self.appendGraph(graph_name, graph)
graph_name = 'redis_db_keys'
if self.graphEnabled(graph_name) and len(db_list) > 0:
graph = MuninGraph("Redis - Number of Keys per DB", self._category,
info="Number of keys stored in each DB by Redis Server",
args='--base 1000 --lower-limit 0')
for db in db_list:
fname = "%s_keys" % db
graph.addField(fname, db, 'GAUGE', 'AREASTACK', min=0,
info="Number of keys stored in %s." % db)
self.appendGraph(graph_name, graph)
graph_name = 'redis_db_expires'
if self.graphEnabled(graph_name) and len(db_list) > 0:
graph = MuninGraph("Redis - Number of Keys with Expiration per DB",
self._category,
info="Number of keys stored in each DB by Redis Server",
args='--base 1000 --lower-limit 0')
for db in db_list:
fname = "%s_expires" % db
graph.addField(fname, db, 'GAUGE', 'AREASTACK', min=0,
info="Number of keys with expiration stored in %s." % db)
self.appendGraph(graph_name, graph)