class TestNetstatCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config('NetstatCollector', {})

        self.collector = NetstatCollector(config, None)

    @patch.object(Collector, 'publish')
    def test(self, publish_mock):
        NetstatCollector.PROC_TCP = self.getFixturePath('proc_net_tcp')
        self.collector.collect()

        metrics = {'LISTEN': 9}

        self.setDocExample(collector=self.collector.__class__.__name__,
                           metrics=metrics,
                           defaultpath=self.collector.config['path'])
        print(publish_mock)
        self.assertPublishedMany(publish_mock, metrics)
예제 #2
0
class TestNetstatCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config('NetstatCollector', {
        })

        self.collector = NetstatCollector(config, None)

    @patch.object(Collector, 'publish')
    def test(self, publish_mock):
        NetstatCollector.PROC_TCP = self.getFixturePath('proc_net_tcp')
        self.collector.collect()

        metrics = {
            'LISTEN':  9
        }

        self.setDocExample(collector=self.collector.__class__.__name__,
                           metrics=metrics,
                           defaultpath=self.collector.config['path'])
        print publish_mock
        self.assertPublishedMany(publish_mock, metrics)
    def setUp(self):
        config = get_collector_config('NetstatCollector', {})

        self.collector = NetstatCollector(config, None)
예제 #4
0
    def setUp(self):
        config = get_collector_config('NetstatCollector', {
        })

        self.collector = NetstatCollector(config, None)