代码仓
中
Subscriptions
更新时间: 2026/11/04
在AtomGit上查看源码

ResourceDefinition ​

uris ​

  • /redfish/v1/EventService/Subscriptions/{subscription_id}

properties ​

名称类型是否只读取值范围/枚举值说明
@odata.contextstringtrue-事件订阅资源模型的OData描述信息
@odata.idstringtrue-事件订阅资源节点的访问路径
@odata.typestringtrue-事件订阅资源类型
Idstringtrue-事件订阅资源的ID
Namestringtrue-事件订阅资源的名称
Destinationstringtrue-目的地事件服务的URI
EventFormatTypestringtrueEvent事件上报的消息内容类型
EventTypes[ ]arraytrue-包含将要发送到指定的事件的类型
HttpHeadersobjectfalse-事件订阅HTTP头,查询时对外显示为null
ProtocolstringtrueRedfish,SNMPv1,SNMPv2c,SNMPv3事件连接的协议类型,包括:
● Redfish:Redfish
● SNMPv1:SNMPv1
● SNMPv2c:SNMPv2c
● SNMPv3:SNMPv3
Contextstringfalse-客户端提供的与事件目标订阅一起存储的字符串
MessageIds[ ]arraytrue-事件消息Id匹配列表
OriginResources [ {arraytrue-事件源匹配列表
OriginResources[].@odata.idstringtrue-事件源的访问路径
} ]
SendHeartbeatbooleantruetrue,false表示该事件订阅是否使能心跳
说明
openUBMC 25.12 LTS及以上版本支持
设置SendHeartBeat为false后不能设置HeartbeatIntervalMinutes属性
HeartbeatIntervalMinutesnumbertrue-表示该事件订阅设置心跳上报的时间间隔
说明
openUBMC 25.12 LTS及以上版本支持
使能心跳后的第一个心跳上报会存在误差,误差值在0~60秒之间,后续心跳正常按照间隔时间进行上报
Status {objecttrue-指定事件订阅资源的状态,包括:State:使能状态。
● Enabled:使能状态
● Disabled:挂起待激活状态
● UnavailableOffline:表示当前事件订阅无法进行事件上报SuspendRetries状态下,事件上报次数超过阈值自动从Enabled状态变成Disabled状态。
Status.Statestringtrue-事件订阅使能状态
}
DeliveryRetryPolicystringfalseTerminateAfterRetries,SuspendRetries,RetryForever事件上报重试策略
● TerminateAfterRetries:尝试上报事件超过阈值时,丢弃该上报事件
● SuspendRetries:尝试上报事件超过阈值时,挂起订阅信息
● RetryForever:永远尝试默认值为:TerminateAfterRetries
SubscriptionTypestringtrueRedfishEvent,SNMPTrapRedfish协议类型取值:
● RedfishEvent SNMPv1/SNMPv2c/SNMPv3协议类型取值:
● SNMPTrap:SNMP Trap
● RedfishEvent:Redfish事件
Severities[ ]arraytrue-事件上报发送事件的严重程度,取值:
● OK:正常
● Warning:警告
● Critical:严重
Actions {objecttrue-可执行的操作
Actions.#EventDestination.ResumeSubscription {objecttrue-订阅事件信息恢复对象
Actions.#EventDestination.ResumeSubscription.targetstringtrue-执行订阅事件信息操作的URL
Actions.#EventDestination.ResumeSubscription.@Redfish.ActionInfostringtrue-Action参数信息说明
}
Actions.#EventDestination.SuspendSubscription {objecttrue-订阅事件信息暂停对象
Actions.#EventDestination.SuspendSubscription.targetstringtrue-执行订阅事件信息操作的URL
Actions.#EventDestination.SuspendSubscription.@Redfish.ActionInfostringtrue-Action参数信息说明
}
}
AuthenticationKeySetbooleanfalse-鉴权密钥是否已设置
说明:仅SNMPv3协议类型支持
EncryptionKeySetbooleanfalse-加密密钥是否已设置
说明:仅SNMPv3协议类型支持

supported_methods ​

  • GET
  • PATCH
  • DELETE
  • POST

HTTP methods ​

GET ​

命令功能

查询事件订阅资源

命令格式

URL: https://device_ip/redfish/v1/EventService/Subscriptions/subscription_id

请求头:

text

X-Auth-Token: 123456789***********************

请求消息体: 无

参数说明

参数参数说明取值
device_ip登录设备的IP地址IPv4或IPv6地址
subscription_id合法的事件订阅资源Id1~4 Snmp1~Snmp4
auth_value执行该GET请求时,必须在"Headers"中携带"X-Auth-Token"值用于鉴权可通过/redfish/v1/SessionService/Sessions创建会话时获得

使用指南

使用id为1~4的URL查询Redfish事件订阅资源。 使用id为Snmp1~Snmp4的URL查询SNMP事件订阅资源。

使用实例

请求样例(Redfish协议):

http
GET <https://device_ip/redfish/v1/EventService/Subscriptions/1>

请求头:

text

X-Auth-Token: 123456789***********************

请求消息体:无

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#EventService/Subscriptions/Members/$entity",
"@odata.id": "/redfish/v1/EventService/Subscriptions/1",
"@odata.type": "#EventDestination.v1_11_0.EventDestination",
"Id": "1",
"Name": "EventSubscription 1",
"Destination": "https://10.10.10.191/iBMCRedfishEvents/iBMCEventReceiver.php",
"EventTypes": [
"StatusChange",
"ResourceUpdated",
"ResourceAdded",
"ResourceRemoved",
"Alert"
],
"HttpHeaders": null,
"Protocol": "Redfish",
"Context": "event subscription context string",
"MessageIds": [
"iBMCEvents.2.0.PSUPredictiveFailure "
],
"OriginResources": [
{
"@odata.id": "/redfish/v1/Chassis/1/Power#/PowerSupplies/0"
}
],
"SendHeartbeat": true,
"HeartbeatIntervalMinutes": 10,
"Status": {
"State": "Enabled"
},
"DeliveryRetryPolicy": "TerminateAfterRetries",
"SubscriptionType": "RedfishEvent",
"Severities": [
"OK",
"Warning",
"Critical"
],
"Actions": {
"#EventDestination.ResumeSubscription": {
"target": "/redfish/v1/EventService/Subscriptions/1/Actions/EventDestination.ResumeSubscription",
"@Redfish.ActionInfo": "/redfish/v1/EventService/ResumeSubscriptionActionInfo"
},
"#EventDestination.SuspendSubscription": {
"target": "/redfish/v1/EventService/Subscriptions/1/Actions/EventDestination.SuspendSubscription",
"@Redfish.ActionInfo": "/redfish/v1/EventService/SuspendSubscriptionActionInfo"
}
}
}

响应码:200

请求样例(SNMPv2c协议):

http
GET <https://device_ip/redfish/v1/EventService/Subscriptions/Snmp1>

请求头:

text

X-Auth-Token: 123456789***********************

请求消息体:无

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#EventDestination.EventDestination",
"@odata.id": "/redfish/v1/EventService/Subscriptions/Snmp1",
"@odata.type": "#EventDestination.v1_11_0.EventDestination",
"Id": "Snmp1",
"Name": "Snmp EventSubscription 1",
"Destination": "snmp://10.10.10.191:162",
"EventFormatType": "Event",
"Protocol": "SNMPv2c",
"Context": "SNMPv1 SNMPv2c trap context string",
"Status": {
"State": "Enabled"
},
"SubscriptionType": "SNMPTrap",
"Severities": [
"OK",
"Warning",
"Critical"
],
"SNMP": {
"AuthenticationProtocol": "CommunityString",
"TrapCommunity": null
},
"Oem": {
"Public": {
"ServerIdentity": "BoardSN",
"SNMP": {
"TrapMode": "PreciseAlarm"
}
}
}
}

响应码:200

请求样例(SNMPv3协议):

http
GET <https://device_ip/redfish/v1/EventService/Subscriptions/Snmp2>

请求头:

text

X-Auth-Token: 123456789***********************

请求消息体:无

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#EventDestination.EventDestination",
"@odata.id": "/redfish/v1/EventService/Subscriptions/Snmp2",
"@odata.type": "#EventDestination.v1_11_0.EventDestination",
"Id": "Snmp2",
"Name": "Snmp EventSubscription 2",
"Destination": "snmp://userexample@10.10.10.191:162",
"EventFormatType": "Event",
"Protocol": "SNMPv3",
"Context": "SNMPv3 trap context string",
"Status": {
"State": "Enabled"
},
"SubscriptionType": "SNMPTrap",
"Severities": [
"OK",
"Warning",
"Critical"
],
"SNMP": {
"AuthenticationProtocol": "HMAC192_SHA256",
"AuthenticationKey": null,
"AuthenticationKeySet": true,
"EncryptionProtocol": "CFB128_AES128",
"EncryptionKey": null,
"EncryptionKeySet": true
},
"Oem": {
"Public": {
"ServerIdentity": "BoardSN",
"SNMP": {
"TrapMode": "PreciseAlarm"
}
}
}
}

响应码:200

PATCH ​

命令功能

修改事件订阅资源

命令格式

URL: https://device_ip/redfish/v1/EventService/Subscriptions/subscription_id

请求头:

text

X-Auth-Token: 123456789***********************
Content-Type: header_type
If-Match: ifmatch_value

Redfish事件订阅请求消息体:

json
{
"HttpHeaders": http_headers,
"Context": context,
"DeliveryRetryPolicy": delivery_retry_policy
}

SNMP事件订阅请求消息体(SNMPv1/SNMPv2c协议):

json
{
"Context": context,
"SNMP": {
"AuthenticationProtocol": authentication_protocol,
"TrapCommunity": trap_community
},
"Oem": {
"Public": {
"ServerIdentity": server_identity,
"SNMP": {
"TrapMode": trap_mode
}
}
}
}

SNMP事件订阅请求消息体(SNMPv3协议):

json
{
"Context": context,
"SNMP": {
"AuthenticationProtocol": authentication_protocol,
"AuthenticationKey": authentication_key,
"EncryptionProtocol": encryption_protocol,
"EncryptionKey": encryption_key
},
"Oem": {
"Public": {
"ServerIdentity": server_identity,
"SNMP": {
"TrapMode": trap_mode
}
}
}
}

URL参数说明

参数参数说明取值
subscription_id合法的事件订阅资源ID1~4 Snmp1~Snmp4

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
HttpHeaders事件订阅HTTP头参数,事件上报时携带取值需要符合key:value形式。设置时采用直接替换以前信息的方式
Context事件订阅上下文字符串
DeliveryRetryPolicy事件上报重试策略可选参数,
● TerminateAfterRetries:尝试上报事件超过阈值时,丢弃该上报事件
● SuspendRetries:尝试上报事件超过阈值时,挂起订阅信息
● RetryForever:永远尝试默认值为:TerminateAfterRetries
AuthenticationProtocol事件上报使用的鉴权算法SNMPv1/SNMPv2c协议类型取值:
● CommunityString SNMPv3协议类型取值:
● HMAC_MD5
● HMAC192_SHA256
● HMAC256_SHA384
● HMAC384_SHA512
● HMAC_SHA96
说明:设置AuthenticationProtocol时,会清空AuthenticationKey与EncryptionKey,需要单独设置AuthenticationKey与EncryptionKey
AuthenticationKey事件上报使用的鉴权密钥鉴权密钥取值有如下格式:
● passphrase
● Passphrase:passphrase
● Hex:hex_passphrase 其中,passphrase为长度不超过32位的未加密密钥 hex_passphrase为加密后的16进制密钥
说明:未设置AuthenticationKey时,AuthenticationKeySet为false,事件上报为UnavailableOffline状态
EncryptionProtocol事件上报使用的加密算法取值:
● CBC_DES
● CFB128_AES128
● CFB128_AES256
说明:仅SNMPv3协议类型支持EncryptionProtocol
EncryptionKey事件上报使用的加密密钥加密密钥取值有如下格式:
● passphrase
● Passphrase:passphrase
● Hex:hex_passphrase 其中,passphrase为长度不超过32位的未加密密钥 hex_passphrase为加密后的16进制密钥
说明:未设置EncryptionKey时,EncryptionKeySet为false,事件上报为UnavailableOffline状态
TrapCommunity事件上报使用的团体名长度为1-32字节的字符串
ServerIdentity事件上报使用的主机标识取值:
● BoardSN(单板序列号)
● ProductAssetTag(产品资产标签)
● HostName(主机名)
TrapMode事件上报使用的Trap报文模式取值:
● PreciseAlarm:精准告警模式
● OID:OID模式默认值为PreciseAlarm

使用指南

无

使用实例

请求样例(Redfish协议):

http
PATCH <https://device_ip/redfish/v1/EventService/Subscriptions/1>

请求头:

text
X-Auth-Token: 123456789***********************
Content-Type: application/json
If-Match: W/"06348C97"

请求消息体:

json
{
"HttpHeaders": {
"Content-Type": "Application/JSON",
"OData-Version": "4.0",
"X-Auth-Token": "5ac44e4c36db20ee69f661f42239b6f5"
},
"Context": "abcdefg",
"DeliveryRetryPolicy": "TerminateAfterRetries"
}

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#EventService/Subscriptions/Members/$entity",
"@odata.id": "/redfish/v1/EventService/Subscriptions/1",
"@odata.type": "#EventDestination.v1_11_0.EventDestination",
"Id": "1",
"Name": "EventSubscription 1",
"Destination": "<https://10.10.10.191/iBMCRedfishEvents/iBMCEventReceiver.php",>
"EventTypes": [
"StatusChange",
"ResourceUpdated",
"ResourceAdded",
"ResourceRemoved",
"Alert"
],
"HttpHeaders": null,
"Protocol": "Redfish",
"Context": "abcdefg",
"MessageIds": [
"iBMCEvents.2.0.PSUPredictiveFailure "
],
"OriginResources": [
{
"@odata.id": "/redfish/v1/Chassis/1/Power#/PowerSupplies/0"
}
],
"SendHeartbeat": true,
"HeartbeatIntervalMinutes": 10,
"Status": {
"State": "Enabled"
},
"DeliveryRetryPolicy": "TerminateAfterRetries",
"Actions": {
"#EventDestination.ResumeSubscription": {
"target": "/redfish/v1/EventService/Subscriptions/1/Actions/EventDestination.ResumeSubscription",
"@Redfish.ActionInfo": "/redfish/v1/EventService/ResumeSubscriptionActionInfo"
},
"#EventDestination.SuspendSubscription": {
"target": "/redfish/v1/EventService/Subscriptions/1/Actions/EventDestination.SuspendSubscription",
"@Redfish.ActionInfo": "/redfish/v1/EventService/SuspendSubscriptionActionInfo"
}
}
}

响应码:200

请求样例(SNMPv2c协议):

http
PATCH <https://device_ip/redfish/v1/EventService/Subscriptions/Snmp1>

请求头:

text

X-Auth-Token: 123456789***********************
Content-Type: application/json
If-Match: W/"06348C97"

请求消息体:

json
{
"Context": "SNMPv1 SNMPv2c trap context string",
"SNMP": {
"AuthenticationProtocol": "CommunityString",
"TrapCommunity": "TrapCommunity@Example"
},
"Oem": {
"Public": {
"ServerIdentity": "BoardSN",
"SNMP": {
"TrapMode": "PreciseAlarm"
}
}
}
}

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#EventDestination.EventDestination",
"@odata.id": "/redfish/v1/EventService/Subscriptions/Snmp1",
"@odata.type": "#EventDestination.v1_11_0.EventDestination",
"Id": "Snmp1",
"Name": "Snmp EventSubscription 1",
"Destination": "snmp://10.10.10.191:162",
"EventFormatType": "Event",
"Protocol": "SNMPv2c",
"Context": "SNMPv1 SNMPv2c trap context string",
"Status": {
"State": "Enabled"
},
"SubscriptionType": "SNMPTrap",
"Severities": [
"OK",
"Warning",
"Critical"
],
"SNMP": {
"AuthenticationProtocol": "CommunityString",
"TrapCommunity": null
},
"Oem": {
"Public": {
"ServerIdentity": "BoardSN",
"SNMP": {
"TrapMode": "PreciseAlarm"
}
}
}
}

响应码:200

请求样例(SNMPv3协议):

http
PATCH <https://device_ip/redfish/v1/EventService/Subscriptions/Snmp2>

请求头:

text

X-Auth-Token: 123456789***********************
Content-Type: application/json
If-Match: W/"06348C97"

请求消息体:

json
{
"Context": "SNMPv3 trap context string",
"SNMP": {
"AuthenticationProtocol": "HMAC192_SHA256",
"AuthenticationKey": "AuthenticationKey@Example",
"EncryptionProtocol": "CFB128_AES128",
"EncryptionKey": "EncryptionKey@Example"
},
"Oem": {
"Public": {
"ServerIdentity": "BoardSN",
"SNMP": {
"TrapMode": "PreciseAlarm"
}
}
}
}

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#EventDestination.EventDestination",
"@odata.id": "/redfish/v1/EventService/Subscriptions/Snmp2",
"@odata.type": "#EventDestination.v1_11_0.EventDestination",
"Id": "Snmp2",
"Name": "Snmp EventSubscription 2",
"Destination": "snmp://userexample@10.10.10.191:162",
"EventFormatType": "Event",
"Protocol": "SNMPv3",
"Context": "SNMPv3 trap context string",
"Status": {
"State": "Enabled"
},
"SubscriptionType": "SNMPTrap",
"Severities": [
"OK",
"Warning",
"Critical"
],
"SNMP": {
"AuthenticationProtocol": "HMAC192_SHA256",
"AuthenticationKey": null,
"AuthenticationKeySet": true,
"EncryptionProtocol": "CFB128_AES128",
"EncryptionKey": null,
"EncryptionKeySet": true
},
"Oem": {
"Public": {
"ServerIdentity": "BoardSN",
"SNMP": {
"TrapMode": "PreciseAlarm"
}
}
}
}

响应码:200

DELETE ​

命令功能

删除事件订阅资源

命令格式

URL: https://device_ip/redfish/v1/EventService/Subscriptions/subscription_id

请求头:

text

X-Auth-Token: 123456789***********************

请求消息体: 无

参数说明

参数参数说明取值
device_ip登录设备的IP地址IPv4或IPv6地址
subscription_id合法的事件订阅资源Id1~4 Snmp1~Snmp4
auth_value请求消息的鉴权参数可通过/redfish/v1/SessionService/Sessions创建会话时获得

使用指南

无

使用实例

请求样例:

http
DELETE <https://device_ip/redfish/v1/EventService/Subscriptions/1>

请求头:

text

X-Auth-Token: 123456789***********************

请求消息体:无

响应样例:

json
{
"error": {
"code": "Base.1.0.GeneralError",
"message": "A general error has occurred. See ExtendedInfo for more information.",
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_0_0.Message",
"MessageId": "Base.1.0.Success",
"RelatedProperties": [],
"Message": "Successfully Completed Request",
"MessageArgs": [],
"Severity": "OK",
"Resolution": "None"
}
]
}
}

响应码:200

输出说明

参见 DELETE 通用输出说明

POST (ACTION) ​

ResumeSubscription ​

命令功能

恢复订阅事件信息

命令格式

URL: https://device_ip/redfish/v1/EventService/Subscriptions/{subscription_id}/Actions/EventDestination.ResumeSubscription

请求头:

text

X-Auth-Token: 123456789***********************
Content-Type: header_type

请求消息体:

json
{
"DeliverBufferedEventDuration": deliver_buffered_event_duration
}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
subscription_id合法的事件订阅资源Id1~4
deliver_buffered_event_duration指定重新发送的缓存事件信息的时间范围符合ISO-8601规范的时间表示字符串。Pattern: ^P(\d+D)?(T(\d+H)?(\d+M)?(\d+(.\d+)?S)?)?$ 例如:PT8H,表示发送当前时间往前8小时内的告警内容

使用指南

无

使用实例

请求样例:

http
POST <https://device_ip/redfish/v1/EventService/Subscriptions/1/Actions/EventDestination.ResumeSubscription>

请求头:

text

X-Auth-Token: 123456789***********************
Content-Type: application/json

请求消息体:

json
{
"DeliverBufferedEventDuration": "PT8H"
}

响应样例1:

json
{
"error": {
"code": "Base.1.0.GeneralError",
"message": "A general error has occurred. See ExtendedInfo for more information.",
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_0_0.Message",
"MessageId": "Base.1.0.Success",
"RelatedProperties": [],
"Message": "Successfully Completed Request",
"MessageArgs": [],
"Severity": "OK",
"Resolution": "None"
}
]
}
}

响应码:200

响应样例2:

json
{
"error": {
"code": "Base.1.0.GeneralError",
"message": "A general error has occurred. See ExtendedInfo for more information.",
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_0_0.Message",
"MessageId": "Base.1.0.EventBufferExceeded ",
"RelatedProperties": [
"#/DeliverBufferedEventDuration"
],
"Message": "Undelivered events may have been lost due to exceeding the event buffer.",
"MessageArgs": [],
"Severity": "Warning",
"Resolution": "None"
}
]
}
}

响应码:200

POST (ACTION) ​

SuspendSubscription ​

命令功能

暂停订阅事件信息

命令格式

URL: https://device_ip/redfish/v1/EventService/Subscriptions/{subscription_id}/Actions/EventDestination.SuspendSubscription

请求头:

text

X-Auth-Token: 123456789***********************
Content-Type: header_type

请求消息体:

json
{}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
subscription_id合法的事件订阅资源Id1~4

使用指南

无

使用实例

请求样例:

http
POST <https://device_ip/redfish/v1/EventService/Subscriptions/1/Actions/EventDestination.SuspendSubscription>

请求头:

text

X-Auth-Token: 123456789***********************
Content-Type: application/json

请求消息体:

json
{}

响应样例:

json
{
"error": {
"code": "Base.1.0.GeneralError",
"message": "A general error has occurred. See ExtendedInfo for more information.",
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_0_0.Message",
"MessageId": "Base.1.0.Success",
"RelatedProperties": [],
"Message": "Successfully Completed Request",
"MessageArgs": [],
"Severity": "OK",
"Resolution": "None"
}
]
}
}

响应码:200