События v1 для подтверждения инцидента по ключу, что дает мне статус 200, но по интерфейсу его в запущенном состоянии
Импорт json запросов на импорт
SERVICE_KEY = "aa23260f08f94124ac6148bb9a8955e3" # ВВОД КЛЮЧЕВЫХ МЕРОПРИЯТИЙ V1 API ИНТЕГРАЦИИ ЗДЕСЬ INCIDENT_KEY = "3a28d0d5f60c4b7eabd89e5d75df9b95" # ВВОД КЛЮЧЕВЫХ КЛЮЧЕЙ
def ack_incident(): # Запускает инцидент PagerDuty без ранее созданного ключа инцидента # Использует API Events V1 - документация: https://v2.developer.pagerduty.com/docs/trigger-events
payload = { # Payload is built with the least amount of fields required to trigger an incident
"service_key": SERVICE_KEY,
"event_type": "acknowledge",
"incident_key": INCIDENT_KEY,
"description": "Example alert on host1.example.com",
#"contexts": "https://amdoc.pagerduty.com"
}
response = requests.post('https://events.pagerduty.com/generic/2010-04-15/create_event.json',
data=json.dumps(payload))
if response.json()["status"] == "success":
print response.text
print('Incident Acknowledged')
else:
print(response.text) # print error message if not successful
if name == 'main': ack_incident ()