CSR配置字典之MetricReportDefinition类
📋 文档信息
| 项目 | 内容 |
|---|---|
| 文档标题 | MetricReportDefinition类配置字典 |
| 版本 | v1.0 |
| 创建日期 | 2025-04-24 |
| 最后更新 | 2025-04-24 |
| 维护状态 | ✅ 活跃维护 |
📋 变更历史记录
| 版本 | 发布日期 | 变更类型 | 变更内容 | 影响范围 | 维护人员 |
|---|---|---|---|---|---|
| v1.0 | 2025-04-24 | 初始版本 | 创建MetricReportDefinition类配置字典 | 全新文档 | 系统管理员 |
🎯 类概览
| 属性 | 值 |
|---|---|
| 类名称 | MetricReportDefinition |
| 功能描述 | Redfish遥测报告定义配置,用于定义如何收集和生成遥测数据报告 |
| 所属SIG组 | interface |
| 所属组件 | redfish |
| 最后更新 | 2025-04-24 |
| 状态 | 🟢 正常运行 |
📊 属性定义详表
必选属性
| 属性名 | 类型 | 默认值 | 取值范围 | 动态关联 | 描述 | 使用场景 | 举例 | 来源 | 分类 |
|---|---|---|---|---|---|---|---|---|---|
Id | String | - | String | - | 报告定义ID | 唯一标识报告定义 | "AveragePowerReport" | CSR配置 | 软件 |
Name | String | - | String | - | 报告定义名称 | 报告定义的显示名称 | "Metric report of Average Power" | CSR配置 | 软件 |
Description | String | - | String | - | 报告定义描述 | 报告定义的详细描述 | "Metric report of Average Power" | CSR配置 | 软件 |
MetricReportDefinitionType | String | - | ["OnChange", "OnRequest", "Periodic"] | - | 报告类型 | 产生报告的方式 | "OnChange" | CSR配置 | 软件 |
ReportActions | String[] | - | ["LogToMetricReportsCollection", "RedfishEvent"] | - | 报告动作 | 产生报告后的动作 | ["LogToMetricReportsCollection", "RedfishEvent"] | CSR配置 | 软件 |
Metrics | Array | - | Array | - | 采集项列表 | 呈现在报告中的采集项定义列表,每个采集项包含MetricId(指标定义的ID)、CollectionFunction(采集函数)、CollectionTimeScope(采集时间范围)、CollectionDuration(采集持续时间)等属性 | [] | CSR配置 | 软件 |
可选属性
| 属性名 | 类型 | 默认值 | 取值范围 | 动态关联 | 描述 | 使用场景 | 举例 | 来源 | 分类 |
|---|---|---|---|---|---|---|---|---|---|
AppendLimit | U16 | - | [0, 4096] | - | 追加限制 | 单个报告最大记录条数 | 128 | CSR配置 | 软件 |
MetricReportDefinitionEnabled | Boolean | - | Boolean | - | 使能状态 | 报告定义的使能状态 | true | CSR配置 | 软件 |
ReportUpdates | String | - | ["AppendWrapsWhenFull"] | - | 报告更新方式 | 报告满后的更新方式,AppendWrapsWhenFull:新纪录覆盖旧记录 | "AppendWrapsWhenFull" | CSR配置 | 软件 |
InitialStartTime | U64 | - | U64 | - | 起始时间 | 采集起始时间戳 | 1894165900 | CSR配置 | 软件 |
Lifetime | String | - | String | - | 生命周期 | 采集数据的最大时长 | "P1D" | CSR配置 | 软件 |
MaxOccurrences | U32 | - | U32 | - | 最大次数 | 最大采集次数 | 10 | CSR配置 | 软件 |
RecurrenceInterval | String | - | String | - | 重复间隔 | 收集数据的时间间隔 | "PT10S" | CSR配置 | 软件 |
🔗 动态关联机制
语法规范
yaml
# 报告定义配置
Id: "AveragePowerReport"
Name: "Metric report of Average Power"
Description: "Metric report of Average Power"
MetricReportDefinitionType: "OnChange"
MetricReportDefinitionEnabled: true
ReportActions: ["LogToMetricReportsCollection", "RedfishEvent"]
Metrics: [{"CollectionDuration": "","CollectionFunction": "","CollectionTimeScope": "Interval","MetricId": "SystemPower"}]
# 可选配置
AppendLimit: 128
ReportUpdates: "AppendWrapsWhenFull"
InitialStartTime: 1894165900
Lifetime: "P1D"
MaxOccurrences: 5
RecurrenceInterval: "PT20S"关联说明
- Id: 唯一标识报告定义
- Metrics: 引用MetricDefinition中的指标
- ReportActions: 定义报告生成后的动作
- Schedule: 周期性报告的调度配置
📂 分类标准
硬件属性
- 定义:当前版本无硬件属性
- 特点:所有属性都是软件管理相关
- 示例:无
软件属性
- 定义:由软件管理和维护的报告定义参数
- 特点:报告配置、调度管理、采集控制等
- 示例:所有属性都是软件属性
📝 配置示例
OnChange报告定义
json
{
"MetricReportDefinition_SystemPowerReport": {
"Id": "SystemPowerReport",
"AppendLimit": 128,
"MetricReportDefinitionEnabled": false,
"MetricReportDefinitionType": "OnChange",
"Description": "Metric report of System Power",
"Metrics": [{
"CollectionDuration": "",
"CollectionFunction": "",
"CollectionTimeScope": "Interval",
"MetricId": "SystemPower"
}
],
"RecurrenceInterval": "PT5M",
"Name": "Metric report of System Power",
"ReportActions": ["LogToMetricReportsCollection", "RedfishEvent"],
"ReportUpdates": "AppendWrapsWhenFull"
}
}Periodic报告定义
json
{
"MetricReportDefinition_SystemPowerReport": {
"Id": "SystemPowerReport",
"AppendLimit": 128,
"MetricReportDefinitionEnabled": false,
"MetricReportDefinitionType": "Periodic",
"Description": "Metric report of System Power",
"Metrics": [{
"CollectionDuration": "",
"CollectionFunction": "",
"CollectionTimeScope": "Interval",
"MetricId": "SystemPower"
}
],
"RecurrenceInterval": "PT5M",
"Name": "Metric report of System Power",
"ReportActions": ["LogToMetricReportsCollection", "RedfishEvent"],
"ReportUpdates": "AppendWrapsWhenFull"
}
}OnRequest报告定义
json
{
"MetricReportDefinition_SystemPowerReport": {
"Id": "SystemPowerReport",
"AppendLimit": 128,
"MetricReportDefinitionEnabled": false,
"MetricReportDefinitionType": "OnRequest",
"Description": "Metric report of System Power",
"Metrics": [{
"CollectionDuration": "",
"CollectionFunction": "",
"CollectionTimeScope": "Interval",
"MetricId": "SystemPower"
}
],
"RecurrenceInterval": "PT5M",
"Name": "Metric report of System Power",
"ReportActions": ["LogToMetricReportsCollection", "RedfishEvent"],
"ReportUpdates": "AppendWrapsWhenFull"
}
}🔧 使用指南
配置步骤
- 设置基本信息:配置Id、Name、Description
- 设置报告类型:配置MetricReportDefinitionType
- 设置使能:配置MetricReportDefinitionEnabled
- 配置指标:配置Metrics列表
- 设置动作:配置ReportActions
- 配置限制:配置AppendLimit
- 配置调度:如果是Periodic类型,配置Schedule参数
报告类型说明
| 类型 | 说明 | 适用场景 |
|---|---|---|
| OnChange | 指标值变化时生成报告 | 状态变化监控 |
| OnRequest | 查询时生成报告 | 按需获取数据 |
| Periodic | 周期性生成报告 | 定期数据采集 |
时间间隔格式
间隔格式符合ISO 8601持续时间格式:
PT10S- 10秒PT1M- 1分钟PT1H- 1小时P1D- 1天P30D- 30天
使用场景
- 性能监控:定期采集CPU、内存性能数据
- 状态监控:监控设备状态变化
- 告警报告:配合Triggers生成告警报告
- 按需查询:根据需要获取当前系统状态
注意事项
- 报告容量:AppendLimit控制报告大小,避免占用过多存储
- 报告更新:ReportUpdates设置报告满时的处理方式
- 调度精度:RecurrenceInterval应根据实际需求设置
- 生命周期:Lifetime控制报告的有效期
- 指标关联:确保Metrics引用的MetricDefinition存在
- 使能控制:通过MetricReportDefinitionEnabled控制报告生成
故障排除
报告未生成:
- 检查MetricReportDefinitionEnabled是否为true
- 确认Metrics引用的指标是否有数据 -验证调度配置
报告丢失:
- 检查AppendLimit设置
- 确认ReportUpdates配置 -验证存储空间
采集异常:
- 检查RecurrenceInterval设置
- 确认Schedule参数 -验证指标状态