Mengkueri daftar aturan peringatan Prometheus.
Coba sekarang
Test
RAM authorization
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| Name |
string |
No |
Nama aturan peringatan. |
Prometheus_Alert |
| RegionId |
string |
Yes |
ID region. |
cn-hangzhou |
| ClusterId |
string |
Yes |
ID cluster. |
c0bad479465464e1d8c1e641b0afb**** |
| Type |
string |
No |
Tipe aturan peringatan. |
自定义 |
| Status |
integer |
No |
Status aturan peringatan. Nilai yang valid:
|
1 |
| MatchExpressions |
string |
No |
String JSON dari kondisi pencocokan label. Untuk informasi lebih lanjut tentang parameter ini, lihat Deskripsi tambahan parameter MatchExpressions di bawah. |
[{"key":"severity","value":"critical","operator":"re"}] |
| Tags |
array<object> |
No |
Tag. |
|
|
object |
No |
Tag. |
||
| Key |
string |
No |
Kunci tag. |
owner |
| Value |
string |
No |
Nilai tag. |
zhangsan |
Deskripsi tambahan parameter MatchExpressions
Contoh string JSON dan deskripsi
[
{
"key":"severity", // Kunci label.
"value":"critical", // Nilai label.
"operator":"re" // eq: sama dengan; re: pencocokan ekspresi reguler.
}
]
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
ID permintaan. |
9FEA6D00-317F-45E3-9004-7FB8B0B7**** |
| PrometheusAlertRules |
array<object> |
Struct yang dikembalikan. |
|
|
array<object> |
Struct yang dikembalikan. |
||
| Status |
integer |
Status aturan peringatan. Nilai yang valid:
|
1 |
| Type |
string |
Tipe aturan peringatan. |
自定义 |
| NotifyType |
string |
Tipe notifikasi. Nilai yang 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 mereferensikan label dengan format {{$labels.xxx}}. |
${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}% |
| Duration |
string |
Durasi. Nilai yang valid: 1m hingga 1440m. Satuan: menit. |
1m |
| DispatchRuleId |
integer |
ID aturan dispatch. Parameter ini dikembalikan ketika NotifyType diatur ke |
10282 |
| AlertName |
string |
Nama aturan peringatan. |
Prometheus_Alert |
| AlertId |
integer |
ID aturan peringatan. |
3888704 |
| ClusterId |
string |
ID cluster. |
c0bad479465464e1d8c1e641b0afb**** |
| Labels |
array<object> |
Label aturan peringatan. |
|
|
object |
Label aturan peringatan. |
||
| Name |
string |
The name of the tag. |
severity |
| Value |
string |
The value of the tag associated with the instance. |
critical |
| Annotations |
array<object> |
Anotasi aturan peringatan. |
|
|
object |
Anotasi aturan peringatan. |
||
| Name |
string |
The name of the annotation. |
message |
| Value |
string |
The value of the annotation. |
${{$labels.pod_name}}CPU使用率大于80%,当前值{{$value}}% |
| Tags |
array<object> |
Tag. |
|
|
object |
Tag. |
||
| Key |
string |
The tag key. |
key |
| Value |
string |
The tag value. |
value |
| Code |
integer |
Kode status. Kode status 200 menunjukkan bahwa permintaan berhasil. Kode status lain menunjukkan bahwa permintaan gagal. |
200 |
| Message |
string |
Pesan yang dikembalikan. |
success |
| Success |
boolean |
Menunjukkan apakah panggilan berhasil. |
True |
Contoh
Respons sukses
JSONformat
{
"RequestId": "9FEA6D00-317F-45E3-9004-7FB8B0B7****",
"PrometheusAlertRules": [
{
"Status": 1,
"Type": "自定义",
"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}}%"
}
],
"Tags": [
{
"Key": "key",
"Value": "value"
}
]
}
],
"Code": 200,
"Message": "success",
"Success": true
}
Kode kesalahan
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.