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


Python collectd.info方法代碼示例

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


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

示例1: init_callback

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def init_callback(self):
        self.client = docker.Client(
            base_url=self.docker_url,
            version=DockerPlugin.MIN_DOCKER_API_VERSION)
        self.client.timeout = self.timeout

        # Check API version for stats endpoint support.
        try:
            version = self.client.version()['ApiVersion']
            if StrictVersion(version) < \
                    StrictVersion(DockerPlugin.MIN_DOCKER_API_VERSION):
                raise Exception
        except:
            collectd.warning(('Docker daemon at {url} does not '
                              'support container statistics!')
                             .format(url=self.docker_url))
            return False

        collectd.register_read(self.read_callback)
        collectd.info(('Collecting stats about Docker containers from {url} '
                       '(API version {version}; timeout: {timeout}s).')
                      .format(url=self.docker_url,
                              version=version,
                              timeout=self.timeout))
        return True 
開發者ID:lebauce,項目名稱:docker-collectd-plugin,代碼行數:27,代碼來源:dockerplugin.py

示例2: configure

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def configure(configobj):
    global INTERVAL
    global cl
    global queues_to_count

    config = {c.key: c.values for c in configobj.children}
    INTERVAL = config['interval'][0]
    host = config['host'][0]
    port = int(config['port'][0])
    username = config['username'][0]
    password = config['password'][0]
    queues_to_count = []
    if 'message_count' in config:
        queues_to_count = config['message_count']
    collectd.info('rabbitmq_monitoring: Interval: {}'.format(INTERVAL))
    cl = Client('{}:{}'.format(host, port), username, password)
    collectd.info(
        'rabbitmq_monitoring: Connecting to: {}:{} as user:{} password:{}'
        .format(host, port, username, password))
    collectd.info(
        'rabbitmq_monitoring: Counting messages on: {}'
        .format(queues_to_count))
    collectd.register_read(read, INTERVAL) 
開發者ID:cloud-bulldozer,項目名稱:browbeat,代碼行數:25,代碼來源:collectd_rabbitmq_monitoring.py

示例3: dispatch_stat

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def dispatch_stat(result, name, key, conf):
    """Read a key from info response data and dispatch a value"""
    if result is None:
        collectd.warning('mesos-master plugin: Value not found for %s' % name)
        return
    estype = key.type
    value = result
    log_verbose(conf['verboseLogging'], 'Sending value[%s]: %s=%s for instance:%s' % (estype, name, value, conf['instance']))

    val = collectd.Values(plugin='mesos-master')
    val.type = estype
    val.type_instance = name
    val.values = [value]
    val.plugin_instance = conf['instance']
    # https://github.com/collectd/collectd/issues/716
    val.meta = {'0': True}
    val.dispatch() 
開發者ID:mantl,項目名稱:mantl,代碼行數:19,代碼來源:mesos-master.py

示例4: dispatch_stat

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def dispatch_stat(result, name, key, conf):
    """Read a key from info response data and dispatch a value"""
    if result is None:
        collectd.warning('mesos-slave plugin: Value not found for %s' % name)
        return
    estype = key.type
    value = result
    log_verbose(conf['verboseLogging'], 'Sending value[%s]: %s=%s for instance:%s' % (estype, name, value, conf['instance']))

    val = collectd.Values(plugin='mesos-slave')
    val.type = estype
    val.type_instance = name
    val.values = [value]
    val.plugin_instance = conf['instance']
    # https://github.com/collectd/collectd/issues/716
    val.meta = {'0': True}
    val.dispatch() 
開發者ID:mantl,項目名稱:mantl,代碼行數:19,代碼來源:mesos-agent.py

示例5: init

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def init(self):
        collectd.info("rebellion_monitor plugin has been initialized.") 
開發者ID:laincloud,項目名稱:lain,代碼行數:4,代碼來源:rebellion_monitor.py

示例6: shutdown

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def shutdown(self):
        collectd.info("rebellion_monitor plugin has been shutdown.") 
開發者ID:laincloud,項目名稱:lain,代碼行數:4,代碼來源:rebellion_monitor.py

示例7: init

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def init(self):
        collectd.info("node_monitor plugin has been initialized.") 
開發者ID:laincloud,項目名稱:lain,代碼行數:4,代碼來源:node_monitor.py

示例8: shutdown

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def shutdown(self):
        collectd.info("node_monitor plugin has been shutdown.") 
開發者ID:laincloud,項目名稱:lain,代碼行數:4,代碼來源:node_monitor.py

示例9: init

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def init(self):
        collectd.info("docker_daemon_monitor plugin has been initialized.") 
開發者ID:laincloud,項目名稱:lain,代碼行數:4,代碼來源:docker_daemon_monitor.py

示例10: run

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def run(self):
        collectd.info('Starting stats gathering for {container}.'
                      .format(container=_c(self._container)))

        failures = 0
        while not self.stop:
            try:

                if not self._stream:
                    if not self._feed:
                        self._feed = self._client.stats(self._container,
                                                        decode=True)
                    self._stats = self._feed.next()
                else:
                    self._stats = self._client.stats(self._container,
                                                     decode=True, stream=False)
                # Reset failure count on successfull read from the stats API.
                failures = 0
            except Exception, e:
                collectd.warning('Error reading stats from {container}: {msg}'
                                 .format(container=_c(self._container), msg=e))

                # If we encounter a failure, wait a second before retrying and
                # mark the failures. After three consecutive failures, we'll
                # stop the thread. If the container is still there, we'll spin
                # up a new stats gathering thread the next time read_callback()
                # gets called by CollectD.
                time.sleep(1)
                failures += 1
                if failures > 3:
                    self.stop = True

                # Marking the feed as dead so we'll attempt to recreate it and
                # survive transient Docker daemon errors/unavailabilities.
                self._feed = None 
開發者ID:lebauce,項目名稱:docker-collectd-plugin,代碼行數:37,代碼來源:dockerplugin.py

示例11: __init__

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def __init__(self, docker_url=None):
        self.docker_url = docker_url or DockerPlugin.DEFAULT_BASE_URL
        self.timeout = DockerPlugin.DEFAULT_DOCKER_TIMEOUT
        self.capture = False
        self.stats = {}
        self.stream = False
        s_version = re.match('([\d.]+)', docker.__version__)
        version = tuple([int(x) for x in s_version.group(1).split('.')])
        if version >= STREAM_DOCKER_PY_VERSION:
            self.stream = True
            collectd.info('Docker stats use stream') 
開發者ID:lebauce,項目名稱:docker-collectd-plugin,代碼行數:13,代碼來源:dockerplugin.py

示例12: info

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def info(self, msg):
            print 'INFO:', msg 
開發者ID:lebauce,項目名稱:docker-collectd-plugin,代碼行數:4,代碼來源:dockerplugin.py

示例13: log

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def log(msg):
    collectd.info("zookeeper plugin: %s" % msg) 
開發者ID:signalfx,項目名稱:collectd-zookeeper,代碼行數:4,代碼來源:zk-collectd.py

示例14: info

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def info(self, msg):
        pass 
開發者ID:awslabs,項目名稱:collectd-cloudwatch,代碼行數:4,代碼來源:logger.py

示例15: info

# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def info(self, message):
        """Log an info message to the collectd logger. """

        collectd.info('%s plugin: %s' % (self.name, message)) 
開發者ID:openstack,項目名稱:vitrage,代碼行數:6,代碼來源:plugin.py


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