当前位置: 首页>>代码示例>>Python>>正文


Python checks.AgentCheck类代码示例

本文整理汇总了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
开发者ID:openstack,项目名称:monasca-agent,代码行数:11,代码来源:cadvisor_host.py

示例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 = {}
开发者ID:TomEros,项目名称:monasca-agent,代码行数:12,代码来源:sqlserver.py

示例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
开发者ID:fhtxl,项目名称:monasca-agent,代码行数:13,代码来源:libvirt.py

示例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)
开发者ID:jobrs,项目名称:monasca-agent,代码行数:15,代码来源:libvirt.py

示例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')
开发者ID:openstack,项目名称:monasca-agent,代码行数:31,代码来源:test_checks_utils.py

示例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()
开发者ID:openstack,项目名称:monasca-agent,代码行数:17,代码来源:congestion.py

示例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)
开发者ID:Chillisystems,项目名称:monasca-agent,代码行数:18,代码来源:ovs.py

示例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)
开发者ID:openstack,项目名称:monasca-agent,代码行数:37,代码来源:test_agent_check.py

示例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 = {}
开发者ID:Rubab-Syed,项目名称:monasca-agent,代码行数:5,代码来源:elastic.py

示例10: __init__

 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self._last_state_by_server = {}
开发者ID:fhtxl,项目名称:monasca-agent,代码行数:3,代码来源:mongo.py

示例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))
开发者ID:fhtxl,项目名称:monasca-agent,代码行数:5,代码来源:haproxy.py

示例12: __init__

 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.high_watermarks = {}
开发者ID:Chillisystems,项目名称:monasca-agent,代码行数:3,代码来源:jenkins.py

示例13: __init__

 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.dbs = {}
     self.versions = {}
开发者ID:Chillisystems,项目名称:monasca-agent,代码行数:4,代码来源:postgres.py

示例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)
开发者ID:openstack,项目名称:monasca-agent,代码行数:3,代码来源:vcenter_slim.py

示例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 = {}
开发者ID:jobrs,项目名称:monasca-agent,代码行数:6,代码来源:vcenter.py


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