How to use the prom2teams.teams.alarm_mapper.map_prom_alerts_to_teams_alarms function in prom2teams

To help you get started, we’ve selected a few prom2teams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github idealista / prom2teams / tests / test_json_fields.py View on Github external
def test_json_without_instance_field(self):
        with open(self.TEST_CONFIG_FILES_PATH + 'without_instance_field.json') as json_data:
            json_received = json.load(json_data)
            alerts = MessageSchema().load(json_received)
            alarm = map_prom_alerts_to_teams_alarms(alerts)[0]
            self.assertEqual('unknown', str(alarm['instance']))
github idealista / prom2teams / tests / test_json_fields.py View on Github external
def test_json_without_mandatory_field(self):
        with open(self.TEST_CONFIG_FILES_PATH + 'without_mandatory_field.json') as json_data:
            json_received = json.load(json_data)
            alerts = MessageSchema().load(json_received)
            alarm = map_prom_alerts_to_teams_alarms(alerts)[0]
            self.assertIn('unknown', str(alarm))
github idealista / prom2teams / tests / test_json_fields.py View on Github external
def test_json_without_optional_field(self):
        with open(self.TEST_CONFIG_FILES_PATH + 'without_optional_field.json') as json_data:
            json_received = json.load(json_data)
            alerts = MessageSchema().load(json_received)
            alarm = map_prom_alerts_to_teams_alarms(alerts)[0]
            self.assertIn("'description': 'unknown'", str(alarm))
github idealista / prom2teams / tests / test_json_fields.py View on Github external
def test_json_with_all_fields(self):
        with open(self.TEST_CONFIG_FILES_PATH + 'all_ok.json') as json_data:
            json_received = json.load(json_data)
            alerts = MessageSchema().load(json_received)
            alarm = map_prom_alerts_to_teams_alarms(alerts)[0]
            self.assertNotIn('unknown', str(alarm))
github idealista / prom2teams / prom2teams / app / sender.py View on Github external
def _create_alarms(self, alerts):
        alarms = map_prom_alerts_to_teams_alarms(alerts)
        return self.json_composer.compose_all(alarms)