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

ResourceDefinition ​

uris ​

  • /redfish/v1/EventService/Subscriptions

properties ​

名称类型是否只读取值范围/枚举值说明
@odata.contextstringtrue-事件订阅集合资源模型的OData描述信息
@odata.typestringtrue-事件订阅集合资源的类型
@odata.idstringtrue-事件订阅集合资源的访问路径
Namestringtrue-事件订阅集合资源的名称
Members@odata.countnumbertrue-事件订阅集合资源数量
Members [ {arraytrue-事件订阅资源列表
Members[].@odata.idstringfalse-单个事件订阅资源节点的访问路径
} ]

supported_methods ​

  • GET
  • POST

HTTP methods ​

GET ​

命令功能

查询事件订阅集合资源

命令格式

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

请求头:

text

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

请求消息体: 无

参数说明

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

使用指南

无

使用实例

请求样例:

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

请求头:

text

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

请求消息体:无

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#EventService/Subscriptions/$entity",
"@odata.type": "#EventDestinationCollection.EventDestinationCollection",
"@odata.id": "/redfish/v1/EventService/Subscriptions",
"Name": "Event Subscriptions Collection",
"Members@odata.count": 1,
"Members": [
{
"@odata.id": "/redfish/v1/EventService/Subscriptions/1"
},
{
"@odata.id": "/redfish/v1/EventService/Subscriptions/Snmp1"
}
]
}

响应码:200

POST (CREATE) ​

命令功能

创建事件订阅资源

命令格式

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

请求头:

text

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

请求消息体: 创建 Redfish 协议类型事件订阅资源:

json
{
"Destination": event_destination,
"EventTypes": event_types,
"HttpHeaders": http_headers,
"Context": context,
"Protocol": protocal,
"SubscriptionType": subscription_type,
"Severities": severities,
"MessageIds": message_ids,
"OriginResources": origin_resources,
"SendHeartbeat": send_heartbeat,
"HeartbeatIntervalMinutes": heartbeat_interval_minutes,
"MetricReportDefinitions": metric_report_definitions,
"DeliveryRetryPolicy": delivery_retry_policy
}

创建SNMPv3协议类型事件订阅资源:

json
{
"Destination": event_destination,
"EventFormatType": event_format_type,
"Context": context,
"Protocol": protocal,
"SubscriptionType": subscription_type,
"Severities": severities,
"SNMP": {
"AuthenticationProtocol": authentication_protocol,
"AuthenticationKey": authentication_key,
"EncryptionProtocol": encryption_protocol,
"EncryptionKey": encryption_key
},
"Oem": {
"Public": {
"ServerIdentity": server_identity,
"SNMP": {
"TrapMode": trap_mode
}
}
}
}

创建SNMPv1/SNMPv2c协议类型事件订阅资源:

json
{
"Destination": event_destination,
"EventFormatType": event_format_type,
"Context": context,
"Protocol": protocal,
"SubscriptionType": subscription_type,
"Severities": severities,
"SNMP": {
"AuthenticationProtocol": authentication_protocol,
"TrapCommunity": trap_community
},
"Oem": {
"Public": {
"ServerIdentity": server_identity,
"SNMP": {
"TrapMode": trap_mode
}
}
}
}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
event_destination事件订阅接收地址Redfish协议类型支持格式:合法的https接收地址 SNMPv1/SNMPv2c协议类型支持格式:snmp://host[:port] SNMPv3协议类型支持格式:snmp://user@host[:port] 其中:
● user:事件上报使用的用户名
● host:事件上报目标服务器地址
● port:事件上报目标服务器端口号,不指定时默认为162
event_types事件订阅侦听的事件类型事件订阅侦听的事件类型,取值为以下值的组合:
● StatusChange:资源状态改变事件
● ResourceUpdated:资源更新事件
● ResourceAdded:资源添加事件
● ResourceRemoved:资源移除事件
● Alert:告警事件
● MetricReport: 指标报告事件
http_headers事件订阅HTTP头参数,事件上报时携带可选参数,取值需要符合key:value形式,查询时显示为null
context事件订阅上下文信息字符串
protocal事件订阅使用的协议取值:
● Redfish
● SNMPv1
● SNMPv2c
● SNMPv3
message_ids事件订阅消息Id匹配列表可选参数,事件注册表中定义的合法消息Id的组合
origin_resources事件订阅事件源匹配列表合法资源URI的组合
send_heartbeat心跳上报使能可选参数,取值为true或false
说明
openUBMC 25.12 LTS及以上版本支持
设置SendHeartBeat为false后不能设置HeartbeatIntervalMinutes属性
heartbeat_interval_minutes心跳间隔时间,单位:分钟可选参数,取值范围为1~65535,默认值为5
说明
openUBMC 25.12 LTS及以上版本支持
使能心跳后的第一个心跳上报会存在误差,误差值在0~60秒之间,后续心跳正常按照间隔时间进行上报
metric_report_definitions事件订阅指定上报的指标报告定义可选参数
delivery_retry_policy事件上报重试策略可选参数,
● TerminateAfterRetries:尝试上报事件超过阈值时,丢弃该上报事件
● SuspendRetries:尝试上报事件超过阈值时,挂起订阅信息
● RetryForever:永远尝试默认值为:TerminateAfterRetries
subscription_type事件的订阅类型Redfish协议类型取值:
● RedfishEvent SNMPv1/SNMPv2c/SNMPv3协议类型取值:
● SNMPTrap
说明:创建Redfish事件订阅时为可选参数
event_format_type事件上报的消息内容类型可选参数当前取值只能为Event
说明:Redfish协议类型不支持EventFormatType
severities事件上报发送事件的严重程度可选参数取值为以下值的组合:
● OK
● Warning
● Critical 默认值为 ["OK","Warning","Critical"]
authentication_protocol事件上报使用的鉴权算法可选参数 SNMPv1/SNMPv2c协议类型取值:
● CommunityString 默认值为CommunityString SNMPv3协议类型取值:
● HMAC_MD5
● HMAC192_SHA256
● HMAC256_SHA384
● HMAC384_SHA512
● HMAC_SHA96 默认值为HMAC192_SHA256
authentication_key事件上报使用的鉴权密钥可选参数鉴权密钥取值有如下格式:
● passphrase
● Passphrase:passphrase
● Hex:hex_passphrase 其中,passphrase为长度不超过32位的未加密密钥 hex_passphrase为加密后的16进制密钥
说明:仅SNMPv3协议类型支持AuthenticationKey 未设置AuthenticationKey时,AuthenticationKeySet为false,事件上报为UnavailableOffline状态
encryption_protocol事件上报使用的加密算法可选参数取值:
● CBC_DES
● CFB128_AES128
● CFB128_AES256 默认值为CFB128_AES128
说明:仅SNMPv3协议类型支持EncryptionProtocol
encryption_key事件上报使用的加密密钥可选参数加密密钥取值有如下格式:
● passphrase
● Passphrase:passphrase
● Hex:hex_passphrase 其中,passphrase为长度不超过32位的未加密密钥 hex_passphrase为加密后的16进制密钥
说明:仅SNMPv3协议类型支持EncryptionKey 未设置EncryptionKey时,EncryptionKeySet为false,事件上报为UnavailableOffline状态
trap_community事件上报使用的团体名长度为1-32字节的字符串
说明:仅SNMPv1/SNMPv2c协议类型支持TrapCommunity
server_identity事件上报使用的主机标识可选参数取值:
● BoardSN(单板序列号)
● ProductAssetTag(产品资产标签)
● HostName(主机名)默认值为BoardSN
trap_mode事件上报使用的Trap报文模式可选参数取值:
● PreciseAlarm:精准告警模式
● OID:OID模式默认值为PreciseAlarm

使用指南

创建Redfish协议类型订阅指定的事件接收地址不能和已存在订阅的接收地址相同。

使用实例

请求样例(Redfish协议):

http
POST <https://device_ip/redfish/v1/EventService/Subscriptions>

请求头:

text

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

请求消息体:

json
{
"Destination": "https://10.10.10.191/iBMCRedfishEvents/iBMCEventReceiver.php",
"EventTypes": [
"StatusChange",
"ResourceUpdated",
"ResourceAdded",
"ResourceRemoved",
"Alert",
"MetricReport"
],
"HttpHeaders": {
"Content-Type": "Application/JSON",
"OData-Version": "4.0",
"X-Auth-Token": "5ac44e4c36db20ee69f661f42239b6f5"
},
"Context": "event subscription context string",
"Protocol": "Redfish",
"MessageIds": [
"iBMCEvents.2.0.PSUPredictiveFailure "
],
"OriginResources": [
{
"@odata.id": "/redfish/v1/Chassis/1/Power#/PowerSupplies/0"
}
],
"SendHeartbeat": true,
"HeartbeatIntervalMinutes": 10,
"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",
"MetricReport"
],
"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",
"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"
}
}
}

响应码:201

请求样例(SNMPv2c协议):

http
POST <https://device_ip/redfish/v1/EventService/Subscriptions>

请求头:

text

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

请求消息体:

json
{
"Destination": "snmp://10.10.10.191:162",
"EventFormatType": "Event",
"Context": "SNMPv1 SNMPv2c trap context string",
"Protocol": "SNMPv2c",
"SubscriptionType": "SNMPTrap",
"Severities": [
"OK",
"Warning",
"Critical"
],
"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"
}
}
}
}

响应码:201

请求样例(SNMPv3协议):

http
POST <https://device_ip/redfish/v1/EventService/Subscriptions>

请求头:

text

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

请求消息体:

json
{
"Destination": "snmp://userexample@10.10.10.191:162",
"EventFormatType": "Event",
"Context": "SNMPv3 trap context string",
"Protocol": "SNMPv3",
"SubscriptionType": "SNMPTrap",
"Severities": [
"OK",
"Warning",
"Critical"
],
"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"
}
}
}
}

响应码:201