oncall-engine/engine/apps/integrations/metadata/heartbeat/zabbix.py
Ildar Iskhakov fd19dd422a
Use periodic task for heartbeats (#2723)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
2023-08-10 02:25:00 +00:00

39 lines
1.5 KiB
Python

from pathlib import PurePath
from apps.integrations.metadata.heartbeat._heartbeat_text_creator import HeartBeatTextCreator
integration_verbal = PurePath(__file__).stem
creator = HeartBeatTextCreator(integration_verbal)
heartbeat_text = creator.get_heartbeat_texts()
heartbeat_expired_title = heartbeat_text.heartbeat_expired_title
heartbeat_expired_message = heartbeat_text.heartbeat_expired_message
heartbeat_expired_payload = {
"alert_uid": "191eac7a-d7c1-43a0-8821-eef5afe41367",
"title": heartbeat_expired_title,
"image_url": None,
"state": "alerting",
"link_to_upstream_details": None,
"message": heartbeat_expired_message,
"is_oncall_heartbeat": True,
"is_oncall_heartbeat_restored": False,
"is_amixr_heartbeat": True, # Keep for backwards compatibility
"is_amixr_heartbeat_restored": False, # Keep for backwards compatibility
}
heartbeat_restored_title = heartbeat_text.heartbeat_restored_title
heartbeat_restored_message = heartbeat_text.heartbeat_restored_message
heartbeat_restored_payload = {
"alert_uid": "191eac7a-d7c1-43a0-8821-eef5afe41367",
"title": heartbeat_restored_title,
"image_url": None,
"state": "ok",
"link_to_upstream_details": None,
"message": heartbeat_restored_message,
"is_oncall_heartbeat": True,
"is_oncall_heartbeat_restored": True,
"is_amixr_heartbeat": True, # Keep for backwards compatibility
"is_amixr_heartbeat_restored": True, # Keep for backwards compatibility
}