Пример #1
0
    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': '******'
                                        },
                                        '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')
Пример #2
0
 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)
Пример #3
0
    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')
        self.use_rate_metrics = self.init_config.get('use_rate_metrics')
        self.use_health_metrics = self.init_config.get('use_health_metrics')
        self.publish_router_capacity = self.init_config.get(
            'publish_router_capacity')
        if include_re is None:
            include_re = 'qg.*'
        else:
            include_re = include_re + '|' + 'qg.*'
        self.include_iface_re = re.compile(include_re)
        self.session = keystone.get_session(**self.init_config)
Пример #4
0
 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
Пример #5
0
 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')
Пример #6
0
 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
Пример #7
0
    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 = {}
Пример #8
0
 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
Пример #9
0
    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)
Пример #10
0
    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)
Пример #11
0
    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': '******'
                                        },
                                        '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')
Пример #12
0
 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()
Пример #13
0
    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)
Пример #14
0
 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()
Пример #15
0
    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)
Пример #16
0
    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)
Пример #17
0
 def __init__(self, name, init_config, agent_config, instances=None):
     AgentCheck.__init__(self, name, init_config, agent_config, instances)
Пример #18
0
    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))
Пример #19
0
    def __init__(self, name, init_config, agent_config, instances=None):
        AgentCheck.__init__(self, name, init_config, agent_config, instances)
        for k in ["mean", "median", "95", "99", "100"]:
            [self.keys.append(m + "_" + k) for m in self.stat_keys]

        self.prev_coord_redirs_total = -1
Пример #20
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self._last_state_by_server = {}
Пример #21
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self._last_state_by_server = {}
Пример #22
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.last_ts = {}
Пример #23
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.wmi_conns = {}
Пример #24
0
    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 = {}
Пример #25
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.connections = {}
Пример #26
0
 def __init__(self, name, init_config, agent_config, instances=None):
     AgentCheck.__init__(self, name, init_config, agent_config, instances)
Пример #27
0
class TestDynamicCheckHelper(unittest.TestCase):
    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': '******'
                                        },
                                        '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')

    def run_check(self):
        self.check.run()
        metric_dict = {"sec": {"auth": [{"user": "******", "total.stats": 10}, {"user": "******", "total.stats": 15}]},
                       "io_service_bytes": {"stats": {"Total": 10}}}
        self.helper.push_metric_dict(self._instances[0], metric_dict, group="testgroup",
                                     labels={'simple_label': 'simple_label_test',
                                             'complex_label': 'k8s_monasca-api-a8109321_postfix'}, max_depth=3)
        self.helper.push_metric(self._instances[0], metric='req.ResponsesOk', value=10.0,
                                group="testgroup",
                                labels={'simple_label': 'simple_label_test',
                                        'complex_label': 'k8s_monasca-api-a8109321_postfix'})
        self.helper.push_metric(self._instances[0], metric='stats.MessagesAvg', value=5.0,
                                labels={'simple_label': 'simple_label_test',
                                        'complex_label': 'k8s_monasca-api-a8109321_postfix'})
        self.helper.push_metric(self._instances[0], metric='MessagesTotal', value=1)
        time.sleep(1)
        self.helper.push_metric_dict(self._instances[0], metric_dict, group="testgroup",
                                     labels={'simple_label': 'simple_label_test',
                                             'complex_label': 'k8s_monasca-api-a8109321_postfix'}, max_depth=3)
        self.helper.push_metric(self._instances[0], metric='req.ResponsesOk', value=15.0,
                                group="testgroup",
                                labels={'simple_label': 'simple_label_test',
                                        'complex_label': 'k8s_monasca-api-a8109321_postfix'})
        self.helper.push_metric(self._instances[0], metric='MessagesTotal', value=100)
        metrics = self.check.get_metrics()

        return metrics

    def testMeasurements(self):
        metrics = self.run_check()
        for m in metrics:
            print "metric: {0}, dimensions: {1}".format(m['measurement']['name'], repr(m['measurement']['dimensions']))
        metric1 = sorted(filter(lambda m: m['measurement']['name'] == 'dynhelper.messages_avg', metrics))
        metric2 = sorted(filter(lambda m: m['measurement']['name'] == 'dynhelper.messages_total', metrics))
        metric3 = sorted(filter(lambda m: m['measurement']['name'] == 'dynhelper.testgroup.req_responses_ok', metrics))
        metric4 = sorted(filter(lambda m: m['measurement']['name'] == 'dynhelper.testgroup.sec_auth_total', metrics))
        self.assertTrue(len(metric1) > 0,
                        'gauge dynhelper.messages_avg missing in metric list {0}'.format(repr(metrics)))
        self.assertEqual(metric1[0]['measurement']['dimensions'],
                          {'simple_dimension': 'simple_label_test', 'complex_dimension': 'monasca-api-a8109321',
                           'complex_dimension_rest': 'monasca-api-a8109321_postfix',
                           'hostname': metric1[0]['measurement']['dimensions'].get('hostname')})
        self.assertTrue(len(metric2) > 0,
                        'rate dynhelper.messages_total missing in metric list {0}'.format(repr(metrics)))
        self.assertEqual(metric2[0]['measurement']['dimensions'],
                          {'hostname': metric2[0]['measurement']['dimensions'].get('hostname')})
        self.assertTrue(len(metric3) > 0,
                        'rate dynhelper.testgroup.req_responses_ok missing in metric list {0}'.format(repr(metrics)))
        self.assertEqual(metric3[0]['measurement']['dimensions'],
                          {'simple_dimension': 'simple_label_test', 'complex_dimension': 'monasca-api-a8109321',
                           'complex_dimension_rest': 'monasca-api-a8109321_postfix',
                           'hostname': metric3[0]['measurement']['dimensions'].get('hostname')})
        self.assertTrue(len(metric4) == 2,
                        'rate dynhelper.testgroup.sec_auth_total missing in metric list {0}'.format(repr(metrics)))
        self.assertEqual(metric4[0]['measurement']['dimensions'],
                          {'simple_dimension': 'simple_label_test', 'complex_dimension': 'monasca-api-a8109321',
                           'complex_dimension_rest': 'monasca-api-a8109321_postfix',
                           'user': '******', 'hostname': metric4[0]['measurement']['dimensions'].get('hostname')})
        self.assertEqual(metric4[1]['measurement']['dimensions'],
                          {'simple_dimension': 'simple_label_test', 'complex_dimension': 'monasca-api-a8109321',
                           'complex_dimension_rest': 'monasca-api-a8109321_postfix',
                           'user': '******', 'hostname': metric4[1]['measurement']['dimensions'].get('hostname')})
Пример #28
0
    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 = {}
Пример #29
0
class TestDynamicCheckHelper(unittest.TestCase):
    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': '******'
                        },
                        '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')

    def run_check(self):
        self.check.run()
        metric_dict = {
            "sec": {
                "auth": [{
                    "user": "******",
                    "total.stats": 10
                }, {
                    "user": "******",
                    "total.stats": 15
                }]
            },
            "io_service_bytes": {
                "stats": {
                    "Total": 10
                }
            }
        }
        self.helper.push_metric_dict(self._instances[0],
                                     metric_dict,
                                     group="testgroup",
                                     labels={
                                         'simple_label':
                                         'simple_label_test',
                                         'complex_label':
                                         'k8s_monasca-api-a8109321_postfix'
                                     },
                                     max_depth=3)
        self.helper.push_metric(self._instances[0],
                                metric='req.ResponsesOk',
                                value=10.0,
                                group="testgroup",
                                labels={
                                    'simple_label':
                                    'simple_label_test',
                                    'complex_label':
                                    'k8s_monasca-api-a8109321_postfix'
                                })
        self.helper.push_metric(self._instances[0],
                                metric='stats.MessagesAvg',
                                value=5.0,
                                labels={
                                    'simple_label':
                                    'simple_label_test',
                                    'complex_label':
                                    'k8s_monasca-api-a8109321_postfix'
                                })
        self.helper.push_metric(self._instances[0],
                                metric='MessagesTotal',
                                value=1)
        time.sleep(1)
        self.helper.push_metric_dict(self._instances[0],
                                     metric_dict,
                                     group="testgroup",
                                     labels={
                                         'simple_label':
                                         'simple_label_test',
                                         'complex_label':
                                         'k8s_monasca-api-a8109321_postfix'
                                     },
                                     max_depth=3)
        self.helper.push_metric(self._instances[0],
                                metric='req.ResponsesOk',
                                value=15.0,
                                group="testgroup",
                                labels={
                                    'simple_label':
                                    'simple_label_test',
                                    'complex_label':
                                    'k8s_monasca-api-a8109321_postfix'
                                })
        self.helper.push_metric(self._instances[0],
                                metric='MessagesTotal',
                                value=100)
        metrics = self.check.get_metrics()

        return metrics

    def testMeasurements(self):
        metrics = self.run_check()
        for m in metrics:
            print "metric: {0}, dimensions: {1}".format(
                m['measurement']['name'], repr(m['measurement']['dimensions']))
        metric1 = sorted(
            filter(
                lambda m: m['measurement']['name'] == 'dynhelper.messages_avg',
                metrics))
        metric2 = sorted(
            filter(
                lambda m: m['measurement']['name'] ==
                'dynhelper.messages_total', metrics))
        metric3 = sorted(
            filter(
                lambda m: m['measurement']['name'] ==
                'dynhelper.testgroup.req_responses_ok', metrics))
        metric4 = sorted(
            filter(
                lambda m: m['measurement']['name'] ==
                'dynhelper.testgroup.sec_auth_total', metrics))
        self.assertTrue(
            len(metric1) > 0,
            'gauge dynhelper.messages_avg missing in metric list {0}'.format(
                repr(metrics)))
        self.assertEqual(
            metric1[0]['measurement']['dimensions'], {
                'simple_dimension': 'simple_label_test',
                'complex_dimension': 'monasca-api-a8109321',
                'complex_dimension_rest': 'monasca-api-a8109321_postfix',
                'hostname':
                metric1[0]['measurement']['dimensions'].get('hostname')
            })
        self.assertTrue(
            len(metric2) > 0,
            'rate dynhelper.messages_total missing in metric list {0}'.format(
                repr(metrics)))
        self.assertEqual(metric2[0]['measurement']['dimensions'], {
            'hostname':
            metric2[0]['measurement']['dimensions'].get('hostname')
        })
        self.assertTrue(
            len(metric3) > 0,
            'rate dynhelper.testgroup.req_responses_ok missing in metric list {0}'
            .format(repr(metrics)))
        self.assertEqual(
            metric3[0]['measurement']['dimensions'], {
                'simple_dimension': 'simple_label_test',
                'complex_dimension': 'monasca-api-a8109321',
                'complex_dimension_rest': 'monasca-api-a8109321_postfix',
                'hostname':
                metric3[0]['measurement']['dimensions'].get('hostname')
            })
        self.assertTrue(
            len(metric4) == 2,
            'rate dynhelper.testgroup.sec_auth_total missing in metric list {0}'
            .format(repr(metrics)))
        self.assertEqual(
            metric4[0]['measurement']['dimensions'], {
                'simple_dimension': 'simple_label_test',
                'complex_dimension': 'monasca-api-a8109321',
                'complex_dimension_rest': 'monasca-api-a8109321_postfix',
                'user': '******',
                'hostname':
                metric4[0]['measurement']['dimensions'].get('hostname')
            })
        self.assertEqual(
            metric4[1]['measurement']['dimensions'], {
                'simple_dimension': 'simple_label_test',
                'complex_dimension': 'monasca-api-a8109321',
                'complex_dimension_rest': 'monasca-api-a8109321_postfix',
                'user': '******',
                'hostname':
                metric4[1]['measurement']['dimensions'].get('hostname')
            })
Пример #30
0
 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 = {}
Пример #31
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.high_watermarks = {}
Пример #32
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.connections = {}
Пример #33
0
    def __init__(self, name, init_config, agent_config, instances=None):
        AgentCheck.__init__(self, name, init_config, agent_config, instances)
        for k in ["mean", "median", "95", "99", "100"]:
            [self.keys.append(m + "_" + k) for m in self.stat_keys]

        self.prev_coord_redirs_total = -1
Пример #34
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.dbs = {}
     self.versions = {}
Пример #35
0
    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))
Пример #36
0
 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)
Пример #37
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.high_watermarks = {}
Пример #38
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.last_ts = {}
Пример #39
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.dbs = {}
     self.versions = {}
Пример #40
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self._max_objects = 1000
     self.session = None
     self.is_new_session = True
     self._resource_moid_dict = {}
Пример #41
0
 def __init__(self, name, init_config, agent_config):
     AgentCheck.__init__(self, name, init_config, agent_config)
     self.instance_cache_file = "{0}/{1}".format(self.init_config.get('cache_dir'),
                                                 'libvirt_instances.yaml')
     self.metric_cache_file = "{0}/{1}".format(self.init_config.get('cache_dir'),
                                               'libvirt_metrics.yaml')
Пример #42
0
 def __init__(self, name, init_config, agent_config, instances=None):
     AgentCheck.__init__(self, name, init_config, agent_config, instances)
     self.assumed_url = {}