• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python metrics.Metric类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sauron.metrics.Metric的典型用法代码示例。如果您正苦于以下问题:Python Metric类的具体用法?Python Metric怎么用?Python Metric使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: reconfig

 def reconfig(self, name, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     # These are a selection of argument names. If they're
     # present, then we'll use them, otherwise, we'll use
     # the default provided by the redis module itself
     redisArgs = {}
     for arg in ["host", "port", "db", "password", "charset", "errors", "unix_socket_path"]:
         try:
             redisArgs[arg] = kwargs[arg]
         except KeyError:
             pass
     self.redis = redis.Redis(**redisArgs)
     # The keys we should save from the 'info' command in redis
     self.info = kwargs.get("info", [])
     # The keys we should get and interpret as numbers
     self.get = kwargs.get("get", [])
     # The keys we should get, and report their length
     self.llen = kwargs.get("llen", [])
     # The keys we should get and report the hash length
     self.hlen = kwargs.get("hlen", [])
     # The keys we should get and report the particular key from
     self.hget = kwargs.get("hget", {})
     # The keys we should get and report the cardinality of
     self.scard = kwargs.get("scard", [])
     # The keys we should get and report the zcardinality of
     self.zcard = kwargs.get("zcard", [])
     # The patterns we should count the number of keys of
     self.patterns = kwargs.get("patterns", [])
开发者ID:paulcowles,项目名称:sauron,代码行数:28,代码来源:RedisMetric.py


示例2: reconfig

 def reconfig(self, name, host=None, user=None, passwd=None, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.name   = name
     self.host   = host
     self.user   = user
     self.passwd = passwd
     self.conn   = None
     self.cur    = None
开发者ID:johnny-die-tulpe,项目名称:sauron,代码行数:8,代码来源:MySQLMetric.py


示例3: reconfig

 def reconfig(self, name, bucket, keys=None, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.bucketName = bucket
     self.prefix = kwargs.get('prefix', '')
     try:
         self.conn = S3Connection(kwargs.get('aws_id', None), kwargs.get('aws_secret', None))
         self.bucket = self.conn.get_bucket(bucket)
     except BotoClientError as e:
         raise MetricException(repr(e))
开发者ID:wutali,项目名称:sauron,代码行数:9,代码来源:S3BucketMetric.py


示例4: reconfig

 def reconfig(self, name, path, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.name = name
     self.patterns = dict([(k, re.compile(v)) for k,v in kwargs.items()])
     self.path = path
     try:
         self.f = file(self.path)    # The file object we'll read from
     except IOError as e:
         raise MetricException(e)
     self.stat = os.lstat(self.path) # The stats on that particular file
开发者ID:wutali,项目名称:sauron,代码行数:10,代码来源:LogMetric.py


示例5: reconfig

 def reconfig(self, *args, **kwargs):
   Metric.reconfig(self, *args, **kwargs)
   if not isinstance(self.metrics, list):
     raise MetricException('metrics should be a list')
   self.serverstatus_metrics = self.metrics
   for metric in self.serverstatus_metrics:
     try:
       assert NginxServerStatusMetric.AVAILABLE_METRICS_DATA.has_key(metric)
     except AssertionError:
       raise MetricException('Metric is not available, choose out of %s' % (", ".join(NginxServerStatusMetric.AVAILABLE_METRICS_DATA.keys())))
开发者ID:johnny-die-tulpe,项目名称:illuminati,代码行数:10,代码来源:NginxServerStatusMetric.py


示例6: reconfig

 def reconfig(self, name, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     rabbitmq_default = {
         'host': 'localhost',
         'port': 55672,
         'user': 'guest',
         'password': 'guest',
         'vhost': '/'}
     rabbitmq_url_parts = dict([(k, kwargs.get(k, rabbitmq_default[k])) for k in rabbitmq_default.keys()])
     rabbitmq_url_parts['vhost'] = quote(rabbitmq_url_parts['vhost'], '')
     self.queues_api_url = 'http://%(user)s:%(password)[email protected]%(host)s:%(port)i/api/queues/%(vhost)s' % rabbitmq_url_parts
     self.queue_names = kwargs['queues']
开发者ID:johnny-die-tulpe,项目名称:illuminati,代码行数:12,代码来源:RabbitMQMetric.py


示例7: reconfig

 def reconfig(self, *args, **kwargs):
   Metric.reconfig(self, *args, **kwargs)
   if not self.__dict__.has_key('url'):
     self.url = 'http://127.0.0.1/server-status?auto'
   if not isinstance(self.metrics, list):
     raise MetricException('metrics should be a list')
   self.serverstatus_metrics = self.metrics
   for metric in self.serverstatus_metrics:
     try:
       assert HttpdServerStatus.AVAILABLE_METRICS_DATA.has_key(metric)
     except AssertionError:
       raise MetricException('Metric is not available, choose out of %s' % (", ".join(HttpdServerStatus.AVAILABLE_METRICS_DATA.keys())))
开发者ID:johnny-die-tulpe,项目名称:illuminati,代码行数:12,代码来源:HttpdServerStatus.py


示例8: reconfig

 def reconfig(self, name, serializer, url, metrics, interval='60', **kwargs):
   Metric.reconfig(self, name, serializer, **kwargs)
   self.url = url
   self.interval = interval
   if not isinstance(metrics, list):
     raise MetricException('metrics should be a list')
   self.serverstatus_metrics = metrics
   for metric in self.serverstatus_metrics:
     try:
       assert HttpdServerStatus.AVAILABLE_METRICS_DATA.has_key(metric)
     except AssertionError:
       raise MetricException('Metric is not available, choose out of %s' % (", ".join(HttpdServerStatus.AVAILABLE_METRICS_DATA.keys())))
   try:
     server_status = httplib2.Http() 
   except Exception as e:
     raise MetricException(e)
开发者ID:johnny-die-tulpe,项目名称:sauron,代码行数:16,代码来源:HttpdServerStatus.py


示例9: reconfig

 def reconfig(self, name, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.kwargs = kwargs
     for k in ['name', 'user', 'args', 'cwd']:
         try:
             self.kwargs[k] = re.compile(self.kwargs[k])
         except KeyError:
             pass
         except re.error:
             raise MetricException('Invalid regular expression: %s' % self.kwargs[k])
     self.attrs = {
         'user-cpu'    : (ProcMetric.userCPU, 'Seconds'),
         'sys-cpu'     : (ProcMetric.sysCPU , 'Seconds'),
         'real-mem'    : (ProcMetric.realMem, 'Megabytes'),
         'virt-mem'    : (ProcMetric.virtMem, 'Megabytes'),
         'files'       : (ProcMetric.numFiles, 'Count'),
         'children'    : (ProcMetric.numChildren, 'Count'),
         'connections' : (ProcMetric.numConnections, 'Count'),
         'uptime'      : (ProcMetric.uptime, 'Seconds'),
         'percent-mem' : (psutil.Process.get_memory_percent, 'Percent'),
         'threads'     : (psutil.Process.get_num_threads, 'Count')
     }
开发者ID:paulcowles,项目名称:sauron,代码行数:22,代码来源:ProcMetric.py


示例10: reconfig

 def reconfig(self, name, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.kwargs = kwargs
     for k in ["name", "user", "args", "cwd"]:
         try:
             self.kwargs[k] = re.compile(self.kwargs[k])
         except KeyError:
             pass
         except re.error:
             raise MetricException("Invalid regular expression: %s" % self.kwargs[k])
     self.attrs = {
         "user-cpu": (ProcMetric.userCPU, "Seconds"),
         "sys-cpu": (ProcMetric.sysCPU, "Seconds"),
         "real-mem": (ProcMetric.realMem, "Megabytes"),
         "virt-mem": (ProcMetric.virtMem, "Megabytes"),
         "files": (ProcMetric.numFiles, "Count"),
         "children": (ProcMetric.numChildren, "Count"),
         "connections": (ProcMetric.numConnections, "Count"),
         "uptime": (ProcMetric.uptime, "Seconds"),
         "percent-mem": (psutil.Process.get_memory_percent, "Percent"),
         "threads": (psutil.Process.get_num_threads, "Count"),
     }
开发者ID:wutali,项目名称:sauron,代码行数:22,代码来源:ProcMetric.py


示例11: reconfig

 def reconfig(self, url, **kwargs):
   '''parameters: url, [ post={}, timeout=30 ]'''
   Metric.reconfig(self, **kwargs)
   self.url  = url
开发者ID:johnny-die-tulpe,项目名称:illuminati,代码行数:4,代码来源:PingMetric.py


示例12: reconfig

 def reconfig(self, name, cmd, units, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.cmd   = cmd
     self.units = units
开发者ID:paulcowles,项目名称:sauron,代码行数:4,代码来源:ShellMetric.py


示例13: __init__

 def __init__(self, name, serializer, url, **kwargs):
   Metric.__init__(self, name, serializer, **kwargs)
   self.reconfig(name, serializer, url, **kwargs)
开发者ID:johnny-die-tulpe,项目名称:sauron,代码行数:3,代码来源:HttpdServerStatus.py


示例14: reconfig

 def reconfig(self, name, start, stop, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.start = start
     self.stop  = stop
开发者ID:Logicworks,项目名称:sauron,代码行数:4,代码来源:TimeMetric.py


示例15: __init__

 def __init__(self, name, host=None, user=None, passwd=None, **kwargs):
     Metric.__init__(self, name, **kwargs)
     self.reconfig(name, host, user, passwd)
开发者ID:johnny-die-tulpe,项目名称:sauron,代码行数:3,代码来源:MySQLMetric.py


示例16: __init__

 def __init__(self, name, **kwargs):
     Metric.__init__(self, name, **kwargs)
     self.reconfig(name, **kwargs)
开发者ID:johnny-die-tulpe,项目名称:illuminati,代码行数:3,代码来源:RabbitMQMetric.py


示例17: __init__

 def __init__(self, name, host='127.0.0.1', port=9306, **kwargs):
     Metric.__init__(self, name, **kwargs)
     self.reconfig(name, host, port)
开发者ID:johnny-die-tulpe,项目名称:sauron,代码行数:3,代码来源:SphinxMetric.py


示例18: reconfig

 def reconfig(self, name, serializer, path, **kwargs):
     Metric.reconfig(self, name, serializer, **kwargs)
     self.path = path
开发者ID:johnny-die-tulpe,项目名称:sauron,代码行数:3,代码来源:DiskMetric.py


示例19: reconfig

 def reconfig(self, name, url, post=None, timeout=30, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.url  = url
     self.post = post
     self.timeout = timeout  
开发者ID:johnny-die-tulpe,项目名称:sauron,代码行数:5,代码来源:PingMetric.py


示例20: reconfig

 def reconfig(self, name, host='127.0.0.1', port=9306, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.host   = host
     self.port   = port
     self.conn   = None
     self.cur    = None
开发者ID:johnny-die-tulpe,项目名称:sauron,代码行数:6,代码来源:SphinxMetric.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python context.ctx函数代码示例发布时间:2022-05-27
下一篇:
Python logging_util.satosa_logging函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap