Example #1
0
    def setUp(self, config=None):
        if config is None:
            config = get_collector_config('UptimeCollector', {
                'interval': '10',
            })
        else:
            config = get_collector_config('UptimeCollector', config)

        self.collector = UptimeCollector(config, None)
    def setUp(self, config=None):
        if config is None:
            config = get_collector_config('SunOSDiskHealthCollector',
                                          {'interval': '10'})
        else:
            config = get_collector_config('SunOSDiskHealthCollector',
                                          config)

        self.collector = SunOSDiskHealthCollector(config, None)
Example #3
0
    def setUp(self, config=None):
        if config is None:
            config = get_collector_config("WebsiteCollector", {"url": ""})
        else:
            config = get_collector_config("WebsiteCollector", config)

        self.collector = WebsiteMonitorCollector(config, None)

        self.patcher = patch("urllib2.urlopen")
        self.urlopen_mock = self.patcher.start()
Example #4
0
    def setUp(self, config=None):
        if config is None:
            config = get_collector_config('WebsiteCollector', {
                'url': ''
                })
        else:
            config = get_collector_config('WebsiteCollector', config)

        self.collector = WebsiteMonitorCollector(config, None)

        self.patcher = patch('urllib2.urlopen')
        self.urlopen_mock = self.patcher.start()
Example #5
0
    def setUp(self, config=None):
        if config is None:
            config = get_collector_config(
                "HttpdCollector", {"interval": "10", "url": "http://www.example.com:80/server-status?auto"}
            )
        else:
            config = get_collector_config("HttpdCollector", config)

        self.collector = HttpdCollector(config, None)

        self.HTTPResponse = TestHTTPResponse()

        httplib.HTTPConnection.request = Mock(return_value=True)
        httplib.HTTPConnection.getresponse = Mock(return_value=self.HTTPResponse)
Example #6
0
    def setUp(self, config=None):
        if config is None:
            config = get_collector_config('HttpdCollector', {
                'interval': '10',
                'url':      ''
            })
        else:
            config = get_collector_config('HttpdCollector', config)

        self.collector = HttpdCollector(config, None)

        self.HTTPResponse = TestHTTPResponse()

        httplib.HTTPConnection.request = Mock(return_value=True)
        httplib.HTTPConnection.getresponse = Mock(
            return_value=self.HTTPResponse)
Example #7
0
    def setUp(self):
        config = get_collector_config('HttpCollector', {
            'req_vhost': 'www.my_server.com',
            'req_url': ['http://www.my_server.com/']
        })

        self.collector = HttpCollector(config, None)
Example #8
0
    def setUp(self):
        config = get_collector_config('MemoryDockerCollector', {
            'interval': 10,
            'byte_unit': ['megabyte', 'byte']
        })

        self.collector = MemoryDockerCollector(config, None)
 def setUp(self):
   config = get_collector_config('DockerStatsCollector', {
     'client_url': 'localhost:4243',
     'name_from_env': None,
     'interval': 1,
   })
   self.collector = DockerStatsCollector(config, None)
Example #10
0
    def setUp(self):
        config = get_collector_config('ConnTrackCollector', {
            'interval': 10,
            'bin': 'true',
        })

        self.collector = ConnTrackCollector(config, None)
Example #11
0
    def setUp(self):
        config = get_collector_config('NetfilterAccountingCollector', {
            'interval': 10,
            'bin': 'true',
        })

        self.collector = NetfilterAccountingCollector(config, None)
Example #12
0
    def setUp(self):
        config = get_collector_config('KSMCollector', {
            'interval': 10,
            'ksm_path': os.path.dirname(__file__) + '/fixtures/'
        })

        self.collector = KSMCollector(config, None)
Example #13
0
    def setUp(self):
        config = get_collector_config(
            "OpenVPNCollector",
            {"interval": 10, "method": None, "instances": "file://" + self.getFixturePath("status.log")},
        )

        self.collector = OpenVPNCollector(config, None)
Example #14
0
    def setUp(self):
        config = get_collector_config('BeanstalkdCollector', {
            'host': 'localhost',
            'port': 11300,
        })

        self.collector = BeanstalkdCollector(config, None)
Example #15
0
    def setUp(self):
        config = get_collector_config('MemoryCgroupCollector', {
            'interval': 10,
            'byte_unit': 'megabyte'
        })

        self.collector = MemoryCgroupCollector(config, None)
Example #16
0
    def setUp(self):
        config = get_collector_config('PuppetAgentCollector', {
            'interval': 10,
            'yaml_path': self.getFixturePath('last_run_summary.yaml')
        })

        self.collector = PuppetAgentCollector(config, None)
Example #17
0
    def setUp(self):
        config = get_collector_config('KVMCollector', {
            'interval': 10,
        })

        self.collector = KVMCollector(config, None)
        self.collector.PROC = os.path.dirname(__file__) + '/fixtures/'
Example #18
0
    def setUp(self):
        config = get_collector_config('DiskSpaceCollector', {
            'interval': 10,
            'byte_unit': ['gigabyte'],
        })

        self.collector = DiskSpaceCollector(config, None)
Example #19
0
    def setUp(self):
        config = get_collector_config('SmartCollector', {
            'interval': 10,
            'bin': 'true',
        })

        self.collector = SmartCollector(config, None)
Example #20
0
    def setUp(self):
        config = get_collector_config('UserScriptsCollector', {
            'interval': 10,
            'scripts_path': os.path.dirname(__file__) + '/fixtures/',
        })

        self.collector = UserScriptsCollector(config, None)
Example #21
0
    def setUp(self):
        config = get_collector_config('CPUCollector', {
            'interval': 10,
            'normalize': False
        })

        self.collector = CPUCollector(config, None)
Example #22
0
 def setUp(self):
     config = get_collector_config('MongoDBCollector', {
         'host': 'localhost:27017',
         'databases': '^db'
     })
     self.collector = MongoDBCollector(config, None)
     self.connection = MagicMock()
Example #23
0
    def setUp(self):
        config = get_collector_config('MemcachedCollector', {
            'interval': 10,
            'hosts': ['localhost:11211'],
        })

        self.collector = MemcachedCollector(config, None)
Example #24
0
 def setUp(self):
     config = get_collector_config('RabbitMQCollector', {
         'host': 'localhost:55672',
         'user': '******',
         'password': '******'
     })
     self.collector = RabbitMQCollector(config, None)
Example #25
0
    def setUp(self):
        config = get_collector_config('NetworkCollector', {
            'interval':  10,
            'byte_unit': ['megabit', 'megabyte'],
        })

        self.collector = NetworkCollector(config, None)
Example #26
0
    def setUp(self):
        config = get_collector_config('EximCollector', {
            'interval': 10,
            'bin': 'true'
        })

        self.collector = EximCollector(config, None)
Example #27
0
    def setUp(self):
        config = get_collector_config('CPUCollector', {
            'interval': 1,
            'normalize': True,
        })

        self.collector = CPUCollector(config, None)

        self.num_cpu = 2

        # first measurement
        self.input_base = {
            'user': 100,
            'nice': 200,
            'system': 300,
            'idle': 400,
        }
        # second measurement
        self.input_next = {
            'user': 110,
            'nice': 220,
            'system': 330,
            'idle': 440,
        }
        # expected increment, divided by number of CPUs
        # for example, user should be 10/2 = 5
        self.expected = {
            'total.user': 5.0,
            'total.nice': 10.0,
            'total.system': 15.0,
            'total.idle': 20.0,
        }
Example #28
0
    def setUp(self):
        config = get_collector_config('RedisCollector', {
            'interval': '1',
            'databases': 1,
        })

        self.collector = RedisCollector(config, None)
Example #29
0
    def setUp(self):
        config = get_collector_config('TwemproxyCollector', {
            'interval': 60,
            'hosts': ['localhost:22222'],
        })

        self.collector = TwemproxyCollector(config, None)
Example #30
0
    def setUp(self):
        config = get_collector_config('NumaCollector', {
            'interval': 10,
            'bin': '/usr/bin/true'
        })

        self.collector = NumaCollector(config, None)
Example #31
0
 def setUp(self):
     config = get_collector_config('SNMPRawCollector', {
     })
     self.collector = SNMPRawCollector(config, None)
Example #32
0
    def setUp(self):
        config = get_collector_config('VarnishCollector', {})

        self.collector = VarnishCollector(config, None)
Example #33
0
    def setUp(self):
        config = get_collector_config('MesosCGroupCollector', {})

        self.collector = MesosCGroupCollector(config, None)
Example #34
0
    def setUp(self):
        config = get_collector_config('ApcupsdCollector', {'interval': 10})

        self.collector = ApcupsdCollector(config, None)
Example #35
0
    def setUp(self):
        config = get_collector_config('KafkaCollector', {'interval': 10})

        self.collector = KafkaCollector(config, None)
Example #36
0
    def setUp(self):
        config = get_collector_config('LogglyCollector', self.TEST_CONFIG)

        self.collector = LogglyCollector(config, None)
Example #37
0
    def setUp(self):
        config = get_collector_config('NtpCollector', {})

        self.collector = NtpCollector(config, None)
    def setUp(self):
        config = get_collector_config('KafkaConsumerLagCollector',
                                      {'consumer_groups': ['test_group']})

        self.collector = KafkaConsumerLagCollector(config, None)
Example #39
0
    def setUp(self):
        config = get_collector_config('PostqueueCollector', {})

        self.collector = PostqueueCollector(config, {})
Example #40
0
    def setUp(self):
        config = get_collector_config('FilestatCollector', {
            'interval': 10
        })

        self.collector = FilestatCollector(config, None)
Example #41
0
    def setUp(self):
        config = get_collector_config('LoadAverageCollector', {'interval': 10})

        self.collector = LoadAverageCollector(config, None)
Example #42
0
    def setUp(self):
        config = get_collector_config('DropwizardCollector', {})

        self.collector = DropwizardCollector(config, None)
Example #43
0
    def bootStrap(self, custom_config={}):
        config = get_collector_config('AerospikeCollector', custom_config)

        self.collector = AerospikeCollector(config, None)
Example #44
0
 def test_throws_exception_when_interval_not_multiple_of_60(self):
     config = get_collector_config('ElbCollector', {'interval': 10})
     assertRaisesAndContains(Exception, 'multiple of', ElbCollector,
                             *[config, None])
Example #45
0
    def setUp(self):
        config = get_collector_config('HadoopCollector', {
            'metrics': [os.path.dirname(__file__) + '/fixtures/*metrics.log'],
        })

        self.collector = HadoopCollector(config, {})
 def test_new__instances_default(self):
     config = get_collector_config('ElasticSearchCollector', {})
     self.collector = ElasticSearchCollector(config, None)
     self.assertEqual(self.collector.instances, {'': ('127.0.0.1', 9200)})
Example #47
0
    def setUp(self):
        config = get_collector_config('CpuAcctCgroupCollector',
                                      {'interval': 10})

        self.collector = CpuAcctCgroupCollector(config, None)
 def test_new__instances_single(self):
     config = get_collector_config('ElasticSearchCollector',
                                   {'instances': 'bla'})
     self.collector = ElasticSearchCollector(config, None)
     self.assertEqual(self.collector.instances, {'default': ('bla', 9200)})
Example #49
0
    def test_collect(self, publish_metric, connect_to_region, cloudwatch):
        config = get_collector_config(
            'ElbCollector',
            {
                'interval': 60,
                'regions': {
                    'us-west-1': {
                        'elb_names': ['elb1'],
                    }
                }
            })

        az = Mock()
        az.name = 'us-west-1a'

        ec2_conn = Mock()
        ec2_conn.get_all_zones = Mock()
        ec2_conn.get_all_zones.return_value = [az]
        connect_to_region.return_value = ec2_conn

        cw_conn = Mock()
        cw_conn.get_metric_statistics = Mock()
        ts = datetime.datetime.now().replace(second=0, microsecond=0)

        cw_conn.get_metric_statistics.side_effect = [
            [{u'Timestamp': ts, u'Average': 1.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Average': 2.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Sum': 3.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Average': 4.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Sum': 6.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Sum': 7.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Sum': 8.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Sum': 9.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Sum': 10.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Sum': 11.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Sum': 12.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Maximum': 13.0, u'Unit': u'Count'}],
            [{u'Timestamp': ts, u'Sum': 14.0, u'Unit': u'Count'}],
        ]

        cloudwatch.connect_to_region = Mock()
        cloudwatch.connect_to_region.return_value = cw_conn

        collector = ElbCollector(config, handlers=[])

        target = ts + datetime.timedelta(minutes=1)
        with mock.patch.object(datetime, 'datetime',
                               mock.Mock(wraps=datetime.datetime)) as patched:
            patched.now.return_value = target
            collector.collect()

        self.assertPublishedMetricMany(
            publish_metric,
            {
                'us-west-1a.elb1.HealthyHostCount': 1,
                'us-west-1a.elb1.UnhealthyHostCount': 2,
                'us-west-1a.elb1.RequestCount': 3,
                'us-west-1a.elb1.Latency': 4,
                'us-west-1a.elb1.HTTPCode_ELB_4XX': 6,
                'us-west-1a.elb1.HTTPCode_ELB_5XX': 7,
                'us-west-1a.elb1.HTTPCode_Backend_2XX': 8,
                'us-west-1a.elb1.HTTPCode_Backend_3XX': 9,
                'us-west-1a.elb1.HTTPCode_Backend_4XX': 10,
                'us-west-1a.elb1.HTTPCode_Backend_5XX': 11,
                'us-west-1a.elb1.BackendConnectionErrors': 12,
                'us-west-1a.elb1.SurgeQueueLength': 13,
                'us-west-1a.elb1.SpilloverCount': 14,
            })
    def setUp(self):
        config = get_collector_config('ElasticSearchCollector', {})

        self.collector = ElasticSearchCollector(config, None)
Example #51
0
    def setUp(self):
        config = get_collector_config('UptimeCollector', {
            'interval': 10,
        })

        self.collector = UptimeCollector(config, None)
Example #52
0
 def setUp(self):
     self.config = get_collector_config('JolokiaCollector', {})
     self.host_reader = NerveHostReader()
Example #53
0
    def setUp(self):
        config = get_collector_config('DRBDCollector', {})

        self.collector = DRBDCollector(config, None)
Example #54
0
 def setUp(self):
     self.config = get_collector_config('JolokiaCollector', {})
     self.host_reader = KubernetesHostReader()
Example #55
0
    def setUp(self):
        config = get_collector_config('NetworkCollector', {
            'interval': 10,
        })

        self.collector = NetworkCollector(config, None)
Example #56
0
    def setUp(self):
        config = get_collector_config('EntropyStatCollector', {})

        self.collector = EntropyStatCollector(config, None)
Example #57
0
    def setUp(self):
        config = get_collector_config('NfsdCollector', {
            'interval': 1
        })

        self.collector = NfsdCollector(config, None)
Example #58
0
    def setUp(self):
        config = get_collector_config('ProcessResourcesCollector',
                                      self.TEST_CONFIG)

        self.collector = ProcessResourcesCollector(config, None)
Example #59
0
    def setUp(self):
        config = get_collector_config('SidekiqWebCollector', {'interval': 10})

        self.collector = SidekiqWebCollector(config, None)
Example #60
0
 def setUp(self):
     config = get_collector_config('JCollectdCollector', {})
     self.collector = JCollectdCollector(config, None)