Beispiel #1
0
class TestAmavisCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config('AmavisCollector', {
            'amavisd_exe': MOCK_PATH,
        })

        self.collector = AmavisCollector(config, None)

    @patch.object(Collector, 'publish')
    def test(self, publish_mock):
        self.collector.collect()

        # a couple of the metrics contained in mock-amavisd-agent
        metrics = {
            'sysUpTime.time': 198103058,
            'OutMsgsSizeProtoSMTP.size': 116,
            'OutMsgsSizeProtoSMTP.frequency': 0,
            'OutMsgsSizeProtoSMTP.percentage': 96.4,
            'OutMsgsProtoSMTPRelay.count': 22778,
            'OutMsgsProtoSMTPRelay.frequency': 41,
            'OutMsgsProtoSMTPRelay.percentage': 71.5,
            'TimeElapsedDecoding.time': 652,
            'TimeElapsedDecoding.frequency': 0.024,
            'virus.byname.Eicar-Test-Signature.count': 4436,
            'virus.byname.Eicar-Test-Signature.frequency': 8,
            'virus.byname.Eicar-Test-Signature.percentage': 100.0,
        }

        self.setDocExample(collector=self.collector.__class__.__name__,
                           metrics=metrics,
                           defaultpath=self.collector.config['path'])
        self.assertPublishedMany(publish_mock, metrics)
Beispiel #2
0
class TestAmavisCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config('AmavisCollector', {
            'amavisd_exe': MOCK_PATH,
        })

        self.collector = AmavisCollector(config, None)

    @patch.object(Collector, 'publish')
    def test(self, publish_mock):
        self.collector.collect()

        # a couple of the metrics contained in mock-amavisd-agent
        metrics = {
            'sysUpTime.time': 198103058,
            'OutMsgsSizeProtoSMTP.size': 116,
            'OutMsgsSizeProtoSMTP.frequency': 0,
            'OutMsgsSizeProtoSMTP.percentage': 96.4,
            'OutMsgsProtoSMTPRelay.count': 22778,
            'OutMsgsProtoSMTPRelay.frequency': 41,
            'OutMsgsProtoSMTPRelay.percentage': 71.5,
            'TimeElapsedDecoding.time': 652,
            'TimeElapsedDecoding.frequency': 0.024,
            'virus.byname.Eicar-Test-Signature.count': 4436,
            'virus.byname.Eicar-Test-Signature.frequency': 8,
            'virus.byname.Eicar-Test-Signature.percentage': 100.0,
        }

        self.setDocExample(collector=self.collector.__class__.__name__,
                           metrics=metrics,
                           defaultpath=self.collector.config['path'])
        self.assertPublishedMany(publish_mock, metrics)
Beispiel #3
0
    def setUp(self):
        config = get_collector_config('AmavisCollector', {
            'amavisd_exe': MOCK_PATH,
        })

        self.collector = AmavisCollector(config, None)
Beispiel #4
0
    def setUp(self):
        config = get_collector_config('AmavisCollector', {
            'amavisd_exe': MOCK_PATH,
        })

        self.collector = AmavisCollector(config, None)