本文整理匯總了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
示例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)
示例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()
示例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()
示例5: init
# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def init(self):
collectd.info("rebellion_monitor plugin has been initialized.")
示例6: shutdown
# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def shutdown(self):
collectd.info("rebellion_monitor plugin has been shutdown.")
示例7: init
# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def init(self):
collectd.info("node_monitor plugin has been initialized.")
示例8: shutdown
# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def shutdown(self):
collectd.info("node_monitor plugin has been shutdown.")
示例9: init
# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def init(self):
collectd.info("docker_daemon_monitor plugin has been initialized.")
示例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
示例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')
示例12: info
# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def info(self, msg):
print 'INFO:', msg
示例13: log
# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def log(msg):
collectd.info("zookeeper plugin: %s" % msg)
示例14: info
# 需要導入模塊: import collectd [as 別名]
# 或者: from collectd import info [as 別名]
def info(self, msg):
pass
示例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))