คุณกําลังดูเอกสารประกอบของ Apigee Edge
ไปที่เอกสารประกอบเกี่ยวกับ Apigee Xข้อมูล
ส่วนต่อไปนี้อธิบายวิธีจัดการการแจ้งเตือนโดยใช้ API
โปรดดูข้อมูลเพิ่มเติมเกี่ยวกับ Alerts API ที่ Alerts API
ตั้งค่าการแจ้งเตือนโดยใช้ API
ตั้งค่าการแจ้งเตือนโดยการออกคำขอ POST ไปยังทรัพยากรต่อไปนี้ https://apimonitoring.enterprise.apigee.com/alerts
ส่วนต่อไปนี้แสดงตัวอย่างการตั้งค่าการแจ้งเตือนโดยใช้ API
- ตั้งค่าการแจ้งเตือนรหัสสถานะ 5xx สําหรับพร็อกซี API โดยใช้ API
- ตั้งค่าการแจ้งเตือนเวลาในการตอบสนอง p95 สําหรับพร็อกซี API โดยใช้ API
- ตั้งค่าการแจ้งเตือนรหัสสถานะ 404 (ไม่พบแอปพลิเคชัน) สำหรับพร็อกซี API ทั้งหมดที่ใช้ API
- ตั้งค่าการแจ้งเตือนจํานวนพร็อกซี API สําหรับ API โดยใช้ API
- ตั้งค่าการแจ้งเตือนอัตราข้อผิดพลาดสําหรับบริการเป้าหมายโดยใช้ API
- ตั้งค่าการแจ้งเตือนอัตราข้อผิดพลาดสำหรับนโยบายข้อความไฮไลต์บริการโดยใช้ API
- ตั้งค่าการแจ้งเตือนรหัสข้อบกพร่องสําหรับ API โดยใช้ API
ตั้งค่าการแจ้งเตือนรหัสสถานะ 5xx สําหรับพร็อกซี API โดยใช้ API
ตัวอย่างต่อไปนี้แสดงวิธีตั้งค่าการแจ้งเตือนที่จะทริกเกอร์เมื่อรหัสสถานะ 5xx เกิดขึ้นในอัตราที่มากกว่าธุรกรรม 100 รายการต่อวินาที (TPS) เป็นเวลา 10 นาทีสําหรับพร็อกซี API ของโรงแรมในสภาพแวดล้อม prod สําหรับภูมิภาคใดก็ได้ ระบบจะส่งการแจ้งเตือนไปยังอีเมลที่ระบุเมื่อมีการเรียกใช้การแจ้งเตือน
curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
-X POST \
-H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"organization":"myorg",
"name":"5xx Alert",
"description":"My 5xx alert",
"environment":"prod",
"enabled":true,
"conditions":[
{
"description":"",
"dimensions":{
"org":"myorg",
"env":"prod",
"proxy":"hotels",
"region":"ANY",
"statusCode":"5xx"
},
"metric":"tps",
"threshold":100,
"durationSeconds":600,
"comparator":">"
}
],
"notifications":[{
"channel":"email",
"destination":"ops@acme.com"
}],
"playbook":"http://acme.com/myplaybook.html",
"throttleIntervalSeconds":3600,
"reportEnabled":true
}'
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นเพื่อการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นเพื่อการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ตั้งค่าการแจ้งเตือนเวลาในการตอบสนองแบบเปอร์เซ็นต์ 95 สำหรับพร็อกซี API โดยใช้ API
ตัวอย่างต่อไปนี้แสดงวิธีตั้งค่าการแจ้งเตือนที่จะทริกเกอร์หากเวลาในการตอบสนองทั้งหมดของเปอร์เซ็นไทล์ที่ 95 มากกว่า 100 มิลลิวินาทีเป็นเวลา 5 นาทีสําหรับพร็อกซี API ของโรงแรมในสภาพแวดล้อมเวอร์ชันที่ใช้งานจริงสําหรับภูมิภาคใดก็ได้
ระบบจะส่งการแจ้งเตือนไปยัง Webhook ที่ระบุในกรณีที่มีการเรียกให้แสดงการแจ้งเตือน
curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
-X POST \
-H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"organization":"myorg",
"name":"My Alert",
"description":"My first alert",
"environment":"prod",
"enabled":true,
"conditions":[
{
"description":"",
"dimensions":{
"org":"myorg",
"env":"prod",
"proxy" : "hotels",
"region":"ANY",
"percentile":"95"
},
"metric":"totalLatency",
"threshold":100,
"durationSeconds":300,
"comparator":">"
}
],
"notifications":[{ "channel":"webhook", "destination":"https://apigee.com/test-webhook"}],
"playbook":"http://acme.com/myplaybook.html",
"throttleIntervalSeconds":3600,
"reportEnabled":true
}'
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นเพื่อการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นเพื่อการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ตั้งค่าการแจ้งเตือนรหัสสถานะ 404 (ไม่พบแอปพลิเคชัน) สําหรับพร็อกซี API ทั้งหมดที่ใช้ API
ตัวอย่างต่อไปนี้แสดงวิธีตั้งการแจ้งเตือนที่ทริกเกอร์เมื่อรหัสสถานะ HTTP 404 เกิดขึ้นในอัตราที่สูงกว่า 10% เป็นเวลา 5 นาทีสำหรับพร็อกซี API ทั้งหมดในสภาพแวดล้อมการใช้งานจริงของภูมิภาคใดก็ได้
ระบบจะส่งการแจ้งเตือนไปยังแชแนล Slack ที่ระบุเมื่อมีการทริกเกอร์การแจ้งเตือน
curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
-X POST \
-H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"organization":"myorg",
"name":"404 Application Not Found Alert",
"description":"My 404 alert",
"environment":"prod",
"enabled":true,
"conditions":[
{
"description":"",
"dimensions":{"org":"myorg",
"env":"prod",
"proxy":"ALL",
"region":"ANY",
"statusCode":"404"},
"metric":"rate",
"threshold":0.05,
"durationSeconds":300,
"comparator":">"
}],
"notifications":[{ "channel":"slack", "destination":"https://hooks.slack.com/services/T00000000/B00000000/XXXXX"}],
"playbook":"http://acme.com/myplaybook.html",
"throttleIntervalSeconds":3600,
"reportEnabled":true
}'
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ตั้งค่าการแจ้งเตือนจำนวนพร็อกซี API สําหรับ API โดยใช้ API
ต่อไปนี้เป็นตัวอย่างวิธีตั้งค่าการแจ้งเตือนที่จะทริกเกอร์เมื่อจํานวนโค้ด 5xx สําหรับ API เกิน 200 รายการเป็นเวลา 5 นาทีสําหรับภูมิภาคใดก็ได้
ในตัวอย่างนี้ ระบบจะบันทึก API ในคอลเล็กชันพร็อกซี API ที่สำคัญ (ซึ่งมี UUID aeff4394-86b7-11e8-83d7-42010a840040) หากต้องการดู UUID ของคอลเล็กชัน โปรดดูดูคอลเล็กชันทั้งหมดโดยใช้ API
curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
-X POST \
-H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"organization":"myorg",
"name":"Proxy Count Alert",
"description":"My proxy count alert",
"environment":"prod",
"enabled":true,
"conditions":[
{
"description":"",
"dimensions":{
"collection":"aeff4394-86b7-11e8-83d7-42010a840040",
"org":"myorg",
"env":"prod",
"proxy" : "ANY",
"region":"ANY",
"statusCode":"5xx"
},
"metric":"count",
"threshold":200,
"durationSeconds":300,
"comparator":">"
}
],
"notifications":[{
"channel":"email",
"destination":"ops@acme.com"
}],
"playbook":"http://acme.com/myplaybook.html",
"throttleIntervalSeconds":3600,
"reportEnabled":true
}'
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นเพื่อการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นเพื่อการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ตั้งค่าการแจ้งเตือนอัตราข้อผิดพลาดสําหรับบริการเป้าหมายโดยใช้ API
ต่อไปนี้เป็นตัวอย่างวิธีตั้งค่าการแจ้งเตือนที่จะทริกเกอร์เมื่ออัตรารหัส 500 สำหรับบริการเป้าหมายเกิน 10% เป็นเวลา 1 ชั่วโมงสำหรับภูมิภาคใดก็ได้
ในตัวอย่างนี้ บริการเป้าหมายจะได้รับการบันทึกไว้ในคอลเล็กชันเป้าหมายที่สำคัญ (ด้วย UUID aeff4394-86b7-11e8-83d7-42010a840040) หากต้องการดู UUID ของคอลเล็กชัน โปรดดูดูคอลเล็กชันทั้งหมดโดยใช้ API
curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
-X POST \
-H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"organization":"myorg",
"name":"Error rate Alert",
"description":"My error rate alert",
"environment":"prod",
"enabled":true,
"conditions":[
{
"description":"",
"dimensions":{
"collection":"aeff4394-86b7-11e8-83d7-42010a840040",
"org":"myorg",
"env":"prod",
"proxy" : "ANY",
"region":"ANY",
"statusCode":"500"
},
"metric":"rate",
"threshold":0.1,
"durationSeconds":3600,
"comparator":">"
}
],
"notifications":[{
"channel":"email",
"destination":"ops@acme.com"
}],
"playbook":"http://acme.com/myplaybook.html",
"throttleIntervalSeconds":3600,
"reportEnabled":true
}'
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นการเข้าถึง OAuth 2.0
โปรดดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ตั้งค่าการแจ้งเตือนอัตราข้อผิดพลาดสำหรับนโยบายข้อความไฮไลต์ของบริการโดยใช้ API
ต่อไปนี้เป็นตัวอย่างวิธีตั้งค่าการแจ้งเตือนที่จะทริกเกอร์เมื่ออัตรารหัส 500 สำหรับบริการที่ระบุโดยนโยบาย ServiceCallout เกิน 10% เป็นเวลา 1 ชั่วโมงสำหรับภูมิภาคใดก็ได้
curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
-X POST \
-H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"organization":"myorg",
"name":"Error rate Alert",
"description":"My error rate alert",
"environment":"prod",
"enabled":true,
"conditions":[
{
"description":"",
"dimensions":{
"target": "sc://docstore-api",
"org":"myorg",
"env":"prod",
"proxy" : "ANY",
"region":"ANY",
"statusCode":"500"
},
"metric":"rate",
"threshold":0.1,
"durationSeconds":3600,
"comparator":">"
}
],
"notifications":[{
"channel":"email",
"destination":"ops@acme.com"
}],
"playbook":"http://acme.com/myplaybook.html",
"throttleIntervalSeconds":3600,
"reportEnabled":true
}'
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ตั้งค่าการแจ้งเตือนรหัสข้อผิดพลาดของนโยบายโดยใช้ API
ตัวอย่างต่อไปนี้แสดงวิธีตั้งค่าการแจ้งเตือนที่จะทริกเกอร์เมื่อเป็นไปตามเงื่อนไขข้อใดข้อหนึ่งต่อไปนี้
- จำนวนรหัสข้อผิดพลาดของ
SpikeArrestViolationมากกว่า 10 เป็นเวลา 5 นาทีสำหรับ API ในสภาพแวดล้อมเวอร์ชันที่ใช้งานจริงสำหรับทุกภูมิภาค - จํานวนรหัสข้อบกพร่องของโปรโตคอล API ทั้งหมดมากกว่า 3% เป็นเวลา 5 นาทีสําหรับ API ในสภาพแวดล้อม prod สําหรับทุกภูมิภาค
ในตัวอย่างนี้ ระบบจะบันทึก API ในคอลเล็กชันพร็อกซี API ที่สำคัญ (ซึ่งมี UUID aeff4394-86b7-11e8-83d7-42010a840040) หากต้องการรับ UUID สำหรับคอลเล็กชัน โปรดดูที่ดูคอลเล็กชันทั้งหมดที่ใช้ API
ระบบจะส่งการแจ้งเตือนไปยังรหัส PagerDuty ที่ระบุเมื่อมีการทริกเกอร์การแจ้งเตือน
curl 'https://apimonitoring.enterprise.apigee.com/alerts' \
-X POST \
-H 'Accept: application/json, text/plain, */*' -H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"organization":"myorg",
"name":"My Fault Code Alert",
"description":"My fault code alert",
"environment":"prod",
"enabled":true,
"conditions":[
{
"description":"",
"dimensions": {
"collection":"aeff4394-86b7-11e8-83d7-42010a840040",
"org":"myorg",
"env":"prod",
"proxy":"ANY",
"region":"ANY",
"faultCodeCategory":"Traffic Mgmt Policy",
"faultCodeSubCategory":"Spike Arrest",
"faultCodeName":"SpikeArrest Violation"
},
"metric":"count,
"threshold":10,
"durationSeconds":300,
"comparator":">"
},
{
"description":"",
"dimensions": {
"collection":"aeff4394-86b7-11e8-83d7-42010a840040",
"org":"myorg",
"env":"prod",
"proxy":"ANY",
"region":"ANY",
"faultCodeCategory":"API Protocol",
"faultCodeSubCategory":"ALL"
},
"metric":"rate",
"threshold":0.03,
"durationSeconds":300,
"comparator":">"
}
],
"notifications":[{ "channel":"pagerduty", "destination":"abcd1234efgh56789"}],
"playbook":"http://acme.com/myplaybook.html",
"throttleIntervalSeconds":3600,
"reportEnabled":true
}'
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ดูการแจ้งเตือน
ส่วนต่อไปนี้แสดงตัวอย่างการดูคำจำกัดความของการแจ้งเตือนและข้อมูลเกี่ยวกับการแจ้งเตือนที่ทริกเกอร์โดยใช้ API
- ดูคำจำกัดความการแจ้งเตือนทั้งหมดสำหรับองค์กร
- ดูคำจำกัดความของการแจ้งเตือนที่เฉพาะเจาะจง
- ดูประวัติการแจ้งเตือนที่ทริกเกอร์สําหรับองค์กร
- ดูประวัติการแจ้งเตือนที่ต้องการ
ดูคําจํากัดความการแจ้งเตือนทั้งหมดสําหรับองค์กร
ดูคำจำกัดความของการแจ้งเตือนและการแจ้งเตือนทั้งหมดโดยส่งคำขอ GET ไปยัง API ต่อไปนี้ https://apimonitoring.enterprise.apigee.com/alerts
คุณต้องส่งชื่อองค์กรโดยใช้พารามิเตอร์การค้นหา org
เช่น
curl 'https://apimonitoring.enterprise.apigee.com/alerts?org=myorg'
-X GET
-H 'Accept: application/json, text/plain, */*'
-H "Authorization: Bearer $ACCESS_TOKEN"
UUID ของการแจ้งเตือนจะแสดงในช่อง uuid ของคำตอบ คุณต้องใช้ UUID นี้เพื่อทำการเรียกเพื่อระบุข้อมูลเฉพาะสำหรับคำจำกัดความของการแจ้งเตือน ต่อไปนี้เป็นตัวอย่างการตอบกลับ
[ { "uuid": "4fa49a87-3463023ea7c4", "name": "PublicAPI latency alert", "enabled": true, "description": "Public API Latency alerts, 90th %ile > 6secs for 5 minute window trigger this alert", "conditions": [ { "uuid": "4fa49a87-3463023ea7c4", "description": "", "dimensions": { "env": "prod", "org": "myorg", "percentile": "90", "proxy": "PublicAPI", "region": "ANY" }, "metric": "totalLatency", "threshold": 6000, "durationSeconds": 300, "comparator": ">", "updatedBy": "me@foo.com" } ], "playbook": "PublicAPI Latency alert, setup to go off when 90th %ile is > 4 secs for 5 minute window", "throttleIntervalSeconds": 3600, "self": "/alerts/4fa49a87-3463023ea7c4", "feed": "/o/myorg/events/4fa49a87-3463023ea7c4", "organization": "myorg", "environment": "prod", "notifications": [ { "channel": "email", "destination": "me@foo.com" } ], "updatedAt": "2018-07-19T18:19:31.654738Z", "updatedBy": "me@foo.com" }, { "uuid": "ef1a5249-345ed3023ea7c4", "name": "Minty API Latency alert", "enabled": true, "description": "Minty API Latency alerts, 90th %ile > 6secs for 5 minute window trigger this alert", "conditions": [ { "uuid": "ef1a5249-345ed3023ea7c4", "description": "", "dimensions": { "env": "prod", "org": "myorg", "percentile": "90", "proxy": "minty", "region": "ANY" }, "metric": "totalLatency", "threshold": 6000, "durationSeconds": 300, "comparator": ">", "updatedBy": "me@foo.com" } ], "playbook": "Minty API", "throttleIntervalSeconds": 3600, "self": "/alerts/ef1a5249-345ed3023ea7c4", "feed": "/o/myorg/events/ef1a5249-345ed3023ea7c4", "organization": "myorg", "environment": "prod", "notifications": [ { "channel": "email", "destination": "me@foo.com" } ], "updatedAt": "2018-07-19T18:19:33.22479Z", "updatedBy": "me@foo.com" }, ... ]
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นเพื่อการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นเพื่อการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ดูคำจำกัดความของการแจ้งเตือนที่เฉพาะเจาะจง
ดูคําจํากัดความการแจ้งเตือนที่เฉพาะเจาะจงโดยการส่งคําขอ GET ไปยังแหล่งข้อมูลต่อไปนี้ https://apimonitoring.enterprise.apigee.com/alerts/alert_uuid โดยที่ alert_uuid จะระบุ UUID ของคําจํากัดความการแจ้งเตือน รับ UUID เมื่อคุณสร้างการแจ้งเตือนหรือใช้การเรียก API ที่แสดงในส่วนก่อนหน้าเพื่อแสดงรายการการแจ้งเตือนทั้งหมดและ UUID ที่เชื่อมโยง
เช่น
curl 'https://apimonitoring.enterprise.apigee.com/alerts/4fa49a87-3463023ea7c4'
-X GET
-H 'Accept: application/json, text/plain, */*'
-H "Authorization: Bearer $ACCESS_TOKEN"
ต่อไปนี้เป็นตัวอย่างการตอบกลับ
{ "uuid": "4fa49a87-3463023ea7c4", "name": "PublicAPI latency alert", "enabled": true, "description": "Public API Latency alerts, 90th %ile > 6secs for 5 minute window trigger this alert", "conditions": [ { "uuid": "4fa49a87-3463023ea7c4", "description": "", "dimensions": { "env": "prod", "org": "myorg", "percentile": "90", "proxy": "PublicAPI", "region": "ANY" }, "metric": "totalLatency", "threshold": 6000, "durationSeconds": 300, "comparator": ">", "updatedBy": "me@foo.com" } ], "playbook": "PublicAPI Latency alert, setup to go off when 90th %ile is > 4 secs for 5 minute window", "throttleIntervalSeconds": 3600, "self": "/alerts/4fa49a87-3463023ea7c4", "feed": "/o/myorg/events/4fa49a87-3463023ea7c4", "organization": "myorg", "environment": "prod", "notifications": [ { "channel": "email", "destination": "me@foo.com" } ], "updatedAt": "2018-07-19T18:19:31.654738Z", "updatedBy": "me@foo.com" }
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ดูประวัติการแจ้งเตือนที่ทริกเกอร์ทั้งหมดสําหรับองค์กร
ดูประวัติการแจ้งเตือนทั้งหมดที่ทริกเกอร์สําหรับองค์กรโดยส่งคําขอ GET ไปยังแหล่งข้อมูลต่อไปนี้ https://apimonitoring.enterprise.apigee.com/metrics/alerthistory
คุณต้องส่งชื่อองค์กรโดยใช้พารามิเตอร์การค้นหา org
คุณระบุระยะเวลาที่ใช้ค้นหาการแจ้งเตือนที่ทริกเกอร์ได้ ค่าเริ่มต้นคือการแสดงการแจ้งเตือนทั้งหมดที่ทริกเกอร์ในช่วง 1 ชั่วโมงที่ผ่านมา
เช่น
curl 'https://apimonitoring.enterprise.apigee.com/metrics/alerthistory?org=myorg'
-X GET
-H 'Accept: application/json, text/plain, */*'
-H "Authorization: Bearer $ACCESS_TOKEN"
การตอบกลับจะมีอาร์เรย์ของการแจ้งเตือนทั้งหมดที่ทริกเกอร์ระหว่างระยะเวลาที่ขอ
ในเนื้อหาการตอบสนอง ช่อง id จะระบุ UUID ของการแจ้งเตือนที่เรียกใช้ และช่อง shared_id จะระบุ UUID ของคำจำกัดความการแจ้งเตือนที่เชื่อมโยงกับการแจ้งเตือนที่ทริกเกอร์
ตัวอย่างคำตอบมีดังนี้
[ { "id": "80cbe560-f6e0-475c6f7ed2d", "shared_id": "4fa49a87-3463023ea7c4", "organization": "myorg", "environment": "prod", "name": "PublicAPI latency alert", "type": "Alert", "source": "null/current", "raw_payload": "{\"reportUUID\":\"\",\"reportEnabled\":false,\"organization\":\"myorg\",\"name\":\"emgmt-api 404\",\"self\":\"/alerts/4fa49a87-3463023ea7c4\",\"description\":\"go/apigee-extensions-playbook\",\"conditions\":[ {\"comparator\":\">\",\"metric\":\"rate\",\"durationSeconds\":300,\"name\":\"PublicAPI latency alert\",\"description\":\"\",\"threshold\":0.05,\"dimensions\":{\"proxy\":\"emgmt-api\",\"org\":\"myorg\",\"env\":\"prod\",\"region\":\"any\",\"statusCode\":\"404\"}}],\"uuid\":\"4fa49a87-3463023ea7c4\",\"playbook\":\"go/apigee-extensions-playbook\"}", "time": "2019-03-25T15:30:18Z" }, { "id": "8131d740-6680-45b9c72c3", "shared_id": "1a64885b-f9-42010a850039", "organization": "apigee-pinpoint", "environment": "prod", "name": "Demo 5xx alert", "type": "Alert", "source": "null/current", "raw_payload": "{\"reportUUID\":\"\",\"reportEnabled\":false,\"organization\":\"myorg\",\"name\":\"Demo 5xx alert\",\"self\":\"/alerts/1a64885b-f9-42010a850039\",\"description\":\"Demo 5xx alert\",\"conditions\":[ {\"comparator\":\">\",\"metric\":\"rate\",\"durationSeconds\":300,\"name\":\"Demo 5xx alert\",\"description\":\"\",\"threshold\":0.4,\"dimensions\":{\"proxy\":\"ALL\",\"org\":\"myorg\",\"env\":\"prod\",\"region\":\"any\",\"statusCode\":\"5xx\"}}],\"uuid\":\"1a64885b-f9-42010a850039\",\"playbook\":\"Recommended Playbook\"}", "time": "2019-03-25T15:57:30Z" }, ... ]
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL
ดูประวัติการแจ้งเตือนที่เฉพาะเจาะจง
ดูประวัติการแจ้งเตือนที่เรียกใช้สำหรับคำจำกัดความของการแจ้งเตือนที่เจาะจงโดยส่งคำขอ GET ไปยังทรัพยากรต่อไปนี้ https://apimonitoring.enterprise.apigee.com/metrics/alerthistory
คุณต้องส่งชื่อขององค์กรโดยใช้พารามิเตอร์การค้นหาของ org และ UUID ของคำจำกัดความการแจ้งเตือน คุณระบุระยะเวลาที่จะใช้ค้นหาการแจ้งเตือนได้ ค่าเริ่มต้นคือการแสดงการแจ้งเตือนทั้งหมดที่ทริกเกอร์ในช่วง 1 ชั่วโมงที่ผ่านมา
คุณดู UUID ของคําจํากัดความการแจ้งเตือนได้จากประวัติการแจ้งเตือนตามที่แสดงในส่วนก่อนหน้า เมื่อคุณสร้างคําจํากัดความการแจ้งเตือน หรือใช้การเรียก API ที่แสดงในดูคําจํากัดความการแจ้งเตือนทั้งหมด
เช่น
curl 'https://apimonitoring.enterprise.apigee.com/metrics/alerthistory?org=myorg&alertId=4fa49a87-3463023ea7c4'
-X GET
-H 'Accept: application/json, text/plain, */*'
-H "Authorization: Bearer $ACCESS_TOKEN"
การตอบกลับจะมีอาร์เรย์ของการแจ้งเตือนทั้งหมดที่ทริกเกอร์ในระยะเวลาที่ขอสำหรับ UUID ของคำจำกัดความการแจ้งเตือนที่ระบุ ในเนื้อหาการตอบกลับ ฟิลด์ id จะระบุ UUID ของการแจ้งเตือนที่ทริกเกอร์ และฟิลด์ shared_id จะระบุ UUID ของคําจํากัดความการแจ้งเตือนที่เชื่อมโยงกับการแจ้งเตือนที่ทริกเกอร์
ต่อไปนี้เป็นตัวอย่างการตอบกลับ
[ { "id": "80cbe560-f6e0-475c6f7ed2d", "shared_id": "4fa49a87-3463023ea7c4", "organization": "myorg", "environment": "prod", "name": "PublicAPI latency alert", "type": "Alert", "source": "null/current", "raw_payload": "{\"reportUUID\":\"\",\"reportEnabled\":false,\"organization\":\"myorg\",\"name\":\"emgmt-api 404\",\"self\":\"/alerts/4fa49a87-3463023ea7c4\",\"description\":\"go/apigee-extensions-playbook\",\"conditions\":[ {\"comparator\":\">\",\"metric\":\"rate\",\"durationSeconds\":300,\"name\":\"PublicAPI latency alert\",\"description\":\"\",\"threshold\":0.05,\"dimensions\":{\"proxy\":\"emgmt-api\",\"org\":\"myorg\",\"env\":\"prod\",\"region\":\"any\",\"statusCode\":\"404\"}}],\"uuid\":\"4fa49a87-3463023ea7c4\",\"playbook\":\"go/apigee-extensions-playbook\"}", "time": "2019-03-25T15:30:18Z" }, { "id": "9fc442d5-d607-40ef118c4e7", "shared_id": "4fa49a87-3463023ea7c4", "organization": "myorg", "environment": "prod", "name": "PublicAPI latency alert", "type": "Alert", "source": "null/current", "raw_payload": "{\"reportUUID\":\"\",\"reportEnabled\":false,\"organization\":\"myorg\",\"name\":\"emgmt-api 404\",\"self\":\"/alerts/4fa49a87-3463023ea7c4\",\"description\":\"go/apigee-extensions-playbook\",\"conditions\":[{\"comparator\":\">\",\"metric\":\"rate\",\"durationSeconds\":300,\"name\":\"PublicAPI latency alert\",\"description\":\"\",\"threshold\":0.05,\"dimensions\":{\"proxy\":\"emgmt-api\",\"org\":\"myorg\",\"env\":\"prod\",\"region\":\"any\",\"statusCode\":\"404\"}}],\"uuid\":\"4fa49a87-3463023ea7c4\",\"playbook\":\"go/apigee-extensions-playbook\"}", "time": "2019-03-25T15:17:55Z" }, ... ]
ตั้งค่า $ACCESS_TOKEN เป็นโทเค็นการเข้าถึง OAuth 2.0 ตามที่อธิบายไว้ในรับโทเค็นการเข้าถึง OAuth 2.0
ดูข้อมูลเกี่ยวกับตัวเลือก cURL ที่ใช้ในตัวอย่างนี้ได้ที่ใช้ cURL