1318295d1SPiotr Matuszczak# OpenBMC platform telemetry 2318295d1SPiotr Matuszczak 3*f4febd00SPatrick WilliamsAuthor: Piotr Matuszczak <piotr.matuszczak@intel.com> 4318295d1SPiotr Matuszczak 5*f4febd00SPatrick WilliamsOther contributors: Pawel Rapkiewicz <pawel.rapkiewicz@intel.com> <pawelr>, 6318295d1SPiotr MatuszczakKamil Kowalski <kamil.kowalski@intel.com> 7318295d1SPiotr Matuszczak 8*f4febd00SPatrick WilliamsCreated: 2019-08-07 9318295d1SPiotr Matuszczak 10318295d1SPiotr Matuszczak## Problem Description 11*f4febd00SPatrick Williams 12*f4febd00SPatrick WilliamsThe BMC on server platform gathers lots of telemetry data, which has to be 13*f4febd00SPatrick Williamsexposed in clean, human readable and standardized format. This document focuses 14*f4febd00SPatrick Williamson telemetry over the Redfish, since it is standard API for platform 15*f4febd00SPatrick Williamsmanageability. 16318295d1SPiotr Matuszczak 17318295d1SPiotr Matuszczak## Background and References 18*f4febd00SPatrick Williams 19*f4febd00SPatrick Williams- OpenBMC platform telemetry shall leverage DMTF's [Redfish Telemetry Model][1] 20318295d1SPiotr Matuszczak for exposing platform telemetry over the network. 21*f4febd00SPatrick Williams- OpenBMC platform telemetry shall leverage the [OpenBMC sensors architecture 22*f4febd00SPatrick Williams implementation][2]. 23*f4febd00SPatrick Williams- OpenBMC platform telemetry shall implement a service, called Telemetry to deal 24a0364138SWludzik, Jozef with metrics report and trigger management. This service is described later in 25a0364138SWludzik, Jozef this document. 26*f4febd00SPatrick Williams- Although we use the [hwmon][3] to gather readings from physical sensors, this 27a0364138SWludzik, Jozef architecture does not depend on it, because the Telemetry service component 28318295d1SPiotr Matuszczak relies on the [OpenBMC D-Bus sensors][2]. 29318295d1SPiotr Matuszczak 30318295d1SPiotr Matuszczak## Requirements 31318295d1SPiotr Matuszczak 32*f4febd00SPatrick Williams- [OpenBMC D-Bus sensors][2] support. This is also design limitation, since the 33*f4febd00SPatrick Williams Telemetry service requires telemetry sources to be implemented as D-Bus 34*f4febd00SPatrick Williams sensors. 35318295d1SPiotr Matuszczak 36318295d1SPiotr Matuszczak## Proposed Design 37*f4febd00SPatrick Williams 38318295d1SPiotr MatuszczakRedfish Telemetry Model shall implement Telemetry Service with the following 39318295d1SPiotr Matuszczakcollection resources: 40*f4febd00SPatrick Williams 41*f4febd00SPatrick Williams- Metric Definitions - contains the metadata for metrics (unit, accuracy, etc.) 42*f4febd00SPatrick Williams- Metric Report Definitions - defines how metric report shall be created (which 43*f4febd00SPatrick Williams metrics it shall contain, how often it shall be generated etc.) 44*f4febd00SPatrick Williams- Metric Reports - contains actual metric reports containing telemetry data 45318295d1SPiotr Matuszczak generated according to the Metric Report Definitions 46*f4febd00SPatrick Williams- Metric Triggers - contains thresholds and actions that apply to specific 47318295d1SPiotr Matuszczak metrics 48318295d1SPiotr Matuszczak 49318295d1SPiotr MatuszczakOpenBMC telemetry architecture is shown on the diagram below. 50318295d1SPiotr Matuszczak 51318295d1SPiotr Matuszczak```ascii 52318295d1SPiotr Matuszczak +--------------+ +----------------+ +-----------------+ 53a0364138SWludzik, Jozef |hwmon| | |Dbus sensors| | |Telemetry| | 54a0364138SWludzik, Jozef +-----/ | +------------/ | +---------/ | 55a0364138SWludzik, Jozef | +--filesystem---> | | | 56318295d1SPiotr Matuszczak | | | | | | 57318295d1SPiotr Matuszczak +--------------+ +--------^-------+ +--------^--------+ 58318295d1SPiotr Matuszczak | | 59318295d1SPiotr Matuszczak | | 60318295d1SPiotr Matuszczak<------------------------------------------v-----^--DBus----------v-----------> 61318295d1SPiotr Matuszczak | 62318295d1SPiotr Matuszczak | 63318295d1SPiotr Matuszczak+-------+---------------------------------------------------------------------+ 64318295d1SPiotr Matuszczak|bmcweb | | | 65318295d1SPiotr Matuszczak+-------/ | | 66318295d1SPiotr Matuszczak| | | 67318295d1SPiotr Matuszczak| +--------+-------------------------------------v--------------------------+ | 68318295d1SPiotr Matuszczak| |Redfish | | | 69318295d1SPiotr Matuszczak| +--------/ +---------+-------+ | | 70318295d1SPiotr Matuszczak| | |Existing | | | | 71318295d1SPiotr Matuszczak| | +------------------------------------------------+ |Redfish | | | | 72318295d1SPiotr Matuszczak| | |Telemetry Service| | |resources| | | | 73318295d1SPiotr Matuszczak| | +----------------+/ | +---------/ | | | 74318295d1SPiotr Matuszczak| | | +----------+ +-----------+ +-------------+ | | +---------+ | | | 75318295d1SPiotr Matuszczak| | | | Metric | | Metric | |Metric report| | | | Redfish | | | | 76318295d1SPiotr Matuszczak| | | | triggers | |definitions| |definitions <---------+ sensors | | | | 77318295d1SPiotr Matuszczak| | | | | | | | | | | | | | | | 78318295d1SPiotr Matuszczak| | | +----+-----+ +-----+-----+ +------+------+ | | +---------+ | | | 79318295d1SPiotr Matuszczak| | | | | | | | | | | 80318295d1SPiotr Matuszczak| | | | | | | | | | | 81318295d1SPiotr Matuszczak| | | | | | | | | | | 82318295d1SPiotr Matuszczak| | | | +-----v-----+ | | | | | | 83318295d1SPiotr Matuszczak| | | | | Metric | | | | | | | 84318295d1SPiotr Matuszczak| | | +--------> report <---------+ | | | | | 85318295d1SPiotr Matuszczak| | | | | | | | | | 86318295d1SPiotr Matuszczak| | | +-----------+ | | | | | 87318295d1SPiotr Matuszczak| | | | | | | | 88318295d1SPiotr Matuszczak| | +------------------------------------------------+ +-----------------+ | | 89318295d1SPiotr Matuszczak| | | | 90318295d1SPiotr Matuszczak| +-------------------------------------------------------------------------+ | 91318295d1SPiotr Matuszczak| | 92318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 93318295d1SPiotr Matuszczak``` 94318295d1SPiotr Matuszczak 95318295d1SPiotr MatuszczakThe telemetry service component is a part of Redfish and implements the DMTF's 96318295d1SPiotr Matuszczak[Redfish Telemetry Model][1]. Metric report definitions uses Redfish sensors 97*f4febd00SPatrick WilliamsURIs for metric report creation. Those sensors are also used to get URI->D-Bus 98*f4febd00SPatrick Williamssensor mapping. Redfish Telemetry Service acts as presentation layer for the 99*f4febd00SPatrick Williamstelemetry, while Telemetry service is responsible for gathering metrics from 100*f4febd00SPatrick WilliamsD-Bus sensors and exposing them as D-Bus objects. Telemetry service supports 101*f4febd00SPatrick Williamsdifferent monitoring modes (periodic, on change and on demand) along with 102*f4febd00SPatrick Williamsaggregated operations: 103*f4febd00SPatrick Williams 104*f4febd00SPatrick Williams- SINGLE - current reading value 105*f4febd00SPatrick Williams- AVERAGE - average value over defined time period 106*f4febd00SPatrick Williams- MAX - max reading value during defined time period 107*f4febd00SPatrick Williams- MIN - min reading value during defined time period 108*f4febd00SPatrick Williams- SUM - sum of reading values over defined time period 109318295d1SPiotr Matuszczak 110434ff727SpmatuszcThe time period for calculating aggregated metric is taken from the Redfish 111434ff727SpmatuszcMetric Report Definition resource for each sensor's metric. 112318295d1SPiotr Matuszczak 113a0364138SWludzik, JozefTelemetry service supports creating and managing metric report, which may 114*f4febd00SPatrick Williamscontain single or multiple metrics from sensors. This metric report is mapped to 115*f4febd00SPatrick WilliamsMetric Report for the Redfish Telemetry Service. 116318295d1SPiotr Matuszczak 117318295d1SPiotr MatuszczakThe diagram below shows the flows for creation and update of metric report. 118318295d1SPiotr Matuszczak 119318295d1SPiotr Matuszczak```ascii 120a0364138SWludzik, Jozef+----+ +------+ +---------+ +-------+ 121a0364138SWludzik, Jozef|User| |bmcweb| |Telemetry| | D-Bus | 122a0364138SWludzik, Jozef+-+--+ +--+---+ +----+----+ |Sensors| 123a0364138SWludzik, Jozef | | | +---+---+ 124318295d1SPiotr Matuszczak | | | | 125318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 126318295d1SPiotr Matuszczak|Metric report definition flow| | | | 127318295d1SPiotr Matuszczak+-----------------------------+ | | | 128318295d1SPiotr Matuszczak| | | | | | 129318295d1SPiotr Matuszczak| | | | | | 130318295d1SPiotr Matuszczak| | POST request | | | | 131318295d1SPiotr Matuszczak| | with metric | | | | 132318295d1SPiotr Matuszczak| | report | | | | 133318295d1SPiotr Matuszczak| | definition | | | | 134318295d1SPiotr Matuszczak| +--------------------> Invoke AddReport | Register for D-Bus | | 135318295d1SPiotr Matuszczak| | | method on D-Bus | sensors | | 136318295d1SPiotr Matuszczak| | +-----------------------> PropertiesChanged | | 137318295d1SPiotr Matuszczak| | | | signals | | 138318295d1SPiotr Matuszczak| | | +--------------------------> | 139318295d1SPiotr Matuszczak| | | |--------------------------> | 140318295d1SPiotr Matuszczak| | | +--------------------------> | 141318295d1SPiotr Matuszczak| | | | | | 142318295d1SPiotr Matuszczak| | HTTP response | +-+Create Report | | 143318295d1SPiotr Matuszczak| | code 201 with | Return created | |D-Bus object | | 144318295d1SPiotr Matuszczak| | Metric Report | Report D-Bus path <-+ | | 145318295d1SPiotr Matuszczak| | Definition's URI <-----------------------+ | | 146318295d1SPiotr Matuszczak| <--------------------+ | | | 147318295d1SPiotr Matuszczak| | | | | | 148318295d1SPiotr Matuszczak| | | | | | 149318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 150318295d1SPiotr Matuszczak | | | | 151318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 152318295d1SPiotr Matuszczak|Periodic metric report update flow| | | | 153318295d1SPiotr Matuszczak+----------------------------------+ +-+Metric report | | 154318295d1SPiotr Matuszczak| | | | |timer triggers | | 155318295d1SPiotr Matuszczak| | | <-+report update | | 156318295d1SPiotr Matuszczak| | | | | | 157318295d1SPiotr Matuszczak+----------------------------------Optional-----------------------------------+ 158318295d1SPiotr Matuszczak| | | | | | 159318295d1SPiotr Matuszczak| | Send report as SSE or push-style event | | | 160318295d1SPiotr Matuszczak| | using Redfish Event Service (not shown | | | 161318295d1SPiotr Matuszczak| | here) if configured to do so. | | | 162318295d1SPiotr Matuszczak| <--------------------------------------------+ | | 163318295d1SPiotr Matuszczak| | | | | | 164318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 165318295d1SPiotr Matuszczak| | GET on Metric | | | | 166318295d1SPiotr Matuszczak| | Report URI | | Sensor's Properties- | | 167318295d1SPiotr Matuszczak| +--------------------> | Changed signal | | 168318295d1SPiotr Matuszczak| | +-+Map report's URI <--------------------------+ | 169318295d1SPiotr Matuszczak| | | |to D-Bus path | | | 170318295d1SPiotr Matuszczak| | <-+ | +----------------------+ | | 171318295d1SPiotr Matuszczak| | | Invoke GetAll method | |Note that sensor's | | | 172318295d1SPiotr Matuszczak| | | on report D-Bus | |PropertiesChanged | | | 173318295d1SPiotr Matuszczak| | | object | |signal is asynchronous| | | 174318295d1SPiotr Matuszczak| | +-----------------------> |to metric report timer| | | 175318295d1SPiotr Matuszczak| | | | |This timer is the only| | | 176318295d1SPiotr Matuszczak| | Return metric | Return report data | |thing that triggers | | | 177318295d1SPiotr Matuszczak| | report in JSON <-----------------------+ |metric report update | | | 178318295d1SPiotr Matuszczak| | format | | +----------------------+ | | 179318295d1SPiotr Matuszczak| <--------------------+ | | | 180318295d1SPiotr Matuszczak| | | | | | 181318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 182318295d1SPiotr Matuszczak | | | | 183318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 184318295d1SPiotr Matuszczak|On change metric report update flow| | Sensor's Properties- | | 185318295d1SPiotr Matuszczak+-----------------------------------+ | Changed signal | | 186318295d1SPiotr Matuszczak| | | <--------------------------+ | 187318295d1SPiotr Matuszczak| | | | | | 188318295d1SPiotr Matuszczak| | | +-+Sensor's signal | | 189318295d1SPiotr Matuszczak| | | | |triggers report | | 190318295d1SPiotr Matuszczak| | | <-+update | | 191318295d1SPiotr Matuszczak| | | | | | 192318295d1SPiotr Matuszczak+----------------------------------Optional-----------------------------------+ 193318295d1SPiotr Matuszczak| | | | | | 194318295d1SPiotr Matuszczak| | Send report as SSE or push-style event | | | 195318295d1SPiotr Matuszczak| | using Redfish Event Service (not shown | | | 196318295d1SPiotr Matuszczak| | here) if configured to do so. | | | 197318295d1SPiotr Matuszczak| <--------------------------------------------+ | | 198318295d1SPiotr Matuszczak| | | | | | 199318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 200318295d1SPiotr Matuszczak| | GET on Metric | | | | 201318295d1SPiotr Matuszczak| | Report URI | | | | 202318295d1SPiotr Matuszczak| +--------------------> | | | 203318295d1SPiotr Matuszczak| | +-+Map report's URI | | | 204318295d1SPiotr Matuszczak| | | |to D-Bus path | +----------------------+ | | 205318295d1SPiotr Matuszczak| | <-+ | |Note that sensor's | | | 206318295d1SPiotr Matuszczak| | | Invoke GetAll method | |PropertiesChanged | | | 207318295d1SPiotr Matuszczak| | | on report D-Bus | |signal triggers the | | | 208318295d1SPiotr Matuszczak| | | object | |report update. It is | | | 209318295d1SPiotr Matuszczak| | +-----------------------> |sufficient that the | | | 210318295d1SPiotr Matuszczak| | | | |signal from only one | | | 211318295d1SPiotr Matuszczak| | Return metric | Return report data | |sensor triggers report| | | 212318295d1SPiotr Matuszczak| | report in JSON <-----------------------+ |update. | | | 213318295d1SPiotr Matuszczak| | format | | +----------------------+ | | 214318295d1SPiotr Matuszczak| <--------------------+ | | | 215318295d1SPiotr Matuszczak| | | | | | 216318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 217318295d1SPiotr Matuszczak | | | | 218318295d1SPiotr Matuszczak+-+--------------------+------------------------------------------------------+ 219318295d1SPiotr Matuszczak|On demand metric report update flow| | | | 220318295d1SPiotr Matuszczak+-+--------------------+------------+ | | | 221318295d1SPiotr Matuszczak| | | | | | 222318295d1SPiotr Matuszczak| | GET on Metric | | | | 223318295d1SPiotr Matuszczak| | Report URI | | | | 224318295d1SPiotr Matuszczak| +--------------------> | | | 225318295d1SPiotr Matuszczak| | +-+Map report's URI | | | 226318295d1SPiotr Matuszczak| | | |to D-Bus path | | | 227318295d1SPiotr Matuszczak| | <-+ | | | 228318295d1SPiotr Matuszczak| | | | | | 229318295d1SPiotr Matuszczak| | | Invoke the Update | | | 230318295d1SPiotr Matuszczak| | | method for report | | | 231434ff727Spmatuszc| | | D-Bus object | | | 232318295d1SPiotr Matuszczak| | +-----------------------> | | 233318295d1SPiotr Matuszczak| | | +-+Update method triggers | | 234318295d1SPiotr Matuszczak| | | | |report to be updated | | 235318295d1SPiotr Matuszczak| | | | |with the latest known | | 236318295d1SPiotr Matuszczak| | | | |sensor's readings. | | 237318295d1SPiotr Matuszczak| | | | |No additional sensor | | 238318295d1SPiotr Matuszczak| | | <-+readings are performed. | | 239318295d1SPiotr Matuszczak+----------------------------------Optional-----------------------------------+ 240318295d1SPiotr Matuszczak| | | | | | 241318295d1SPiotr Matuszczak| | Send report as SSE or push-style event | | | 242318295d1SPiotr Matuszczak| | using Redfish Event Service (not shown | | | 243318295d1SPiotr Matuszczak| | here) if configured to do so. | | | 244318295d1SPiotr Matuszczak| <--------------------------------------------+ | | 245318295d1SPiotr Matuszczak| | | | | | 246318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 247318295d1SPiotr Matuszczak| | | Update method call | | | 248318295d1SPiotr Matuszczak| | | result | | | 249318295d1SPiotr Matuszczak| | <-----------------------+ | | 250318295d1SPiotr Matuszczak| | | | | | 251318295d1SPiotr Matuszczak| | | Invoke GetAll method | | | 252318295d1SPiotr Matuszczak| | | on report D-Bus | | | 253318295d1SPiotr Matuszczak| | | object | | | 254318295d1SPiotr Matuszczak| | +-----------------------> | | 255318295d1SPiotr Matuszczak| | | | | | 256318295d1SPiotr Matuszczak| | Return metric | Return report data | | | 257318295d1SPiotr Matuszczak| | report in JSON <-----------------------+ | | 258318295d1SPiotr Matuszczak| | format | | | | 259318295d1SPiotr Matuszczak| <--------------------+ | | | 260318295d1SPiotr Matuszczak| | | | | | 261318295d1SPiotr Matuszczak+-----------------------------------------------------------------------------+ 262318295d1SPiotr Matuszczak | | | | 263318295d1SPiotr Matuszczak``` 264318295d1SPiotr Matuszczak 265*f4febd00SPatrick WilliamsThe Redfish implementation in bmcweb is stateless, thus it is not able to store 266*f4febd00SPatrick Williamsmetric reports. All operations on metric reports shall be done in the Telemetry 267*f4febd00SPatrick Williamsservice. Sending metric report as SSE or push-style events shall be done via the 268*f4febd00SPatrick Williams[Redfish Event Service][6]. It is marked as optional because metric report does 269*f4febd00SPatrick Williamsnot have to be configured for pushing its data through the event. 270318295d1SPiotr Matuszczak 271a0364138SWludzik, JozefIn case of on demand metric report update, Telemetry service performs no 272*f4febd00SPatrick Williamsadditional sensor readings because it already has the latest values, since they 273*f4febd00SPatrick Williamsare updated on PropertiesChanged signal from the D-Bus sensors. 274318295d1SPiotr Matuszczak 275a0364138SWludzik, Jozef**Telemetry service on [D-Bus][4]** 276318295d1SPiotr Matuszczak 277*f4febd00SPatrick WilliamsTelemetry service exposes specific interfaces on D-Bus. One of them will be used 278*f4febd00SPatrick Williamsfor reading report management. The second one will be used for triggers 279318295d1SPiotr Matuszczakmanagement. 280318295d1SPiotr Matuszczak 281318295d1SPiotr Matuszczak**Reading report management** 282318295d1SPiotr Matuszczak 283318295d1SPiotr MatuszczakThe reading report management D-Bus object: 284318295d1SPiotr Matuszczak 285318295d1SPiotr Matuszczak```ascii 286434ff727Spmatuszcxyz.openbmc_project.Telemetry.ReportManager 287a0364138SWludzik, Jozef/xyz/openbmc_project/Telemetry/Reports 288318295d1SPiotr Matuszczak``` 289*f4febd00SPatrick Williams 290434ff727SpmatuszcThe `ReportManager` implements D-Bus interface 291434ff727Spmatuszc[`xyz.openbmc_project.Telemetry.ReportManager`][8] for report management. The 292434ff727Spmatuszcinterface is described in the phosphor-dbus-interfaces. This interface 293434ff727Spmatuszcimplements `AddReport` method, which is used to create a metric report. The 294434ff727Spmatuszcreport may contain a single or multiple sensor readings. The way how the report 295*f4febd00SPatrick Williamswill be stored by the BMC is defined by one of this method's parameters. The 296*f4febd00SPatrick Williams`ReportManager` object implements property that stores the maximum number of 297*f4febd00SPatrick Williamsreports supported simultaneously. 298318295d1SPiotr Matuszczak 299*f4febd00SPatrick WilliamsThe `AddReport` method returns the path to the newly created report object. The 300*f4febd00SPatrick Williamsreport object implements the [`xyz.openbmc_project.Object.Delete`][10] and 301*f4febd00SPatrick Williams[`xyz.openbmc_project.Telemetry.Report`][9] interfaces. The [`Delete`][10] 302434ff727Spmatuszcinterface is defined to add support for removing Report object, while the 303*f4febd00SPatrick Williams[`Report`][9] interface implements methods and properties for Report management 304*f4febd00SPatrick Williamsalong with properties containing telemetry readings. Each report object contains 305*f4febd00SPatrick Williamsthe timestamp of its last update. The report object contains an array of 306*f4febd00SPatrick Williamsstructures containing reading with its metadata and timestamp of last update of 307*f4febd00SPatrick Williamsthis metric. Each report has also the property that stores update interval (for 308*f4febd00SPatrick Williamsperiodically updated reports). 309318295d1SPiotr Matuszczak 310318295d1SPiotr Matuszczak**Trigger management** 311318295d1SPiotr Matuszczak 312318295d1SPiotr MatuszczakThe trigger management D-Bus object: 313318295d1SPiotr Matuszczak 314318295d1SPiotr Matuszczak```ascii 315434ff727Spmatuszcxyz.openbmc_project.Telemetry.TriggerManager 316a0364138SWludzik, Jozef/xyz/openbmc_project/Telemetry/Triggers 317318295d1SPiotr Matuszczak``` 318*f4febd00SPatrick Williams 319*f4febd00SPatrick WilliamsThe `TriggerManager` supports the `xyz.openbmc_project.Telemetry.TriggerManager` 320*f4febd00SPatrick Williamsinterface, which implements the `AddTrigger` method. This method shall be used 321*f4febd00SPatrick Williamsto create new trigger for the certain metric. The method's parameters allow to 322*f4febd00SPatrick Williamsdefine the type of metric for which trigger is set (discrete or numeric). Depend 323*f4febd00SPatrick Williamson this setting, this method accepts different set of trigger parameters. 324318295d1SPiotr Matuszczak 325434ff727SpmatuszcFor discrete metric type, trigger parameters contain: 326318295d1SPiotr Matuszczak 327318295d1SPiotr Matuszczak| Field | Type | Description | 328*f4febd00SPatrick Williams| ---------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 329434ff727Spmatuszc| TriggerCondition | enum | Discrete trigger condition: <br> "Changed" - trigger occurs when value of metric has changed; <br> "Specified" - trigger occurs when value of metric becomes one of the values listed in the discrete triggers. | 330318295d1SPiotr Matuszczak| DiscreteTriggers | array of structures | Array of discrete trigger structures. | 331318295d1SPiotr Matuszczak 332318295d1SPiotr MatuszczakMember of DiscreteTriggers array: 333318295d1SPiotr Matuszczak 334318295d1SPiotr Matuszczak| Field | Type | Description | 335*f4febd00SPatrick Williams| --------- | ------- | ---------------------------------------------------------------------------------------------------------------- | 336318295d1SPiotr Matuszczak| TriggerId | string | Unique trigger Id | 337434ff727Spmatuszc| Severity | enum | Severity: <br> "OK" - normal<br> "Warning" - requires attention<br> "Critical" - requires immediate attention | 338318295d1SPiotr Matuszczak| Value | variant | Value of discrete metric, that constitutes a trigger event. | 339434ff727Spmatuszc| DwellTime | uint64 | Time in milliseconds that a trigger occurrence persists before the action defined for this trigger is performed. | 340318295d1SPiotr Matuszczak 341*f4febd00SPatrick WilliamsFor numeric metric type, trigger parameters contain numeric thresholds. Numeric 342*f4febd00SPatrick Williamsthresholds structure shall contain up to 4 thresholds: upper warning, upper 343*f4febd00SPatrick Williamscritical, lower warning and lower critical. Thus it will contain up to 4 344*f4febd00SPatrick Williamsstructures shown below: 345318295d1SPiotr Matuszczak 346318295d1SPiotr Matuszczak| Field | Type | Description | 347*f4febd00SPatrick Williams| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 348434ff727Spmatuszc| ThresholdType | enum | Numeric trigger type: <br> "UpperCritical" - reading is above normal range and requires immediate attention<br>"UpperWarning" - reading is above normal range and may require attention<br>"LowerCritical" - reading is below normal range and requires immediate attention<br>"LowerWarning" - reading is below normal range and may require attention | 349434ff727Spmatuszc| DwellTime | uint64 | Time in milliseconds that a trigger occurrence persists before the action defined for this trigger is performed. | 350434ff727Spmatuszc| Activation | enum | Indicates direction of crossing the threshold value that trigger the threshold's action:<br> "Increasing" - trigger action when reading is changing from below to above the threshold's value<br> "Decreasing" - trigger action when reading is changing from above to below the threshold's value<br> "Either" - trigger action when reading is crossing the threshold's value in either direction described above | 351318295d1SPiotr Matuszczak| ThresholdValue | variant | Value of reading that will trigger the threshold | 352318295d1SPiotr Matuszczak 353434ff727SpmatuszcThe `AddTrigger` method also allows to define the specific action when trigger 354434ff727Spmatuszcis activated. Upon the trigger activation, three possible actions are allowed, 355*f4febd00SPatrick Williamslogging event to log service, sending event via event service and triggering the 356*f4febd00SPatrick Williamsmetric report update. 357318295d1SPiotr Matuszczak 358434ff727SpmatuszcIn order to assign trigger to specific metric, the metric parameter is defined. 359434ff727SpmatuszcIts structure contains the following data: 360318295d1SPiotr Matuszczak 361318295d1SPiotr Matuszczak| Field | Type | Description | 362*f4febd00SPatrick Williams| ---------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 363318295d1SPiotr Matuszczak| SensorPath | object path | D-Bus path to sensor, for which trigger is defined. | 364318295d1SPiotr Matuszczak| MetricId | string | Contains unique metric id, that can be mapped to Redfish MetricId. | 365434ff727Spmatuszc| ReportPath | object path | D-Bus path to Telemetry's reading report which update shall be triggered when trigger condition occurs. This is optional and shall be filled when trigger's action is set to update metric report. | 366318295d1SPiotr Matuszczak 367434ff727SpmatuszcThe `AddTrigger` method also allows to set trigger's persistency (whether 368434ff727Spmatuszctrigger shall be stored in the BMC's non-volatile memory). 369434ff727Spmatuszc 370434ff727SpmatuszcThe `AddTrigger` method returns: 371*f4febd00SPatrick Williams 372318295d1SPiotr Matuszczak```ascii 373434ff727SpmatuszcString for created trigger - ie. '/xyz/openbmc_project/Telemetry/Triggers/{Domain}/{Name}' 374318295d1SPiotr Matuszczak``` 375*f4febd00SPatrick Williams 376*f4febd00SPatrick WilliamsSuch created trigger implements the `xyz.openbmc_project.Object.Delete` and the 377*f4febd00SPatrick Williams`xyz.openbmc_project.Telemetry.Trigger` interfaces. Each trigger object contains 378*f4febd00SPatrick Williamsread-only information about metric type, for which it was created (discrete or 379*f4febd00SPatrick Williamsnumeric). This information determines which triggers are stored within trigger 380*f4febd00SPatrick Williamsobject. 381318295d1SPiotr Matuszczak 382434ff727SpmatuszcIf trigger is defined for discrete metric type, than it contains trigger 383434ff727Spmatuszcinformation that looks like this: 384318295d1SPiotr Matuszczak 385318295d1SPiotr Matuszczak| Type | Description | 386*f4febd00SPatrick Williams| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 387434ff727Spmatuszc| enum | Discrete trigger condition: <br> "Changed" - trigger occurs when value of metric has changed;<br>"Specified" - trigger occurs when value of metric becomes one of the values listed in the discrete triggers. | 388318295d1SPiotr Matuszczak| array of structures | Array of discrete trigger structures. | 389318295d1SPiotr Matuszczak 390434ff727SpmatuszcDiscrete trigger structure: 391318295d1SPiotr Matuszczak 392318295d1SPiotr Matuszczak| Type | Description | 393*f4febd00SPatrick Williams| ------- | ------------------------------------------------------------------------------------------------------------------- | 394318295d1SPiotr Matuszczak| string | Unique trigger Id | 395434ff727Spmatuszc| enum | Severity: <br> "OK" - normal<br>"Warning" - requires attention<br> "Critical" - requires immediate attention | 396318295d1SPiotr Matuszczak| variant | Value of discrete metric, that constitutes a trigger event. | 397*f4febd00SPatrick Williams| uint64 | Time in milliseconds that a trigger occurrence persists before the action defined in the `ActionType` is performed. | 398318295d1SPiotr Matuszczak 399434ff727SpmatuszcIf trigger is defined for numeric metric type, than it contains information 400434ff727Spmatuszcabout numeric triggers that is an array of 4 structures presented below: 401318295d1SPiotr Matuszczak 402318295d1SPiotr Matuszczak| Type | Description | 403*f4febd00SPatrick Williams| ------- | ------------------------------------------------------------------------------------------------------------------------------------- | 404434ff727Spmatuszc| enum | Numeric trigger type: <br> "UpperWarning"<br>"UpperWarning"<br>"LowerCritical"<br>"LowerWarning" | 405*f4febd00SPatrick Williams| uint64 | Time in milliseconds that a trigger occurrence persists before the action defined in the `ActionType` is performed. | 406434ff727Spmatuszc| enum | Indicates direction of crossing the threshold value that trigger the threshold's action:<br> "Increasing"<br>"Decreasing"<br>"Either" | 407318295d1SPiotr Matuszczak| variant | Value of reading that will trigger the threshold | 408318295d1SPiotr Matuszczak 409434ff727SpmatuszcThe trigger object also contains information about reading, for which trigger 410434ff727Spmatuszcwas defined. It is in a form of structure consisting of three fields. 411318295d1SPiotr Matuszczak 412318295d1SPiotr Matuszczak| Field type | Description | 413*f4febd00SPatrick Williams| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 414318295d1SPiotr Matuszczak| object path | D-Bus path of sensor. This is a path to the sensor, for which reading trigger is defined. | 415318295d1SPiotr Matuszczak| string | Unique metric Id | 416a0364138SWludzik, Jozef| object path | D-Bus path of existing reading report. This is required when trigger's action is to update metric report. This path shall point to existing reading report within the Telemetry service. | 417318295d1SPiotr Matuszczak 418318295d1SPiotr Matuszczak**Trigger operations** 419318295d1SPiotr Matuszczak 420318295d1SPiotr MatuszczakTriggers support three types of operation: Log, Event and Update. For each, 421318295d1SPiotr Matuszczakthere is a different way of proceeding. 422318295d1SPiotr Matuszczak 423*f4febd00SPatrick Williams1. For action Log, the event shall be logged to the system journal. In this case 424*f4febd00SPatrick Williams the Telemetry service writes data to system journal using libjournal. The 425*f4febd00SPatrick Williams Redfish log service shall then retrieve the data by reading system journal. 426*f4febd00SPatrick Williams All is shown on the diagram below. 427318295d1SPiotr Matuszczak 428318295d1SPiotr Matuszczak```ascii 429318295d1SPiotr Matuszczak+---------------------------+ 430318295d1SPiotr Matuszczak|bmcweb| | +----------------------+ 431a0364138SWludzik, Jozef+------/ +-----------+-+ | |Telemetry| | 432a0364138SWludzik, Jozef| |Redfish | | | +---------/ | 433a0364138SWludzik, Jozef| |log service| | | | | 434318295d1SPiotr Matuszczak| +-----------/ | | | | 435318295d1SPiotr Matuszczak| | | | | | 436318295d1SPiotr Matuszczak| | | | | | 437318295d1SPiotr Matuszczak| +------^------+ | +-----------+----------+ 438318295d1SPiotr Matuszczak+---------------------------+ | 439318295d1SPiotr Matuszczak | | 440318295d1SPiotr Matuszczak +----collect----+ event 441318295d1SPiotr Matuszczak journal entry | (write to journal) 442318295d1SPiotr Matuszczak | | 443318295d1SPiotr Matuszczak +------------------------------------+ | 444318295d1SPiotr Matuszczak |systemd| | | | 445318295d1SPiotr Matuszczak +-------/ +----------+ +---+------+ | | 446318295d1SPiotr Matuszczak | |journal| | |libjournal| | | 447318295d1SPiotr Matuszczak | +-------/ <--> <-------+ 448318295d1SPiotr Matuszczak | | | +----------+ | 449318295d1SPiotr Matuszczak | | | | 450318295d1SPiotr Matuszczak | | | | 451318295d1SPiotr Matuszczak | +----------+ | 452318295d1SPiotr Matuszczak | | 453318295d1SPiotr Matuszczak +------------------------------------+ 454318295d1SPiotr Matuszczak``` 455*f4febd00SPatrick Williams 456*f4febd00SPatrick Williams2. For action Event, the Telemetry service shall send event using the [Redfish 457*f4febd00SPatrick Williams Event Service][6] either as push-style event or SSE. 458318295d1SPiotr Matuszczak 459a0364138SWludzik, Jozef3. For action Update, the Telemetry service will trigger the update of reading 460434ff727Spmatuszc report pointed by it's D-Bus path contained in trigger object properties. The 461434ff727Spmatuszc update shall cause the reading report's D-Bus object to emit property change 462434ff727Spmatuszc signal. This will cause Redfish Metric Report to be streamed out if it was 463434ff727Spmatuszc configured to do so. 464318295d1SPiotr Matuszczak 465a0364138SWludzik, Jozef**Redfish Telemetry Service API** 466318295d1SPiotr Matuszczak 467a0364138SWludzik, JozefRedfish Telemetry Service shall support 2019.1 Redfish schemas for telemetry 468a0364138SWludzik, Jozefresources. Metric report definitions determines which metrics are to be include 469a0364138SWludzik, Jozefin metric report. Metric definition is assigned to particular metric type and it 470318295d1SPiotr Matuszczakdescribes how the metric should be interpreted. The following resource schemas 471318295d1SPiotr Matuszczakshall be supported: 472318295d1SPiotr Matuszczak 473318295d1SPiotr Matuszczak- TelemetryService 1.1.2 474318295d1SPiotr Matuszczak- MetricDefinition 1.0.3 475318295d1SPiotr Matuszczak- MetricReportDefinition 1.3.0 476318295d1SPiotr Matuszczak- MetricReport 1.2.0 477318295d1SPiotr Matuszczak- Triggers 1.1.1 478318295d1SPiotr Matuszczak 479318295d1SPiotr MatuszczakThe following diagram shows relations between these resources. 480318295d1SPiotr Matuszczak 481318295d1SPiotr Matuszczak```ascii 482318295d1SPiotr Matuszczak +----------------------------------------------------------------------------+ 483318295d1SPiotr Matuszczak | Service root | 484318295d1SPiotr Matuszczak +----------------------------------+-------------------------------+---------+ 485318295d1SPiotr Matuszczak | | 486318295d1SPiotr Matuszczak | | 487318295d1SPiotr Matuszczak | | 488318295d1SPiotr Matuszczak +----------------------------------v-----------------+ +----------v---------+ 489318295d1SPiotr Matuszczak | | |Chassis | 490318295d1SPiotr Matuszczak | Telemetry Service | | | 491318295d1SPiotr Matuszczak | | | | 492318295d1SPiotr Matuszczak | | | +---------------+ | 493318295d1SPiotr Matuszczak +---------+--------------+------------------+--------+ | | | | 494318295d1SPiotr Matuszczak | | | | | Chassis 1 | | 495318295d1SPiotr Matuszczak | | | | | | | 496318295d1SPiotr Matuszczak | | | | +---------+-----+ | 497318295d1SPiotr Matuszczak | | | | | | 498318295d1SPiotr Matuszczak+----------v--+ +--------v----+ +----------v-----+ +--------------------+ 499318295d1SPiotr Matuszczak|Triggers | |Metric | |Metric report | | 500318295d1SPiotr Matuszczak| | |definition | | | | 501318295d1SPiotr Matuszczak| | | +---------+ | | | Reads | 502318295d1SPiotr Matuszczak| +---------+ | | |Reading | | | +-----------+ | ReadingVolts +--v------+ 503318295d1SPiotr Matuszczak| | | | | |Volts <------+ +------------------> | 504318295d1SPiotr Matuszczak| |Trigger 1| | | +---------+ | | | Metric | | | | 505318295d1SPiotr Matuszczak| | | | | | | | report 1 | | Reads | Power | 506318295d1SPiotr Matuszczak| | | | | +---------+ | | | | | PowerConsumed | | 507318295d1SPiotr Matuszczak| | | | | | | | | | | | Watts | | 508318295d1SPiotr Matuszczak| +--+---+--+ | | |Power <------+ +------------------> | 509318295d1SPiotr Matuszczak| | | | | |Consumed | | | +-----^-----+ | +----^----+ 510318295d1SPiotr Matuszczak| | | | | |Watts | | | | | | 511318295d1SPiotr Matuszczak| | | | | +---------+ | | | | | 512318295d1SPiotr Matuszczak| | | | | | | | | | 513318295d1SPiotr Matuszczak+-------------+ +-------------+ +----------------+ | 514318295d1SPiotr Matuszczak | | | | 515318295d1SPiotr Matuszczak | | Triggers report update | | 516318295d1SPiotr Matuszczak | | (when applicable) | | 517318295d1SPiotr Matuszczak | +--------------------------------+ | 518318295d1SPiotr Matuszczak | | 519318295d1SPiotr Matuszczak | Monitors PowerConsumedWatts to check | 520318295d1SPiotr Matuszczak | whether trigger value is exceeded | 521318295d1SPiotr Matuszczak +------------------------------------------------------------------+ 522318295d1SPiotr Matuszczak``` 523318295d1SPiotr Matuszczak 524318295d1SPiotr MatuszczakThe diagram shows the relations between Redfish resources. Metric report is 525318295d1SPiotr Matuszczakdefined to be generated periodically, on demand or on change. Each metric in the 526318295d1SPiotr MatuszczakMetric Report contains the URI to its metric definition and Redfish sensor, 527318295d1SPiotr Matuszczakwhich reading value is presented. Nevertheless, under this presentation layer, 528*f4febd00SPatrick WilliamsTelemetry is gathering D-Bus sensors readings and exposing them in reading 529*f4febd00SPatrick Williamsreports over D-Bus for the Telemetry Service. Each D-Bus sensor is mapped to 530*f4febd00SPatrick WilliamsRedfish sensor. 531318295d1SPiotr Matuszczak 532318295d1SPiotr MatuszczakBelow examples of Redfish resources for the Telemetry Service are shown. 533318295d1SPiotr Matuszczak 534a0364138SWludzik, JozefThe Telemetry Service Redfish resource example: 535318295d1SPiotr Matuszczak 536318295d1SPiotr Matuszczak```json 537318295d1SPiotr Matuszczak{ 538318295d1SPiotr Matuszczak "@odata.type": "#TelemetryService.v1_1_2.TelemetryService", 539318295d1SPiotr Matuszczak "Id": "TelemetryService", 540318295d1SPiotr Matuszczak "Name": "Telemetry Service", 541318295d1SPiotr Matuszczak "Status": { 542318295d1SPiotr Matuszczak "State": "Enabled", 543318295d1SPiotr Matuszczak "Health": "OK" 544318295d1SPiotr Matuszczak }, 545318295d1SPiotr Matuszczak "MinCollectionInterval": "T00:00:10s", 546318295d1SPiotr Matuszczak "SupportedCollectionFunctions": [], 547318295d1SPiotr Matuszczak "MaxReports": <max_no_of_reports>, 548318295d1SPiotr Matuszczak "MetricDefinitions": { 549318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions" 550318295d1SPiotr Matuszczak }, 551318295d1SPiotr Matuszczak "MetricReportDefinitions": { 552318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions" 553318295d1SPiotr Matuszczak }, 554318295d1SPiotr Matuszczak "MetricReports": { 555318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/MetricReports" 556318295d1SPiotr Matuszczak }, 557318295d1SPiotr Matuszczak "Triggers": { 558318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/Triggers" 559318295d1SPiotr Matuszczak }, 560318295d1SPiotr Matuszczak "LogService": { 561318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/Managers/<manager_name>/LogServices/Journal" 562318295d1SPiotr Matuszczak }, 563318295d1SPiotr Matuszczak "@odata.context": "/redfish/v1/$metadata#TelemetryService", 564318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService" 565318295d1SPiotr Matuszczak} 566318295d1SPiotr Matuszczak``` 567318295d1SPiotr Matuszczak 568318295d1SPiotr MatuszczakSample metric report definition: 569318295d1SPiotr Matuszczak 570318295d1SPiotr Matuszczak```json 571318295d1SPiotr Matuszczak{ 572318295d1SPiotr Matuszczak "@odata.type": "#MetricReportDefinition.v1_3_0.MetricReportDefinition", 573318295d1SPiotr Matuszczak "Id": "SampleMetric", 574318295d1SPiotr Matuszczak "Name": "Sample Metric Report Definition", 575318295d1SPiotr Matuszczak "MetricReportDefinitionType": "Periodic", 576318295d1SPiotr Matuszczak "Schedule": { 577318295d1SPiotr Matuszczak "RecurrenceInterval": "T00:00:10" 578318295d1SPiotr Matuszczak }, 579*f4febd00SPatrick Williams "ReportActions": ["LogToMetricReportsCollection"], 580318295d1SPiotr Matuszczak "ReportUpdates": "Overwrite", 581318295d1SPiotr Matuszczak "MetricReport": { 582318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/MetricReports/SampleMetric" 583318295d1SPiotr Matuszczak }, 584318295d1SPiotr Matuszczak "Status": { 585318295d1SPiotr Matuszczak "State": "Enabled" 586318295d1SPiotr Matuszczak }, 587318295d1SPiotr Matuszczak "Metrics": [ 588318295d1SPiotr Matuszczak { 589318295d1SPiotr Matuszczak "MetricId": "Test", 590318295d1SPiotr Matuszczak "MetricProperties": [ 591318295d1SPiotr Matuszczak "/redfish/v1/Chassis/NC_Baseboard/Power#/PowerControl/0/PowerConsumedWatts" 592318295d1SPiotr Matuszczak ] 593318295d1SPiotr Matuszczak } 594318295d1SPiotr Matuszczak ], 595318295d1SPiotr Matuszczak "@odata.context": "/redfish/v1/$metadata#MetricReportDefinition.MetricReportDefinition", 596318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/PlatformPowerUsage" 597318295d1SPiotr Matuszczak} 598318295d1SPiotr Matuszczak``` 599318295d1SPiotr Matuszczak 600318295d1SPiotr MatuszczakSample metric report: 601318295d1SPiotr Matuszczak 602318295d1SPiotr Matuszczak```json 603318295d1SPiotr Matuszczak{ 604318295d1SPiotr Matuszczak "@odata.type": "#MetricReport.v1_2_0.MetricReport", 605318295d1SPiotr Matuszczak "Id": "SampleMetric", 606318295d1SPiotr Matuszczak "Name": "Sample Metric Report", 607318295d1SPiotr Matuszczak "ReportSequence": "0", 608318295d1SPiotr Matuszczak "MetricReportDefinition": { 609318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/SampleMetric" 610318295d1SPiotr Matuszczak }, 611318295d1SPiotr Matuszczak "MetricValues": [ 612318295d1SPiotr Matuszczak { 613318295d1SPiotr Matuszczak "MetricDefinition": { 614318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/SampleMetricDefinition" 615318295d1SPiotr Matuszczak }, 616318295d1SPiotr Matuszczak "MetricId": "Test", 617318295d1SPiotr Matuszczak "MetricValue": "100", 618318295d1SPiotr Matuszczak "Timestamp": "2016-11-08T12:25:00-05:00", 619318295d1SPiotr Matuszczak "MetricProperty": "/redfish/v1/Chassis/Tray_1/Power#/0/PowerConsumedWatts" 620318295d1SPiotr Matuszczak } 621318295d1SPiotr Matuszczak ], 622318295d1SPiotr Matuszczak "@odata.context": "/redfish/v1/$metadata#MetricReport.MetricReport", 623318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/MetricReports/AvgPlatformPowerUsage" 624318295d1SPiotr Matuszczak} 625318295d1SPiotr Matuszczak``` 626318295d1SPiotr Matuszczak 627318295d1SPiotr MatuszczakSample trigger, that will trigger metric report update: 628318295d1SPiotr Matuszczak 629318295d1SPiotr Matuszczak```json 630318295d1SPiotr Matuszczak{ 631318295d1SPiotr Matuszczak "@odata.type": "#Triggers.v1_1_1.Triggers", 632318295d1SPiotr Matuszczak "Id": "SampleTrigger", 633318295d1SPiotr Matuszczak "Name": "Sample Trigger", 634318295d1SPiotr Matuszczak "MetricType": "Numeric", 635318295d1SPiotr Matuszczak "Links": { 636318295d1SPiotr Matuszczak "MetricReportDefinitions": [ 637318295d1SPiotr Matuszczak "/redfish/v1/TelemetryService/MetricReportDefinitions/SampleMetric" 638318295d1SPiotr Matuszczak ] 639318295d1SPiotr Matuszczak }, 640318295d1SPiotr Matuszczak "Status": { 641318295d1SPiotr Matuszczak "State": "Enabled" 642318295d1SPiotr Matuszczak }, 643*f4febd00SPatrick Williams "TriggerActions": ["RedfishMetricReport"], 644318295d1SPiotr Matuszczak "NumericThresholds": { 645318295d1SPiotr Matuszczak "UpperCritical": { 646318295d1SPiotr Matuszczak "Reading": 50, 647318295d1SPiotr Matuszczak "Activation": "Increasing", 648318295d1SPiotr Matuszczak "DwellTime": "PT0.001S" 649318295d1SPiotr Matuszczak }, 650318295d1SPiotr Matuszczak "UpperWarning": { 651318295d1SPiotr Matuszczak "Reading": 48.1, 652318295d1SPiotr Matuszczak "Activation": "Increasing", 653318295d1SPiotr Matuszczak "DwellTime": "PT0.004S" 654318295d1SPiotr Matuszczak } 655318295d1SPiotr Matuszczak }, 656318295d1SPiotr Matuszczak "MetricProperties": [ 657318295d1SPiotr Matuszczak "/redfish/v1/Chassis/Tray_1/Power#/0/PowerConsumedWatts" 658318295d1SPiotr Matuszczak ], 659318295d1SPiotr Matuszczak "@odata.context": "/redfish/v1/$metadata#Triggers.Triggers", 660318295d1SPiotr Matuszczak "@odata.id": "/redfish/v1/TelemetryService/Triggers/PlatformPowerCapTriggers" 661318295d1SPiotr Matuszczak} 662318295d1SPiotr Matuszczak``` 663318295d1SPiotr Matuszczak 664318295d1SPiotr Matuszczak**Performance tests** 665318295d1SPiotr Matuszczak 666*f4febd00SPatrick WilliamsPerformance test were conducted on the AST2500 system with 64 MB flash and 512 667*f4febd00SPatrick WilliamsMB RAM. Flash consumption by the Telemetry service is 197.5 kB. The runtime 668*f4febd00SPatrick Williamsstatistics are shown in the table below. The reading report is mapped into 669*f4febd00SPatrick Williamssingle Metric Report. The runtime data is collected for the Telemetry component 670*f4febd00SPatrick Williamsonly. All reports was created with 671*f4febd00SPatrick Williams`xyz.openbmc_project.Telemetry.Metric.OnChange` property to maximize the 672*f4febd00SPatrick Williamsworkload. In the configuration with 50 reports and 50 sensors it is about 200 673*f4febd00SPatrick Williamsnew readings per second, generating 200 reading reports per second. The table 674*f4febd00SPatrick Williamsshows CPU usage and memory usage. The VSZ is the amount of memory mapped into 675*f4febd00SPatrick Williamsthe address space of the process. It includes pages backed by the process' 676*f4febd00SPatrick Williamsexecutable file and shared libraries, its heap and stack, as well as anything 677*f4febd00SPatrick Williamselse it has mapped. 678318295d1SPiotr Matuszczak 679a0364138SWludzik, Jozef| Telemetry service state | VSZ | %VSZ | %CPU | 680*f4febd00SPatrick Williams| --------------------------------------------- | ------ | ---- | ------ | 681318295d1SPiotr Matuszczak| Idle (0 reports, 0 sensors) | 5188 B | 1% | 0% | 682318295d1SPiotr Matuszczak| 1 report, 1 sensor | 5188 B | 1% | 1% | 683318295d1SPiotr Matuszczak| 2 reports, 1 sensor | 5188 B | 1% | 1% | 684318295d1SPiotr Matuszczak| 2 reports, 2 sensors (1 sensor per report) | 5188 B | 1% | 1% | 685318295d1SPiotr Matuszczak| 1 report, 10 sensors | 5188 B | 1% | 1% | 686318295d1SPiotr Matuszczak| 10 reports, 10 sensors (same for each report) | 5320 B | 1% | 1-2% | 687318295d1SPiotr Matuszczak| 2 reports, 20 sensors (10 per report) | 5188 B | 1% | 1% | 688318295d1SPiotr Matuszczak| 30 reports, 30 sensors (10 per report) | 5444 B | 1% | 5-9% | 689318295d1SPiotr Matuszczak| 50 reports, 50 sensors (10 per report) | 5572 B | 1% | 11-14% | 690318295d1SPiotr Matuszczak 691*f4febd00SPatrick WilliamsThe last two configurations use 10 sensors per reading report, which gives 3 or 692*f4febd00SPatrick Williams5 distinctive configurations. Each such configuration is used to create 10 693*f4febd00SPatrick Williamsreading reports to obtain the desired amount of 30 or 50 reading reports. 694318295d1SPiotr Matuszczak 695*f4febd00SPatrick WilliamsIn this architecture reading report is created every time when Redfish Metric 696*f4febd00SPatrick WilliamsReport Definition is posted (creating new Metric Report). 697318295d1SPiotr Matuszczak 698318295d1SPiotr Matuszczak## Alternatives Considered 699*f4febd00SPatrick Williams 700318295d1SPiotr MatuszczakThe [framework based on collectd/librrd][5] was considered as alternate design. 701318295d1SPiotr MatuszczakAlthough it seems to be versatile and scalable solution, it has some drawbacks 702318295d1SPiotr Matuszczakfrom our point of view: 703*f4febd00SPatrick Williams 704*f4febd00SPatrick Williams- Collectd's footprint in the minimal working configuration is around 2.6 MB, 705318295d1SPiotr Matuszczak while available space for the OpenBMC is limited to 64 MB. 706*f4febd00SPatrick Williams- In this design, librrd is used to store metrics on the BMC's non-volatile 707318295d1SPiotr Matuszczak storage, which may be an issue, when lots of metrics are captured and stored 708318295d1SPiotr Matuszczak to OpenBMC's limited storage space. Also flash wear-out issue may occur, when 709318295d1SPiotr Matuszczak metrics are captured frequently (like once per second). 710*f4febd00SPatrick Williams- Telemetry service is directly compatible with Redfish Telemetry Service API, 711*f4febd00SPatrick Williams which means, that Telemetry's reading reports can be directly mapped to 712*f4febd00SPatrick Williams Redfish Metric Reports. 713*f4febd00SPatrick Williams- Telemetry service unifies the way how the BMC's telemetry is exposed over the 714*f4febd00SPatrick Williams Redfish and may be used with multiple front-ends, thus there is no problem to 715*f4febd00SPatrick Williams add support telemetry over IPMI or any other API. 716318295d1SPiotr Matuszczak 717a0364138SWludzik, JozefSince this design assumes flexibility and modularity, there is no obstacles to 718a0364138SWludzik, Jozefuse collectd in cooperation with Telemetry. The one of possible configurations 719a0364138SWludzik, Jozefis shown on the diagram below. 720318295d1SPiotr Matuszczak 721318295d1SPiotr Matuszczak```ascii 722318295d1SPiotr Matuszczak +-----------------+ +-----------------+ 723a0364138SWludzik, Jozef | D-Bus sensors | | Telemetry | 724318295d1SPiotr Matuszczak +--------^--------+ +--------^--------+ 725318295d1SPiotr Matuszczak | | 726318295d1SPiotr Matuszczak | | 727318295d1SPiotr Matuszczak | | 728318295d1SPiotr Matuszczak<--------^--v-----------D-Bus--------v-^----------> 729318295d1SPiotr Matuszczak | | 730318295d1SPiotr Matuszczak | | 731318295d1SPiotr Matuszczak | | 732318295d1SPiotr Matuszczak +-------v------------+ +----------v--------+ 733318295d1SPiotr Matuszczak | collectd metrics | | | 734318295d1SPiotr Matuszczak | exposed as D-Bus | | bmcweb | 735318295d1SPiotr Matuszczak | sensors | | (with Redfish | 736318295d1SPiotr Matuszczak +---------^----------+ | Telemetry | 737318295d1SPiotr Matuszczak | | Service) | 738318295d1SPiotr Matuszczak | | | 739318295d1SPiotr Matuszczak +------+-------+ +-------------------+ 740318295d1SPiotr Matuszczak | | 741318295d1SPiotr Matuszczak | collectd | 742318295d1SPiotr Matuszczak | | 743318295d1SPiotr Matuszczak +--------------+ 744318295d1SPiotr Matuszczak``` 745*f4febd00SPatrick Williams 746*f4febd00SPatrick WilliamsHere collectd is used as the source of some set of metrics. It exposes them as 747*f4febd00SPatrick Williamsthe D-Bus sensors, which can easily be consumed either by the bmcweb and 748a0364138SWludzik, JozefTelemetry service without any changes in their D-Bus interfaces. In such 749*f4febd00SPatrick Williamsconfiguration Telemetry service provides metric reports and triggers management. 750318295d1SPiotr Matuszczak 751a0364138SWludzik, JozefOther possible configuration is to use collectd without the Telemetry service, 752318295d1SPiotr Matuszczakbut in such case, collectd does not provide metric reports and triggers support 753318295d1SPiotr Matuszczakcompatible with the Redfish. In such case, Redfish Telemetry Service won't be 754318295d1SPiotr Matuszczaksupported or metric reports and triggers support has to be provided by the 755318295d1SPiotr Matuszczakcollectd. 756318295d1SPiotr Matuszczak 757318295d1SPiotr Matuszczak## Impacts 758*f4febd00SPatrick Williams 759*f4febd00SPatrick WilliamsThis design impacts the architecture of the bmcweb component, since it adds the 760*f4febd00SPatrick WilliamsRedfish Telemetry Service implementation as a component for the existing Redfish 761*f4febd00SPatrick WilliamsAPI implementation. 762318295d1SPiotr Matuszczak 763318295d1SPiotr Matuszczak## Testing 764*f4febd00SPatrick Williams 765*f4febd00SPatrick WilliamsThis is the very high-level description of the proposed set of tests. Testing 766*f4febd00SPatrick Williamsshall be done on three basic levels: 767*f4febd00SPatrick Williams 768*f4febd00SPatrick Williams- Unit tests 769*f4febd00SPatrick Williams- Functional tests 770*f4febd00SPatrick Williams- Performance tests 771318295d1SPiotr Matuszczak 772318295d1SPiotr Matuszczak**Unit tests** 773318295d1SPiotr Matuszczak 774*f4febd00SPatrick WilliamsThe Telemetry's code shall be covered by the unit tests. The preferred framework 775*f4febd00SPatrick Williamsis the [GTest/GMock][7]. The unit tests shall be ran before code change is to be 776*f4febd00SPatrick Williamscommitted to make sure, that nothing is broken in existing functionality. Also, 777*f4febd00SPatrick Williamswhen new code is introduced, a new set of unit tests shall be committed with it 778*f4febd00SPatrick Williamsaccording to test-driven development principle. Unit tests shall be also 779*f4febd00SPatrick Williamscarefully reviewed. 780318295d1SPiotr Matuszczak 781318295d1SPiotr Matuszczak**Functional tests** 782318295d1SPiotr Matuszczak 783318295d1SPiotr MatuszczakFunctional tests will be divided into two steps. 784318295d1SPiotr Matuszczak 785a0364138SWludzik, JozefFirst step is for testing the Telemetry metric reports management. Test scenario 786a0364138SWludzik, Jozefshall contain creating metric report by POSTing proper metric report definition, 787a0364138SWludzik, Jozefreading metric report (using GET on proper URI) and deleting the metric report. 788a0364138SWludzik, JozefThe required configuration for such test is D-Bus sensors (at least some of 789a0364138SWludzik, Jozefthem) and bmcweb with Redfish Telemetry Service implemented. The tests shall be 790a0364138SWludzik, Jozefperformed on real hardware. For ease of metric testing, dummy D-Bus sensors may 791a0364138SWludzik, Jozefbe provided to provide specifically prepared metrics. This configuration shall 792a0364138SWludzik, Jozefalso enable testing aggregated operations (MIN, MAX, SUM, AVG). 793318295d1SPiotr Matuszczak 794318295d1SPiotr MatuszczakSecond step is to test triggers and events generation. This will require also 795318295d1SPiotr MatuszczakEvent Service to be implemented along with Log Service. Tests shall cover all 796318295d1SPiotr Matuszczakscenarios with sending metric report as an event, triggering metric report 797318295d1SPiotr Matuszczakupdate and logging events. 798318295d1SPiotr Matuszczak 799318295d1SPiotr Matuszczak**Performance tests** 800318295d1SPiotr Matuszczak 801*f4febd00SPatrick WilliamsPerformance tests shall be done using full OpenBMC configuration with all the 802*f4febd00SPatrick Williamsrequired set of features. The tests shall create a lot of metric reports (up to 803*f4febd00SPatrick Williamsmaximum number) along with all possible triggers. Measurements shall cover the 804*f4febd00SPatrick Williamsperiodic metric report jitter, delays in event logging or sending, BMC's CPU 805*f4febd00SPatrick Williamsutilization and the performance impact on other services. 806318295d1SPiotr Matuszczak 807*f4febd00SPatrick Williams[1]: 808*f4febd00SPatrick Williams https://www.dmtf.org/sites/default/files/standards/documents/DSP2051_0.1.0a.zip 809*f4febd00SPatrick Williams[2]: 810*f4febd00SPatrick Williams https://github.com/openbmc/docs/blob/master/architecture/sensor-architecture.md 811318295d1SPiotr Matuszczak[3]: https://www.kernel.org/doc/Documentation/hwmon/ 812318295d1SPiotr Matuszczak[4]: https://www.freedesktop.org/wiki/Software/dbus/ 8130ee8da09SNodeMan97[5]: https://gerrit.openbmc.org/c/openbmc/docs/+/22257 8140ee8da09SNodeMan97[6]: https://gerrit.openbmc.org/c/openbmc/docs/+/24749 815318295d1SPiotr Matuszczak[7]: https://github.com/google/googletest 816*f4febd00SPatrick Williams[8]: 817*f4febd00SPatrick Williams https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Telemetry/ReportManager.interface.yaml 818*f4febd00SPatrick Williams[9]: 819*f4febd00SPatrick Williams https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Telemetry/Report.interface.yaml 820*f4febd00SPatrick Williams[10]: 821*f4febd00SPatrick Williams https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Object/Delete.interface.yaml 822