本文整理汇总了Python中monasca_agent.collector.checks.AgentCheck类的典型用法代码示例。如果您正苦于以下问题:Python AgentCheck类的具体用法?Python AgentCheck怎么用?Python AgentCheck使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AgentCheck类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, name, init_config, agent_config, instances=None):
AgentCheck.__init__(self, name, init_config, agent_config, instances)
if instances is not None and len(instances) > 1:
raise Exception('cAdvisor host check only supports one configured'
' instance.')
self.connection_timeout = int(init_config.get('connection_timeout',
DEFAULT_TIMEOUT))
self.cadvisor_url = None
self.cadvisor_machine_url = None
self.total_mem = 0
self.num_cores = 0
示例2: __init__
def __init__(self, name, init_config, agent_config):
AgentCheck.__init__(self, name, init_config, agent_config)
# Load any custom metrics from conf.d/sqlserver.yaml
for row in init_config.get('custom_metrics', []):
if row['type'] not in VALID_METRIC_TYPES:
self.log.error('%s has an invalid metric type: %s' % (row['name'], row['type']))
self.METRICS.append((row['name'], row['type'], row['counter_name'],
row.get('instance_name', ''), row.get('tag_by', None)))
# Cache connections
self.connections = {}
示例3: __init__
def __init__(self, name, init_config, agent_config, instances=None):
AgentCheck.__init__(self, name, init_config, agent_config, instances=[{}])
self.instance_cache_file = "{0}/{1}".format(self.init_config.get('cache_dir'),
'libvirt_instances.json')
self.metric_cache_file = "{0}/{1}".format(self.init_config.get('cache_dir'),
'libvirt_metrics.json')
self.use_bits = self.init_config.get('network_use_bits')
if self.init_config.get('disk_collection_period'):
self._disk_collection_period = int(self.init_config.get('disk_collection_period'))
self._last_disk_collect_time = datetime.fromordinal(1)
else:
self._disk_collection_period = 0
self._skip_disk_collection = False
示例4: __init__
def __init__(self, name, init_config, agent_config, instances=None):
AgentCheck.__init__(self, name, init_config, agent_config, instances=[{}])
self.instance_cache_file = "{0}/{1}".format(self.init_config.get('cache_dir'),
'libvirt_instances.json')
self.metric_cache_file = "{0}/{1}".format(self.init_config.get('cache_dir'),
'libvirt_metrics.json')
self.use_bits = self.init_config.get('network_use_bits')
self._collect_intervals = {}
self._set_collection_intervals('disk', 'disk_collection_period')
self._set_collection_intervals('vnic', 'vnic_collection_period')
pool_size = self.init_config.get('max_ping_concurrency', 8)
self.pool = Pool(pool_size)
示例5: setUp
def setUp(self):
agent_config = base_config.get_config(sections='Main')
self._instances = [{'name': 'test',
'mapping': {
'gauges': ['stats.(MessagesAvg)'],
'counters': ['MessagesTotal'],
'dimensions': {
'index': 'index',
'simple_dimension': 'simple_label',
'complex_dimension': {
'source_key': 'complex_label',
'regex': 'k8s_([._\-a-zA-Z0-9]*)_postfix'
},
'complex_dimension_rest': {
'source_key': 'complex_label',
'regex': 'k8s_([._\-a-zA-Z0-9]*_postfix)'
}
},
'groups': {
'testgroup': {
'dimensions': {
'user': 'user'
},
'rates': ['.*\.Responses.*', '(sec_auth_.*).stats',
'(io_service_bytes)_stats_Total']
}
# dimensions should be inherited from above
}}}]
self.check = AgentCheck("DynCheckHelper-Teset", {}, agent_config, self._instances) # TODO mock check
self.helper = DynamicCheckHelper(self.check, 'dynhelper')
示例6: __init__
def __init__(self, name, init_config, agent_config, instances=None):
AgentCheck.__init__(self, name, init_config,
agent_config, instances=[{}])
cache_dir = self.init_config.get('cache_dir')
self.enable_vm = self.init_config.get('enable_vm')
self.enable_ecn = self.init_config.get('enable_ecn')
self.s_factor = self.init_config.get('s_factor')
self.collect_period = self.init_config.get('collect_period')
self.cong_cache_file = os.path.join(cache_dir,
'congestion_status.json')
self.session = keystone.get_session(**self.init_config)
self.chain_exist = False
self.rule_exist = False
self._check_chain()
self.checked = []
if self.enable_ecn:
self._activate_ecn()
示例7: __init__
def __init__(self, name, init_config, agent_config, instances=None):
AgentCheck.__init__(self, name, init_config,
agent_config, instances=[{}])
cache_dir = self.init_config.get('cache_dir')
self.ctr_cache_file = os.path.join(cache_dir, 'ovs_metrics.json')
self.port_cache_file = os.path.join(cache_dir, 'ovs_ports.json')
self.use_bits = self.init_config.get('network_use_bits')
self.check_router_ha = self.init_config.get('check_router_ha')
self.ovs_cmd = OVS_CMD % self.init_config.get('ovs_cmd')
include_re = self.init_config.get('included_interface_re', None)
self.use_absolute_metrics = self.init_config.get('use_absolute_metrics')
if include_re is None:
include_re = 'qg.*'
else:
include_re = include_re + '|' + 'qg.*'
self.include_iface_re = re.compile(include_re)
示例8: testBadMetricKeepBatch
def testBadMetricKeepBatch(self):
agent_config = base_config.get_config(sections='Main')
check = AgentCheck("foo", {}, agent_config)
dimensions = {'A': 'B', 'B': 'C', 'D': 'E'}
check.submit_metric("Foo",
5,
metrics_pkg.Gauge,
dimensions=dimensions,
delegated_tenant=None,
hostname=None,
device_name=None,
value_meta=None)
self.assertEqual(len(check.aggregator.metrics), 1)
dimensions = {'A': '{}', 'B': 'C', 'D': 'E'}
check.submit_metric("Bar",
5,
metrics_pkg.Gauge,
dimensions=dimensions,
delegated_tenant=None,
hostname=None,
device_name=None,
value_meta=None)
self.assertEqual(len(check.aggregator.metrics), 1)
dimensions = {'A': 'B', 'B': 'C', 'D': 'E'}
check.submit_metric("Baz",
5,
metrics_pkg.Gauge,
dimensions=dimensions,
delegated_tenant=None,
hostname=None,
device_name=None,
value_meta=None)
self.assertEqual(len(check.aggregator.metrics), 2)
示例9: __init__
def __init__(self, name, init_config, agent_config):
AgentCheck.__init__(self, name, init_config, agent_config)
# Host status needs to persist across all checks
self.cluster_status = {}
示例10: __init__
def __init__(self, name, init_config, agent_config):
AgentCheck.__init__(self, name, init_config, agent_config)
self._last_state_by_server = {}
示例11: __init__
def __init__(self, name, init_config, agent_config):
AgentCheck.__init__(self, name, init_config, agent_config)
# Host status needs to persist across all checks
self.host_status = defaultdict(lambda: defaultdict(lambda: None))
示例12: __init__
def __init__(self, name, init_config, agent_config):
AgentCheck.__init__(self, name, init_config, agent_config)
self.high_watermarks = {}
示例13: __init__
def __init__(self, name, init_config, agent_config):
AgentCheck.__init__(self, name, init_config, agent_config)
self.dbs = {}
self.versions = {}
示例14: __init__
def __init__(self, name, init_config, agent_config):
AgentCheck.__init__(self, name, init_config, agent_config, instances=[{}])
self.max_objects = init_config.get("vcenter_max_objects", 100000)
示例15: __init__
def __init__(self, name, init_config, agent_config, instances):
AgentCheck.__init__(self, name, init_config, agent_config, instances=instances)
self._max_objects = 1000
self.session = None
self.is_new_session = True
self._resource_moid_dict = {}