คุณกำลังดูเอกสารประกอบของ Apigee Edge
ไปที่
เอกสารประกอบของ Apigee X info
ส่วนต่อไปนี้อธิบายวิธีจัดการการแจ้งเตือนโดยใช้ API
ดูข้อมูลเพิ่มเติมเกี่ยวกับ API การแจ้งเตือนได้ที่ API การแจ้งเตือน
ตั้งค่าการแจ้งเตือนโดยใช้ API
ตั้งค่าการแจ้งเตือนโดยส่งคำขอ POST ไปยังทรัพยากรต่อไปนี้: https://apimonitoring.enterprise.apigee.com/alerts
ส่วนต่อไปนี้มีตัวอย่างการตั้งค่าการแจ้งเตือนโดยใช้ API
- ตั้งค่าการแจ้งเตือนรหัสสถานะ 5xx สำหรับพร็อกซี API โดยใช้ API
- ตั้งค่าการแจ้งเตือนเวลาในการตอบสนองเปอร์เซ็นไทล์ที่ 95 สำหรับพร็อกซี API โดยใช้ API
- ตั้งค่าการแจ้งเตือนรหัสสถานะ 404 (ไม่พบแอปพลิเคชัน) สำหรับพร็อกซี API ทั้งหมดโดยใช้ API
- ตั้งค่าการแจ้งเตือนจำนวนพร็อกซี API สำหรับ API โดยใช้ API
- ตั้งค่าการแจ้งเตือนอัตราข้อผิดพลาดสำหรับบริการเป้าหมายโดยใช้ API
- ตั้งค่าการแจ้งเตือนอัตราข้อผิดพลาดสำหรับนโยบาย Service Callout โดยใช้ 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 ของโรงแรมในสภาพแวดล้อม prod สำหรับทุกภูมิภาค
ระบบจะส่งการแจ้งเตือนไปยัง 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 ทั้งหมดในสภาพแวดล้อม prod สำหรับทุกภูมิภาค
ระบบจะส่งการแจ้งเตือนไปยังแชแนล 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
ตั้งค่าการแจ้งเตือนอัตราข้อผิดพลาดสำหรับนโยบาย Service Callout โดยใช้ 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 ในสภาพแวดล้อม prod สำหรับทุกภูมิภาค - จำนวนรหัสข้อผิดพลาดโปรโตคอล 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
นอกจากนี้ คุณยังระบุระยะเวลาที่ใช้ในการค้นหาการแจ้งเตือนที่ทริกเกอร์ได้ด้วย ค่าเริ่มต้นคือแสดงการแจ้งเตือนทั้งหมดที่ทริกเกอร์ในชั่วโมงที่ผ่านมา
ตัวอย่าง
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 ของคำจำกัดความของการแจ้งเตือน นอกจากนี้ คุณยังระบุระยะเวลาที่ใช้ในการค้นหาการแจ้งเตือนได้ด้วย ค่าเริ่มต้นคือแสดงการแจ้งเตือนทั้งหมดที่ทริกเกอร์ในชั่วโมงที่ผ่านมา
คุณสามารถรับ 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