Prometheus 插件接口¶
Prometheus 插件接口¶
此接口用于通知外部监控工具检测到的告警。外部监控工具是基于 Prometheus 的监控系统。
Prometheus 插件有 5 个功能
基于 ETSI NFV-SOL 002/003 的性能管理任务的告警接口。
基于 ETSI NFV-SOL 002/003 的性能管理阈值的告警接口。
基于 ETSI NFV-SOL 002/003 的故障管理告警接口。
Prometheus 插件自动伸缩的告警接口。
Prometheus 插件自动修复的告警接口。
当获得一个或多个性能值时,告警 Tacker。
响应代码¶
成功¶
代码 |
原因 |
|---|---|
204 - No Content |
服务器已通过删除资源来满足请求。 |
错误¶
代码 |
原因 |
|---|---|
400 - 请求错误 |
请求中的某些内容无效。 |
404 - Not Found |
Prometheus 插件 API 未启用。(CONF.prometheus_plugin.performance_management) |
请求参数¶
名称 |
入参 |
类型 |
描述 |
|---|---|---|---|
alerts |
body |
数组 |
告警消息。 |
status |
body |
字符串 |
‘firing’: 告警触发,‘resolved’: 告警清除。 |
labels |
body |
对象 |
静态属性。 |
receiver_type |
body |
字符串 |
必须为 “tacker”。 |
function_type |
body |
字符串 |
必须为 “vnfpm”。 |
job_id |
body |
字符串 |
ETSI PM 接口中定义的 PM 任务 ID。 |
object_instance_id |
body |
字符串 |
ETSI PM 接口中定义的 objectInstanceId。 |
sub_object_instance_id (可选) |
body |
字符串 |
ETSI PM 接口中定义的 subObjectInstanceId。 |
指标 |
body |
字符串 |
ETSI PM 接口中定义的 PerformanceMetric。 |
annotations |
body |
对象 |
动态属性。 |
value (可选) |
body |
数字 |
PromQL 语句返回的结果值。 |
startsAt |
body |
字符串 |
告警触发时间。 |
endsAt (可选) |
body |
字符串 |
告警过期时间。 |
fingerprint |
body |
字符串 |
用于标识告警的 ID。 |
请求示例¶
{
"alerts": [{
"status": "firing",
"labels": {
"receiver_type": "tacker",
"function_type": "vnfpm",
"job_id": "64e46b0e-887a-4691-8d2b-aa3d7b157e2c",
"metric": "VCpuUsageMeanVnf.25b9b9d0-2461-4109-866e-a7767375415b",
"object_instance_id": "25b9b9d0-2461-4109-866e-a7767375415b",
"sub_object_instance_id": "85adebfa-d71c-49ab-9d39-d8dd7e393541"
},
"annotations": {
"value": 99
},
"startsAt": "2022-06-21T23:47:36.453Z",
"endsAt": "0001-01-01T00:00:00Z",
"fingerprint": "5ef77f1f8a3ecb8d"
}]
}
当获得一个或多个性能值时,告警 Tacker。
响应码¶
成功¶
代码 |
原因 |
|---|---|
204 - No Content |
服务器已通过删除资源来满足请求。 |
错误¶
代码 |
原因 |
|---|---|
400 - 请求错误 |
请求中的某些内容无效。 |
404 - Not Found |
Prometheus 插件 API 未启用。(CONF.prometheus_plugin.performance_management) |
请求参数¶
名称 |
入参 |
类型 |
描述 |
|---|---|---|---|
alerts |
body |
数组 |
告警消息。 |
status |
body |
字符串 |
‘firing’: 告警触发,‘resolved’: 告警清除。 |
labels |
body |
对象 |
静态属性。 |
receiver_type |
body |
字符串 |
必须为 “tacker”。 |
function_type |
body |
字符串 |
必须为 “vnfpm_threshold”。 |
threshold_id |
body |
字符串 |
ETSI PM 接口中定义的 PM 阈值 ID。 |
object_instance_id |
body |
字符串 |
ETSI PM 接口中定义的 objectInstanceId。 |
sub_object_instance_id (可选) |
body |
字符串 |
ETSI PM 接口中定义的 subObjectInstanceId。 |
指标 |
body |
字符串 |
ETSI PM 接口中定义的 PerformanceMetric。 |
annotations |
body |
对象 |
动态属性。 |
value (可选) |
body |
数字 |
PromQL 语句返回的结果值。 |
startsAt |
body |
字符串 |
告警触发时间。 |
endsAt (可选) |
body |
字符串 |
告警过期时间。 |
fingerprint |
body |
字符串 |
用于标识告警的 ID。 |
请求示例¶
{
"alerts": [{
"status": "firing",
"labels": {
"receiver_type": "tacker",
"function_type": "vnfpm_threshold",
"threshold_id": "bb474274-c5eb-442b-e2a2-0c1c02437bac",
"metric": "VCpuUsageMeanVnf.4fcf78d6-52d9-4b6a-b3a6-49b2bef65843",
"object_instance_id": "4fcf78d6-52d9-4b6a-b3a6-49b2bef65843",
"sub_object_instance_id": "938f673e-1eae-44d1-8847-cce5f64ac00e"
},
"annotations": {
"value": 99
},
"startsAt": "2023-01-03T23:47:36.453Z",
"endsAt": "0001-01-01T00:00:00Z",
"fingerprint": "5ef77f1f8a3ecb8d"
}]
}
当获得一个或多个故障事件时,告警 Tacker。
响应代码¶
成功¶
代码 |
原因 |
|---|---|
204 - No Content |
服务器已通过删除资源来满足请求。 |
错误¶
代码 |
原因 |
|---|---|
400 - 请求错误 |
请求中的某些内容无效。 |
404 - Not Found |
Prometheus 插件 API 未启用。(CONF.prometheus_plugin.fault_management) |
请求参数¶
名称 |
入参 |
类型 |
描述 |
|---|---|---|---|
alerts |
body |
数组 |
告警消息。 |
status |
body |
字符串 |
‘firing’: 告警触发,‘resolved’: 告警清除。 |
labels |
body |
对象 |
静态属性。 |
receiver_type |
body |
字符串 |
必须为 “tacker”。 |
function_type |
body |
字符串 |
必须为 “vnffm”。 |
vnf_instance_id |
body |
字符串 |
Vnf 实例 ID。 |
pod |
body |
字符串 |
匹配 Healing 目标 Pod 的正则表达式字符串。例如,‘test-test1-[0-9a-f]{1,10}-[0-9a-z]{5}’ |
perceived_severity |
body |
字符串 |
ETSI FM 接口中定义的 perceivedSeverity 值。 |
event_type |
body |
字符串 |
ETSI FM 接口中定义的 eventType 值。 |
annotations |
body |
对象 |
动态属性。 |
probable_cause |
body |
字符串 |
ETSI FM 接口中定义的 probableCause。 |
fault_type |
body |
字符串 |
ETSI FM 接口中定义的 faultType。 |
fault_details |
body |
字符串 |
ETSI FM 接口中定义的 faultDetails。 |
startsAt |
body |
字符串 |
告警触发时间。 |
endsAt (可选) |
body |
字符串 |
告警过期时间。 |
fingerprint |
body |
字符串 |
用于标识告警的 ID。 |
请求示例¶
{
"alerts": [{
"status": "firing",
"labels": {
"receiver_type": "tacker",
"function_type": "vnffm",
"vnf_instance_id": "503e635e-dcd8-4fae-9939-279af4c528b1",
"pod": "test\\-test1\\-[0-9a-f]{1,10}-[0-9a-z]{5}$",
"perceived_severity": "CRITICAL",
"event_type": "PROCESSING_ERROR_ALARM"
},
"annotations": {
"probable_cause": "Server is down.",
"fault_type": "Error",
"fault_details": "Fault detail"
},
"startsAt": "2022-06-21T23:47:36.453Z",
"endsAt": "0001-01-01T00:00:00Z",
"fingerprint": "5ef77f1f8a3ecb8d"
}]
}
当应执行伸缩时,告警 Tacker。
响应码¶
成功¶
代码 |
原因 |
|---|---|
204 - No Content |
服务器已通过删除资源来满足请求。 |
错误¶
代码 |
原因 |
|---|---|
400 - 请求错误 |
请求中的某些内容无效。 |
404 - Not Found |
Prometheus 插件 API 未启用。(CONF.prometheus_plugin.auto_scaling) |
请求参数¶
名称 |
入参 |
类型 |
描述 |
|---|---|---|---|
alerts |
body |
数组 |
告警消息。 |
status |
body |
字符串 |
‘firing’: 告警触发,‘resolved’: 告警清除。 |
labels |
body |
对象 |
静态属性。 |
receiver_type |
body |
字符串 |
必须为 “tacker”。 |
function_type |
body |
字符串 |
必须为 “auto_scale”。 |
vnf_instance_id |
body |
字符串 |
Vnf 实例 ID。 |
auto_scale_type |
body |
字符串 |
‘SCALE_OUT’ 用于伸缩,‘SCALE_IN’ 用于缩减。 |
aspect_id |
body |
字符串 |
伸缩目标的 aspectId。 |
annotations |
body |
对象 |
动态属性。 |
startsAt |
body |
字符串 |
告警触发时间。 |
endsAt (可选) |
body |
字符串 |
告警过期时间。 |
fingerprint |
body |
字符串 |
用于标识告警的 ID。 |
请求示例¶
{
"alerts": [{
"status": "firing",
"labels": {
"receiver_type": "tacker",
"function_type": "auto_scale",
"vnf_instance_id": "503e635e-dcd8-4fae-9939-279af4c528b1",
"auto_scale_type": "SCALE_OUT",
"aspect_id": "VDU1"
},
"annotations": {
},
"startsAt": "2022-06-21T23:47:36.453Z",
"endsAt": "0001-01-01T00:00:00Z",
"fingerprint": "5ef77f1f8a3ecb8d"
}]
}
当应执行修复时,告警 Tacker。
此接口可以在短时间内被多次告警。为了防止对单个 VNF 调用多次修复操作,此接口的多个请求将在配置的时间段内打包(CONF.prometheus_plugin.timer_interval)。
响应代码¶
成功¶
代码 |
原因 |
|---|---|
204 - No Content |
服务器已通过删除资源来满足请求。 |
错误¶
代码 |
原因 |
|---|---|
400 - 请求错误 |
请求中的某些内容无效。 |
404 - Not Found |
Prometheus 插件 API 未启用。(CONF.prometheus_plugin.auto_healing) |
请求参数¶
名称 |
入参 |
类型 |
描述 |
|---|---|---|---|
alerts |
body |
数组 |
告警消息。 |
status |
body |
字符串 |
‘firing’: 告警触发,‘resolved’: 告警清除。 |
labels |
body |
对象 |
静态属性。 |
receiver_type |
body |
字符串 |
必须为 “tacker”。 |
function_type |
body |
字符串 |
必须为 “auto_heal”。 |
vnf_instance_id |
body |
字符串 |
Vnf 实例 ID。 |
vnfc_info_id |
body |
字符串 |
Vnfc 信息 ID。 |
annotations |
body |
对象 |
动态属性。 |
startsAt |
body |
字符串 |
告警触发时间。 |
endsAt (可选) |
body |
字符串 |
告警过期时间。 |
fingerprint |
body |
字符串 |
用于标识告警的 ID。 |
请求示例¶
{
"alerts": [{
"status": "firing",
"labels": {
"receiver_type": "tacker",
"function_type": "auto_heal",
"vnf_instance_id": "503e635e-dcd8-4fae-9939-279af4c528b1",
"vnfc_info_id": "VDU1-85adebfa-d71c-49ab-9d39-d8dd7e393541"
},
"annotations": {
},
"startsAt": "2022-06-21T23:47:36.453Z",
"endsAt": "0001-01-01T00:00:00Z",
"fingerprint": "5ef77f1f8a3ecb8d"
}]
}