代码仓
中
SnmpService
更新时间: 2026/07/01
在AtomGit上查看源码

ResourceDefinition ​

uris ​

  • /redfish/v1/Managers/manager_id/SnmpService

properties ​

名称类型是否只读取值范围/枚举值说明
@odata.contextstringtrue-SNMP资源模型的OData描述信息
@odata.idstringtrue-SNMP资源节点的访问路径
@odata.typestringtrue-SNMP资源类型
Namestringtrue-SNMP资源的名称
Idstringtrue-SNMP资源的ID
SnmpV1Enabledbooleanfalse-SNMP协议版本1使能状态
SnmpV2CEnabledbooleanfalse-SNMP协议版本2使能状态
SnmpV3Enabledbooleanfalse-SNMP协议版本3使能状态
SnmpV1V2CLoginRule[ ]arrayfalse-成员是字符串,取值如下
● Rule1:规则1
● Rule2:规则2
● Rule3:规则3
LongPasswordEnabledbooleanfalse-超长口令使能状态
RWCommunityEnabledbooleanfalse-读写团体名使能状态
ReadOnlyCommunitynullfalse-只读团体名说明自BMC300 5.5.0.1版本后, 该信息更改为非敏感信息, 可查询明文值。BMC300 5.5.0.1版本前该信息显示为null,仅可以进行PATCH操作。
ReadWriteCommunitynullfalse-读写团体名说明自BMC300 5.5.0.1版本后, 该信息更改为非敏感信息, 可查询明文值。BMC300 5.5.0.1版本前该信息显示为null,仅可以进行PATCH操作。
SnmpV3AuthUser[ ]arrayfalse-● 具有用户配置权限的BMC用户显示所有用户名
● 无配置自身权限的用户显示null
● 其他用户只显示自身用户名
SnmpV3EngineIDstringtrue-SNMP v3引擎ID
SnmpTrapNotification {objecttrue-SNMP Trap通知配置信息
SnmpTrapNotification.TrapModestringfalse-Trap报文模式
● OID:OID模式
● PreciseAlarm:精准告警模式
SnmpTrapNotification.ServiceEnabledbooleanfalse-Trap功能使能状态
SnmpTrapNotification.TrapVersionstringfalse-Trap版本
SnmpTrapNotification.TrapV3Userstringfalse-V3用户名
SnmpTrapNotification.TrapServerIdentitystringfalse-主机标识
SnmpTrapNotification.CommunityNamenullfalse-团体名(此属性包含敏感信息,显示为null,可以进行PATCH操作)
SnmpTrapNotification.AlarmSeveritystringfalse-告警发送级别
● Critical (紧急)
● Major (严重及以上)
● Minor (轻微及以上)
● Normal (正常及以上)
● null (不发送告警)
SnmpTrapNotification.TrapServer [ {arraytrue-Trap服务器列表
SnmpTrapNotification.TrapServer[].MemberIdstringfalse-数组序号
SnmpTrapNotification.TrapServer[].BobEnabledbooleanfalse-带内转发使能状态
SnmpTrapNotification.TrapServer[].Enabledbooleanfalse-服务器使能状态
SnmpTrapNotification.TrapServer[].TrapServerAddressstringfalse-服务器地址
SnmpTrapNotification.TrapServer[].TrapServerPortnumberfalse-服务器端口号
} ]
}
ReportTypestringfalse-上报事件类型:
● OemEvent:自定义事件
● SEL:传感器事件
PasswordRulePolicystringfalse-密码校验规则:
● Default:默认密码复杂度校验
● Customized:自定义正则校验
● Hybrid:两种校验模式共同生效
PasswordPatternstringfalse-密码校验正则表达式
Actions {objecttrue-SNMP组密钥导入操作
Actions.#SnmpService.ConfigSnmpV3PrivPasswd {objecttrue-设置指定用户的snmpv3加密密码
Actions.#SnmpService.ConfigSnmpV3PrivPasswd.@Redfish.ActionInfostringtrue-操作信息查询路径
Actions.#SnmpService.ConfigSnmpV3PrivPasswd.targetstringtrue-操作路径
}
Actions.#SnmpService.SubmitTestEvent {objecttrue-发送测试事件
Actions.#SnmpService.SubmitTestEvent.@Redfish.ActionInfostringtrue-操作信息查询路径
Actions.#SnmpService.SubmitTestEvent.targetstringtrue-操作路径
}
}
Links {objecttrue-SNMP资源相关链接信息
Links.LoginRule[].@odata.idstringtrue-成员资源节点的访问路径
Links.LoginRule[ ]arraytrue-登录规则
}
SystemContactstringfalse-信息产品联系人
SystemLocationnullfalse-位置

supported_methods ​

  • GET
  • PATCH
  • POST

HTTP methods ​

GET ​

命令功能

查询 SNMP 资源信息

命令格式

URL: https://device_ip/redfish/v1/Managers/manager_id/SnmpService

请求头:

X-Auth-Token: auth_value

请求消息体: 无

参数说明

参数参数说明取值
device_ip登录设备的IP地址IPv4或IPv6地址
auth_value请求消息的鉴权参数可通过/redfish/v1/SessionService/Sessions创建会话时获得

使用指南

GA140C机型不支持

使用实例

请求样例: GET https://device_ip/redfish/v1/Managers/manager_id/SnmpService

X-Auth-Token: auth_value 请求消息体:无

响应样例:

json
{
  "@odata.context": "/redfish/v1/$metadata#Managers/Members/1/SnmpService/$entity",
  "@odata.id": "/redfish/v1/Managers/1/SnmpService",
  "@odata.type": "#HwSnmpService.v1_0_0.HwSnmpService",
  "Name": "SnmpService",
  "Id": "SnmpService",
  "SnmpV1Enabled": false,
  "SnmpV2CEnabled": false,
  "SnmpV3Enabled": true,
  "SnmpV1V2CLoginRule": [
    "Rule1"
  ],
  "LongPasswordEnabled": true,
  "RWCommunityEnabled": true,
  "ReadOnlyCommunity": null,
  "ReadWriteCommunity": null,
  "SnmpV3AuthUser": [
    "Administrator",
    "test_user"
  ],
  "SnmpV3EngineID": "0x80001f880300180a0a0168d72c",
  "SnmpTrapNotification": {
    "ServiceEnabled": true,
    "TrapVersion": "V1",
    "TrapV3User": "root",
    "TrapServerIdentity": "BoardSN",
    "CommunityName": null,
    "AlarmSeverity": "Normal",
    "TrapServer": [
      {
        "MemberId": "0",
        "BobEnabled": true,
        "Enabled": false,
        "TrapServerAddress": "",
        "TrapServerPort": 162
      },
      {
        "MemberId": "1",
        "BobEnabled": true,
        "Enabled": false,
        "TrapServerAddress": "",
        "TrapServerPort": 162
      },
      {
        "MemberId": "2",
        "BobEnabled": true,
        "Enabled": false,
        "TrapServerAddress": "",
        "TrapServerPort": 162
      },
      {
        "MemberId": "3",
        "BobEnabled": true,
        "Enabled": false,
        "TrapServerAddress": "",
        "TrapServerPort": 162
      }
    ],
    "TrapMode": "PreciseAlarm"
  },
  "PasswordRulePolicy": "Default",
  "PasswordPattern": "",
  "Actions": {
    "#SnmpService.SubmitTestEvent": {
      "target": "/redfish/v1/Managers/1/SnmpService/Actions/SnmpService.SubmitTestEvent",
      "@Redfish.ActionInfo": "/redfish/v1/Managers/1/SnmpService/SubmitTestEventActionInfo"
    },
    "#SnmpService.ConfigSnmpV3PrivPasswd": {
      "target": "/redfish/v1/Managers/Blade2/SnmpService/Actions/SnmpService.ConfigSnmpV3PrivPasswd",
      "@Redfish.ActionInfo": "/redfish/v1/Managers/Blade2/SnmpService/ConfigSnmpV3PrivPasswdActionInfo"
    }
  },
  "Links": {
    "LoginRule": [
      {
        "@odata.id": "/redfish/v1/Managers/1#/Oem/Public/LoginRule/0"
      },
      {
        "@odata.id": "/redfish/v1/Managers/1#/Oem/Public/LoginRule/1"
      },
      {
        "@odata.id": "/redfish/v1/Managers/1#/Oem/Public/LoginRule/2"
      }
    ]
  },
  "SystemContact": "",
  "SystemLocation": null,
  "ReportType": "SEL"
}

响应码:200

PATCH ​

命令功能

修改 SNMP 资源属性

命令格式

URL: https://device_ip/redfish/v1/Managers/manager_id/SnmpService

请求头:

X-Auth-Token: auth_value
Content-Type: header_type
If-Match: ifmatch_value

请求消息体:

json
{
  "SnmpV1Enabled": SnmpV1Enabled,
  "SnmpV2CEnabled": SnmpV2CEnabled,
  "SnmpV3Enabled": SnmpV3Enabled,
  "SnmpV1V2CLoginRule": login_rule,
  "LongPasswordEnabled": LongPasswordEnabled,
  "RWCommunityEnabled": RWCommunityEnabled,
  "ReadWriteCommunity": ReadWriteCommunity,
  "ReadOnlyCommunity": ReadOnlyCommunity,
  "SnmpTrapNotification": {
    "ServiceEnabled": ServiceEnabled,
    "TrapVersion": TrapVersion,
    "TrapV3User": TrapV3User,
    "TrapServerIdentity": TrapServerIdentity,
    "CommunityName": CommunityName,
    "AlarmSeverity": AlarmSeverity,
    "TrapMode": "TrapMode",
    "TrapServer": [
      {
        "BobEnabled": BobEnabled,
        "Enabled": Enabled,
        "TrapServerAddress": TrapServerAddress,
        "TrapServerPort": TrapServerPort
      }
    ]
  },
  "SystemContact": "",
  "SystemLocation": SystemLocation_value,
  "ReportType": ReportType_value,
  "PasswordRulePolicy": PasswordRulePolicy_value,
  "PasswordPattern": PasswordPattern_value
}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
SnmpV1EnabledSNMP协议版本1使能状态● true
● false
SnmpV2CEnabledSNMP协议版本2使能状态● true
● false
SnmpV3EnabledSNMP协议版本3使能状态● true
● false
SnmpV1V2CLoginRule登录规则,类型是字符串数组字符串数组,数组元素支持以下值:
● Rule1
● Rule2
● Rule3
LongPasswordEnabled超长口令使能状态● true
● false
RWCommunityEnabled读写团体名使能状态● true
● false
ReadOnlyCommunity只读团体名字符串,格式要求:
● 不能包含空格
● 空字符串时,可删除只读团体名
● 长度要求: 默认长度1 ~ 32字节, 开启超长口令后16 ~ 32字节
● 密码复杂度校验: 开启时,长度最少为8字节;至少包含两种字符的组合(小写字符、 大写字符、数字、特殊字符)
● 只读团体名和读写团体名互不能相同
ReadWriteCommunity读写团体名字符串,格式要求:
● 不能包含空格
● 空字符串时,可删除读写团体名
● 长度要求: 默认长度1 ~ 32字节, 开启超长口令后16 ~ 32字节
● 密码复杂度校验: 开启时,长度最少为8字节;至少包含两种字符的组合(小写字符、 大写字符、数字、特殊字符)
● 只读团体名和读写团体名互不能相同
TrapModeTrap报文模式● OID:OID模式
● PreciseAlarm:精准告警模式
ServiceEnabledTrap功能使能状态● true
● false
TrapVersionTrap版本● V1
● V2C
● V3
TrapV3UserV3用户名已存在的本地用户名 (当TrapVersion为V3时有效)
TrapServerIdentity主机标识● BoardSN (单板序列号)
● ProductAssetTag (产品资产标签)
● HostName (主机名) (TrapMode选择精准告警模式时有效)
CommunityName团体名字符串,格式要求:
● trap版本为v3时不允许设置trap团体名
● 密码复杂度校验: 开启时,至少两种字符的组合(小写字符、大写字符、数字、特殊字符);长度要求8– 32字节; 关闭时,长度要求1–32字节
● 不能包含空格说明
● 如果使用SNMPv3 trap,团体名称无效
● BMC300 5.0.0及以上版本,团体名最大字符长度由18字节扩展到32字节
AlarmSeverity告警发送级别● Critical (紧急)
● Major (严重及以上)
● Minor (轻微及以上)
● Normal (正常及以上)
● null (不发送告警)
ReportType上报事件类型● OemEvent:自定义事件
● SEL:传感器事件
BobEnabled带内转发使能状态● true
● false
Enabled服务器使能状态● true
● false
TrapServerAddress服务器地址IPV4、IPV6地址或域名字符串
TrapServerPort服务器端口号数字范围在1-65535之间
SystemContact信息产品联系人字符串
SystemLocation位置字符串
PasswordRulePolicy密码校验规则● Default:默认密码复杂度校验
● Customized:自定义正则校验
● Hybrid:两种校验模式共同生效
PasswordPattern密码校验正则表达式带有起始符(^)和终止符的 ($)的正则表达式长度0-255

使用指南

GA140C机型不支持

使用实例

请求样例: PATCH https://device_ip/redfish/v1/Managers/manager_id/SnmpService

X-Auth-Token: auth_value Content-Type: header_type If-Match: ifmatch_value 请求消息体:

json
{
  "SnmpV1Enabled": SnmpV1Enabled,
  "SnmpV2CEnabled": SnmpV2CEnabled,
  "SnmpV3Enabled": SnmpV3Enabled,
  "SnmpV1V2CLoginRule": login_rule,
  "LongPasswordEnabled": LongPasswordEnabled,
  "RWCommunityEnabled": RWCommunityEnabled,
  "ReadWriteCommunity": ReadWriteCommunity,
  "ReadOnlyCommunity": ReadOnlyCommunity,
  "SnmpTrapNotification": {
    "ServiceEnabled": ServiceEnabled,
    "TrapVersion": TrapVersion,
    "TrapV3User": TrapV3User,
    "TrapServerIdentity": TrapServerIdentity,
    "CommunityName": CommunityName,
    "AlarmSeverity": AlarmSeverity,
    "TrapMode": "TrapMode",
    "TrapServer": [
      {
        "BobEnabled": BobEnabled,
        "Enabled": Enabled,
        "TrapServerAddress": TrapServerAddress,
        "TrapServerPort": TrapServerPort
      }
    ]
  },
  "SystemContact": "",
  "SystemLocation": SystemLocation_value,
  "ReportType": ReportType_value,
  "PasswordRulePolicy": PasswordRulePolicy_value,
  "PasswordPattern": PasswordPattern_value
}

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#Managers/Members/1/SnmpService/$entity",
"@odata.id": "/redfish/v1/Managers/1/SnmpService",
"@odata.type": "#HwSnmpService.v1_0_0.HwSnmpService",
"Name": "SnmpService",
"Id": "SnmpService",
"SnmpV1Enabled": false,
"SnmpV2CEnabled": false,
"SnmpV3Enabled": true,
"LongPasswordEnabled": false,
"ReadOnlyCommunity": null,
"ReadWriteCommunity": null,
"SnmpV3AuthUser": [
"Administrator",
"test_user"
],
"SnmpV3EngineID": "0x80001f880300180a0a0168d72c",
"SnmpTrapNotification": {
"ServiceEnabled": false,
"TrapVersion": "V1",
"TrapV3User": "root",
"TrapServerIdentity": "BoardSN",
"CommunityName": null,
"AlarmSeverity": "Normal",
"TrapServer": [
{
"BobEnabled": true,
"MemberId": "0",
"Enabled": true,
"TrapServerAddress": "192.168.44.1",
"TrapServerPort": 162
},
{
"BobEnabled": true,
"MemberId": "1",
"Enabled": false,
"TrapServerAddress": "",
"TrapServerPort": 162
},
{
"BobEnabled": true,
"MemberId": "2",
"Enabled": false,
"TrapServerAddress": "",
"TrapServerPort": 162
},
{
"BobEnabled": true,
"MemberId": "3",
"Enabled": false,
"TrapServerAddress": "",
"TrapServerPort": 162
}
],
"TrapMode": "PreciseAlarm"
},
"PasswordRulePolicy": "Default",
"PasswordPattern": "",
"Actions": {
"#SnmpService.SubmitTestEvent": {
"target": "/redfish/v1/Managers/1/SnmpService/Actions/SnmpService.SubmitTestEvent",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/SnmpService/SubmitTestEventActionInfo"
},
"#SnmpService.ConfigSnmpV3PrivPasswd": {
"target": "/redfish/v1/Managers/Blade2/SnmpService/Actions/SnmpService.ConfigSnmpV3PrivPasswd",
"@Redfish.ActionInfo": "/redfish/v1/Managers/Blade2/SnmpService/ConfigSnmpV3PrivPasswdActionInfo"
}
},
"Links": {
"LoginRule": [
{
"@odata.id": "/redfish/v1/Managers/1#/Oem/Public/LoginRule/0"
},
{
"@odata.id": "/redfish/v1/Managers/1#/Oem/Public/LoginRule/1"
},
{
"@odata.id": "/redfish/v1/Managers/1#/Oem/Public/LoginRule/2"
}
]
},
"SystemContact": "",
"SystemLocation": "shanghai",
"ReportType": "SEL"
}

响应码:200

POST (ACTION) ​

ConfigSnmpV3PrivPasswd ​

命令功能

修改指定用户 SNMP v3 加密密码

命令格式

URL: https://device_ip/redfish/v1/Managers/manager_id/SnmpService/Actions/SnmpService.ConfigSnmpV3PrivPasswd

请求头:

X-Auth-Token: auth_value
Content-Type: header_type

请求消息体:

json
{
  "SnmpV3AuthUser": user_value,
  "SnmpV3PrivPasswd": password_value
}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
user_valueSnmpv3鉴权用户名字符串,格式要求:
● 具有用户配置权限的BMC用户可设置任何一个本地用户名
● 无配置自身权限的用户无权限使用该功能
● 其他用户仅可设置自身用户名
password_value被用于SNMPv3鉴权的用户的加密密码字符串, 取值原则: 关闭密码检查功能后,密码不能为空,可以是任意字符组成的长度不大于20的字符串。 启用密码检查功能后,密码复杂度要求: 长度为8 ~ 20个字符。 至少包含一个空格或者以下特殊字符:“`~!@#$ %^&*()-_=+\

使用指南

GA140C机型不支持

使用实例

请求样例: POST https://device_ip/redfish/v1/Managers/manager_id/SnmpService/Actions/SnmpService.ConfigSnmpV3PrivPasswd

X-Auth-Token: auth_value Content-Type: header_type 请求消息体:

json
{
  "SnmpV3AuthUser": user_value,
  "SnmpV3PrivPasswd": password_value
}

响应样例:

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

POST (ACTION) ​

SubmitTestEvent ​

命令功能

SNMP 发送测试事件

命令格式

URL: https://device_ip/redfish/v1/Managers/manager_id/SnmpService/Actions/SnmpService.SubmitTestEvent

请求头:

X-Auth-Token: auth_value
Content-Type: header_type

请求消息体:

json
{
  "MemberId": value
}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
valueTrap服务器编号字符串,格式要求:0、1、2、3

使用指南

GA140C机型不支持

使用实例

请求样例: POST https://device_ip/redfish/v1/Managers/manager_id/SnmpService/Actions/SnmpService.SubmitTestEvent

X-Auth-Token: auth_value Content-Type: header_type 请求消息体:

json
{
  "MemberId": value
}

响应样例:

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