Mengkueri aturan peringatan Prometheus.
Coba sekarang
Test
RAM authorization
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| AlertId |
integer |
Yes |
ID aturan peringatan. Anda dapat memperoleh ID dari tanggapan operasi ListPrometheusAlertRules. |
3888704 |
| ClusterId |
string |
No |
ID instans Prometheus. |
cc7a37ee31aea4ed1a059eff8034b**** |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
ID permintaan. |
9FEA6D00-317F-45E3-9004-7FB8B0B7**** |
| PrometheusAlertRule |
object |
Struct yang dikembalikan. |
|
| Status |
integer |
Apakah aturan peringatan diaktifkan. Nilai valid:
|
1 |
| Type |
string |
Tipe aturan peringatan. |
Kubernetes组件告警 |
| NotifyType |
string |
Metode notifikasi. Nilai valid:
|
ALERT_MANAGER |
| Expression |
string |
Ekspresi peringatan. |
100 * (sum(rate(container_cpu_usage_seconds_total[1m])) by (pod_name) / sum(label_replace(kube_pod_container_resource_limits_cpu_cores, \"pod_name\", \"$1\", \"pod\", \"(.*)\")) by (pod_name))>75 |
| Message |
string |
Pesan notifikasi peringatan. Anda dapat menggunakan format {{$labels.xxx}} untuk mereferensikan label. |
${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}% |
| Duration |
string |
Durasi peringatan. Nilai valid: 1m hingga 1440m. Unit: menit. |
1m |
| DispatchRuleId |
integer |
ID kebijakan notifikasi. Parameter ini dikembalikan ketika NotifyType diatur ke |
10282 |
| AlertName |
string |
Nama aturan peringatan. |
Prometheus_Alert |
| AlertId |
integer |
ID aturan peringatan. |
3888704 |
| ClusterId |
string |
ID kluster. |
c0bad479465464e1d8c1e641b0afb**** |
| Labels |
array<object> |
Label aturan peringatan. |
|
|
object |
|||
| Name |
string |
The name of the tag. |
severity |
| Value |
string |
The value of the tag. |
critical |
| Annotations |
array<object> |
Anotasi aturan peringatan. |
|
|
object |
|||
| Name |
string |
The name of the annotation. |
message |
| Value |
string |
The value of the annotation. |
${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}% |
| Code |
integer |
Kode status. Nilai 200 menunjukkan bahwa permintaan berhasil. |
200 |
| Success |
boolean |
Apakah permintaan berhasil:
|
True |
| Message |
string |
Paket yang dikembalikan. |
success |
Contoh
Respons sukses
JSONformat
{
"RequestId": "9FEA6D00-317F-45E3-9004-7FB8B0B7****",
"PrometheusAlertRule": {
"Status": 1,
"Type": "Kubernetes组件告警",
"NotifyType": "ALERT_MANAGER",
"Expression": "100 * (sum(rate(container_cpu_usage_seconds_total[1m])) by (pod_name) / sum(label_replace(kube_pod_container_resource_limits_cpu_cores, \\\"pod_name\\\", \\\"$1\\\", \\\"pod\\\", \\\"(.*)\\\")) by (pod_name))>75",
"Message": "${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}%",
"Duration": "1m",
"DispatchRuleId": 10282,
"AlertName": "Prometheus_Alert",
"AlertId": 3888704,
"ClusterId": "c0bad479465464e1d8c1e641b0afb****",
"Labels": [
{
"Name": "severity",
"Value": "critical"
}
],
"Annotations": [
{
"Name": "message",
"Value": "${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}%"
}
]
},
"Code": 200,
"Success": true,
"Message": "success"
}
Kode kesalahan
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.