當前位置: 首頁>>代碼示例>>Python>>正文


Python Metric.reconfig方法代碼示例

本文整理匯總了Python中sauron.metrics.Metric.reconfig方法的典型用法代碼示例。如果您正苦於以下問題:Python Metric.reconfig方法的具體用法?Python Metric.reconfig怎麽用?Python Metric.reconfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sauron.metrics.Metric的用法示例。


在下文中一共展示了Metric.reconfig方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:30,代碼來源:RedisMetric.py

示例2: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:10,代碼來源:MySQLMetric.py

示例3: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:11,代碼來源:S3BucketMetric.py

示例4: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:12,代碼來源:NginxServerStatusMetric.py

示例5: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:12,代碼來源:LogMetric.py

示例6: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:14,代碼來源:RabbitMQMetric.py

示例7: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:14,代碼來源:HttpdServerStatus.py

示例8: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:18,代碼來源:HttpdServerStatus.py

示例9: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:24,代碼來源:ProcMetric.py

示例10: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 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,代碼行數:24,代碼來源:ProcMetric.py

示例11: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 def reconfig(self, **kwargs):
   Metric.reconfig(self, **kwargs)
   self.conn   = None
   self.cur    = None
開發者ID:johnny-die-tulpe,項目名稱:illuminati,代碼行數:6,代碼來源:SphinxMetric.py

示例12: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 def reconfig(self, name, path, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.path = path
開發者ID:paulcowles,項目名稱:sauron,代碼行數:5,代碼來源:DiskMetric.py

示例13: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 def reconfig(self, url, **kwargs):
   '''parameters: url, [ post={}, timeout=30 ]'''
   Metric.reconfig(self, **kwargs)
   self.url  = url
開發者ID:johnny-die-tulpe,項目名稱:illuminati,代碼行數:6,代碼來源:PingMetric.py

示例14: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 def reconfig(self, name, cmd, units, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.cmd   = cmd
     self.units = units
開發者ID:paulcowles,項目名稱:sauron,代碼行數:6,代碼來源:ShellMetric.py

示例15: reconfig

# 需要導入模塊: from sauron.metrics import Metric [as 別名]
# 或者: from sauron.metrics.Metric import reconfig [as 別名]
 def reconfig(self, name, start, stop, **kwargs):
     Metric.reconfig(self, name, **kwargs)
     self.start = start
     self.stop  = stop
開發者ID:Logicworks,項目名稱:sauron,代碼行數:6,代碼來源:TimeMetric.py


注:本文中的sauron.metrics.Metric.reconfig方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。