SnmpService
更新时间: 2026/07/01
在Gitcode上查看源码

ResourceDefinition

uris

  • /redfish/v1/Managers/manager_id/SnmpService

properties

名称类型是否只读取值范围/枚举值说明
@odata.contextstringtrueSNMP资源模型的OData描述信息
@odata.idstringtrueSNMP资源节点的访问路径
@odata.typestringtrueSNMP资源类型
NamestringtrueSNMP资源的名称
IdstringtrueSNMP资源的ID
SnmpV1EnabledbooleanfalseSNMP协议版本1使能状态
SnmpV2CEnabledbooleanfalseSNMP协议版本2使能状态
SnmpV3EnabledbooleanfalseSNMP协议版本3使能状态
SnmpV1V2CLoginRulearrayfalse成员是字符串,取值如下
● Rule1
● Rule2
● Rule3
LongPasswordEnabledbooleanfalse超长口令使能状态
RWCommunityEnabledbooleanfalse读写团体名使能状态
ReadOnlyCommunitynull或字符串false只读团体名说明自BMC300 5.5.0.1版本后, 该信息更改为非敏感信息, 可查询明文值。BMC300 5.5.0.1版本前该信息显示为null,仅可以进行PATCH操作。
ReadWriteCommunitynull或字符串false读写团体名说明自BMC300 5.5.0.1版本后, 该信息更改为非敏感信息, 可查询明文值。BMC300 5.5.0.1版本前该信息显示为null,仅可以进行PATCH操作。
SnmpV3AuthUserarrayfalse● 具有用户配置权限的BMC用户显示所有用户名
● 无配置自身权限的用户显示null
● 其他用户只显示自身用户名
SnmpV3EngineIDstringtrueSNMP v3引擎ID
TrapModestringfalseTrap报文模式
● OID:OID模式
● PreciseAlarm:精准告警模式
ServiceEnabledbooleanfalseTrap功能使能状态
TrapVersionstringfalseTrap版本
TrapV3UserstringfalseV3用户名
TrapServerIdentitystringfalse主机标识
CommunityNamenullfalse团体名(此属性包含敏感信息,显示为null,可以进行PATCH操作)
AlarmSeveritynull或字符串false告警发送级别
● Critical (紧急)
● Major (严重及以上)
● Minor (轻微及以上)
● Normal (正常及以上)
● null (不发送告警)
ReportType枚举false上报事件类型:
● OemEvent:自定义事件
● SEL:传感器事件
MemberIdstringfalse数组序号
BobEnabledbooleanfalse带内转发使能状态
Enabledbooleanfalse服务器使能状态
TrapServerAddressstringfalse服务器地址
TrapServerPortnumberfalse服务器端口号
PasswordRulePolicystringfalse密码校验规则:
● Default:默认密码复杂度校验
● Customized:自定义正则校验
● Hybrid:两种校验模式共同生效
PasswordPatternstringfalse密码校验正则表达式
targetstringtrue操作路径
@Redfish.ActionInfostringtrue操作查询路径
#SnmpService.ConfigSnmpV3PrivPasswdobjecttrue设置指定用户的snmpv3加密密码
LoginRulearraytrue登录规则
SystemContactstringfalse信息产品联系人
SystemLocationstringfalse位置
#SnmpService.SubmitTestEventobjecttrue发送测试事件
codestringtrue指示消息注册表中特定消息ID的字符串。
messagestringtrue与消息注册表中的消息对应的易读的错误消息。
@Message.ExtendedInfostringtrue错误消息扩展信息
MessageIdstringtrue消息ID
RelatedPropertiesarraytrue消息相关属性
Messagestringtrue详细信息
MessageArgsarraytrue信息参数
Severitystringtrue严重性Redfish支持的严重级别包括:OK、Warning、Critical。
Resolutionstringtrue解决建议

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
}

请求头参数说明

参见 请求头参数说明

请求体参数说明

参数参数说明取值
ifmatch_value请求消息的匹配参数可通过对相应资源发起GET操作,从响应头中获取(对应于“ETag”参数)
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_value位置字符串
PasswordRulePolicy_value密码校验规则● Default:默认密码复杂度校验
● Customized:自定义正则校验
● Hybrid:两种校验模式共同生效
PasswordPattern_value密码校验正则表达式带有起始符(^)和终止符的 ($)的正则表达式长度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