xref: /openbmc/phosphor-dbus-monitor/src/example/example.yaml (revision 0c1e024fd92a7636edf66b1769b5798647f2beae)
1870c3fc6SBrad Bishop# Example PDM configuration file.
20e7df131SBrad Bishop
30e7df131SBrad Bishop- name: example path group
40e7df131SBrad Bishop  description: >
52b31c988SPatrick Williams      'A path group is a named collection of D-Bus object paths and associated
62b31c988SPatrick Williams      metadata.  These collections serve only to be referenced by other
72b31c988SPatrick Williams      configuration directives.
80e7df131SBrad Bishop
92b31c988SPatrick Williams      The metadata element has different uses depending on the referencing
102b31c988SPatrick Williams      directive.
110e7df131SBrad Bishop
122b31c988SPatrick Williams      Within a single configuration file path group names must be unique.  The
132b31c988SPatrick Williams      same name can appear in multiple configuration files; however, the
142b31c988SPatrick Williams      referencing directive will only search for the group in the same
152b31c988SPatrick Williams      configuration file.'
160e7df131SBrad Bishop  class: group
170e7df131SBrad Bishop  group: path
180e7df131SBrad Bishop  members:
19babf3b78SBrad Bishop      - meta: PATH
200e7df131SBrad Bishop        path: /xyz/openbmc_project/testing/inst1
21babf3b78SBrad Bishop      - meta: PATH
220e7df131SBrad Bishop        path: /xyz/openbmc_project/testing/inst2
23babf3b78SBrad Bishop      - meta: PATH
240e7df131SBrad Bishop        path: /xyz/openbmc_project/testing/inst3
25babf3b78SBrad Bishop      - meta: PATH
260e7df131SBrad Bishop        path: /xyz/openbmc_project/testing/inst4
27e73b2c35SBrad Bishop
28e73b2c35SBrad Bishop- name: example property group
29e73b2c35SBrad Bishop  description: >
302b31c988SPatrick Williams      'Like path groups, a property group is a named collection of D-Bus
312b31c988SPatrick Williams      property names and associated metadata.
32e73b2c35SBrad Bishop
332b31c988SPatrick Williams      Properties in a group must all have the same D-Bus type signature and must
342b31c988SPatrick Williams      be explicitly declared.'
35e73b2c35SBrad Bishop  class: group
36e73b2c35SBrad Bishop  group: property
37e73b2c35SBrad Bishop  type: uint32
38e73b2c35SBrad Bishop  members:
39e73b2c35SBrad Bishop      - interface: xyz.openbmc_project.Sensor.Value
40babf3b78SBrad Bishop        meta: PROPERTY
41e73b2c35SBrad Bishop        property: ValueA
42e73b2c35SBrad Bishop      - interface: xyz.openbmc_project.Sensor.Value
43babf3b78SBrad Bishop        meta: PROPERTY
44e73b2c35SBrad Bishop        property: ValueB
454b916f13SBrad Bishop
464b916f13SBrad Bishop- name: example property watch
474b916f13SBrad Bishop  description: >
482b31c988SPatrick Williams      'A property watch instructs PDM to maintain a cache of the state of the
492b31c988SPatrick Williams      specified properties on the specified D-Bus objects.
50fccdc39fSBrad Bishop
51ae786ef6SMatthew Barth      An optional set of filters can be applied to the specified properties,
522b31c988SPatrick Williams      where each property's cache is cleared when it fails to pass any one
532b31c988SPatrick Williams      filter. The property's cache is cleared so it will not have an affect on
542b31c988SPatrick Williams      any optional callback that may be triggered.
55ae786ef6SMatthew Barth
56ae786ef6SMatthew Barth      An optional callback can be triggered when property values change and
5798d6462aSLei YU      those values pass all filters that may be defined.
5898d6462aSLei YU
592b31c988SPatrick Williams      By default the callback is called when the monitor starts. An optional
602b31c988SPatrick Williams      `ignore_start_callback` can be set to true so that the callback will not
612b31c988SPatrick Williams      be called when the monitor starts.'
6298d6462aSLei YU
634b916f13SBrad Bishop  class: watch
644b916f13SBrad Bishop  watch: property
654b916f13SBrad Bishop  paths: example path group
664b916f13SBrad Bishop  properties: example property group
67fccdc39fSBrad Bishop  callback: example count condition
68ae786ef6SMatthew Barth  filters:
692b31c988SPatrick Williams      - op: ">="
70ae786ef6SMatthew Barth        bound: 0
712b31c988SPatrick Williams      - op: "<="
72ae786ef6SMatthew Barth        bound: 100
7398d6462aSLei YU  ignore_start_callback: true
74c1283ae8SBrad Bishop
75c1283ae8SBrad Bishop- name: example journal callback
76c1283ae8SBrad Bishop  description: >
77c1283ae8SBrad Bishop      'Callbacks are actions PDM should take when instructed to do so.
78c1283ae8SBrad Bishop
792b31c988SPatrick Williams      Some callback types refer to a group of paths and group of properties in a
802b31c988SPatrick Williams      similar fashion as the property watch directive.
81c1283ae8SBrad Bishop
82c1283ae8SBrad Bishop      The journal callback logs the specified message to the systemd journal
83c1283ae8SBrad Bishop      with the specified severity.
84c1283ae8SBrad Bishop
852b31c988SPatrick Williams      Additionally, the journal callback will add to the journal key value pair
862b31c988SPatrick Williams      metadata for each property in the specified property group with the key
872b31c988SPatrick Williams      being the property element metadata and the value being the property
882b31c988SPatrick Williams      value.'
89c1283ae8SBrad Bishop  class: callback
90c1283ae8SBrad Bishop  callback: journal
91c1283ae8SBrad Bishop  paths: example path group
92c1283ae8SBrad Bishop  properties: example property group
93c1283ae8SBrad Bishop  severity: INFO
94c1283ae8SBrad Bishop  message: Hello world from PDM!
9549e66175SBrad Bishop
96acac602dSGunnar Mills- name: example elog callback
97acac602dSGunnar Mills  description: >
98acac602dSGunnar Mills      'Callbacks are actions PDM should take when instructed to do so.
99acac602dSGunnar Mills
1002b31c988SPatrick Williams      Some callback types refer to a group of paths and group of properties in a
1012b31c988SPatrick Williams      similar fashion as the property watch directive.
102acac602dSGunnar Mills
103acac602dSGunnar Mills      The elog callback logs the elog and elog metadata.'
104acac602dSGunnar Mills  class: callback
105acac602dSGunnar Mills  callback: elog
106acac602dSGunnar Mills  paths: example path group
107acac602dSGunnar Mills  properties: example property group
108acac602dSGunnar Mills  error: xyz::openbmc_project::Common::Error::InvalidArgument
109acac602dSGunnar Mills  metadata:
110acac602dSGunnar Mills      - name: xyz::openbmc_project::Common::InvalidArgument::ARGUMENT_NAME
111acac602dSGunnar Mills        value: testing...
112acac602dSGunnar Mills        type: string
113acac602dSGunnar Mills      - name: xyz::openbmc_project::Common::InvalidArgument::ARGUMENT_VALUE
114acac602dSGunnar Mills        value: testing...
115acac602dSGunnar Mills        type: string
116acac602dSGunnar Mills
1173c5318d8SMatt Spinler- name: example elog with metadata capture callback
1183c5318d8SMatt Spinler  description: >
1193c5318d8SMatt Spinler      'Callbacks are actions pdm should take when instructed to do so.
1203c5318d8SMatt Spinler
1213c5318d8SMatt Spinler      This callback creates an elog, and it will capture the values of the
1222b31c988SPatrick Williams      properties that passed its condition check in the metadata field (that
1232b31c988SPatrick Williams      must be a string type) in the form:
1243c5318d8SMatt Spinler
1253c5318d8SMatt Spinler          |path1:property1=value1|path2:property2=value2|
1263c5318d8SMatt Spinler
1272b31c988SPatrick Williams      Note that as this callback depends on the condition that called it to fill
1282b31c988SPatrick Williams      in the result of its checks on each property, this callback should use the
1292b31c988SPatrick Williams      same properties and paths keywords as the condition that calls it.
1303c5318d8SMatt Spinler
1313c5318d8SMatt Spinler      Currently an error log with only 1 metadata entry of type string is
1323c5318d8SMatt Spinler      supported.'
1333c5318d8SMatt Spinler
1343c5318d8SMatt Spinler  class: callback
1353c5318d8SMatt Spinler  callback: elog_with_metadata
1363c5318d8SMatt Spinler  paths: example path group
1373c5318d8SMatt Spinler  properties: example property group
1383c5318d8SMatt Spinler  error: xyz::openbmc_project::Common::Callout::Error::Inventory
1393c5318d8SMatt Spinler  metadata: xyz::openbmc_project::Common::Callout::Inventory::CALLOUT_INVENTORY_PATH
1403c5318d8SMatt Spinler
14140e0db46SRatan Gupta- name: example event callback
14240e0db46SRatan Gupta  description: >
14340e0db46SRatan Gupta      'Callbacks are actions PDM should take when instructed to do so.
14440e0db46SRatan Gupta
1452b31c988SPatrick Williams      Some callback types refer to a group of paths and group of properties in a
1462b31c988SPatrick Williams      similar fashion as the property watch directive.
14740e0db46SRatan Gupta
1482b31c988SPatrick Williams      The event callback creates the event D-Bus object with the given name and
1492b31c988SPatrick Williams      the event message. eg /xyz/openbmc_project/events/test/<id>'
15040e0db46SRatan Gupta  class: callback
15140e0db46SRatan Gupta  callback: event
15240e0db46SRatan Gupta  paths: example path group
15340e0db46SRatan Gupta  properties: example property group
15440e0db46SRatan Gupta  eventName: test
15540e0db46SRatan Gupta  eventMessage: "Test configuration changed."
15640e0db46SRatan Gupta
1570df00be0SBrad Bishop- name: example method callback
1580df00be0SBrad Bishop  description: >
1592df09e24SGunnar Mills      'The method callback invokes the specified D-Bus method.'
1600df00be0SBrad Bishop  class: callback
1610df00be0SBrad Bishop  callback: method
1620df00be0SBrad Bishop  service: org.freedesktop.systemd1
1630df00be0SBrad Bishop  path: /org/freedesktop/systemd1
1640df00be0SBrad Bishop  interface: org.freedesktop.systemd1.Manager
1650df00be0SBrad Bishop  method: StartUnit
1660df00be0SBrad Bishop  args:
1670df00be0SBrad Bishop      - value: foo.unit
1680df00be0SBrad Bishop        type: string
1690df00be0SBrad Bishop      - value: replace
1700df00be0SBrad Bishop        type: string
1710df00be0SBrad Bishop
172f7a6a462SMatt Spinler- name: example resolve callouts callback
173f7a6a462SMatt Spinler  description: >
1742b31c988SPatrick Williams      'The resolve callout callback resolves all error log entries that are
1752b31c988SPatrick Williams      associated with the inventory path specified by setting the Resolved
1762b31c988SPatrick Williams      property in the entries to true.
177f7a6a462SMatt Spinler
1782b31c988SPatrick Williams      A use case could be to watch the Present property on the inventory item
1792b31c988SPatrick Williams      and resolve all errors for it when a new one is plugged in and the
1802b31c988SPatrick Williams      property changes to true.'
181f7a6a462SMatt Spinler
182f7a6a462SMatt Spinler  class: callback
183f7a6a462SMatt Spinler  callback: resolve callout
184f7a6a462SMatt Spinler  paths: example path group
185f7a6a462SMatt Spinler  properties: example property group
186f7a6a462SMatt Spinler  callout: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0
187f7a6a462SMatt Spinler
18849e66175SBrad Bishop- name: example callback group
18949e66175SBrad Bishop  description: >
19049e66175SBrad Bishop      'Callbacks groups are simply named collections of other callbacks.
1912b31c988SPatrick Williams      Configuration file directives can only refer to a single callback. Through
1922b31c988SPatrick Williams      use of a group, these configuration file directives can refer to more than
1932b31c988SPatrick Williams      one callback.
19449e66175SBrad Bishop
1952b31c988SPatrick Williams      For example for a given event, one may wish to trace multiple messages to
1962b31c988SPatrick Williams      the systemd journal.  The journal callback does not support tracing
1972b31c988SPatrick Williams      multiple messages.  To do that, define a callback group composed of
1982b31c988SPatrick Williams      multiple journal callbacks.'
19949e66175SBrad Bishop
20049e66175SBrad Bishop  class: callback
20149e66175SBrad Bishop  callback: group
20249e66175SBrad Bishop  members:
20349e66175SBrad Bishop      - example journal callback
2043539db64SBrad Bishop      - example deferred condition
205acac602dSGunnar Mills      - example elog callback
2064041d720SBrad Bishop
2074041d720SBrad Bishop- name: example count condition
2084041d720SBrad Bishop  description: >
2092b31c988SPatrick Williams      'Conditions or conditional callbacks apply a test prior to invoking the
2102b31c988SPatrick Williams      callback function.
2114041d720SBrad Bishop
2122b31c988SPatrick Williams      All conditional callbacks must specify the callback to issue if the
2132b31c988SPatrick Williams      condition evaluates.
2144041d720SBrad Bishop
2152b31c988SPatrick Williams      The count condition applies the op comparison operator to the value of
2162b31c988SPatrick Williams      each property in the specified groups.  It then counts the number of
2172b31c988SPatrick Williams      properties that pass the comparison, and applies another comparison on the
2182b31c988SPatrick Williams      result against the specified bound.
2194041d720SBrad Bishop
2204041d720SBrad Bishop      For example, a callback that requires at least three temperature sensors
2214041d720SBrad Bishop      in the group to be higher than 115 degrees might use a count condition
222c458deeaSMatt Spinler      with an op of >, a count op of >=, a bound of 115, and a countbound of 3.
223c458deeaSMatt Spinler
224c458deeaSMatt Spinler      The optional oneshot parameter defaults to false.  If it is specified and
225c458deeaSMatt Spinler      set to true, then the callback will only be called once for as long as the
226c458deeaSMatt Spinler      condition is repeatedly passing.  The condition needs to fail at least
227c458deeaSMatt Spinler      once to rearm the callback.'
2284041d720SBrad Bishop
2294041d720SBrad Bishop  class: condition
2304041d720SBrad Bishop  condition: count
2314041d720SBrad Bishop  paths: example path group
2324041d720SBrad Bishop  properties: example property group
2334041d720SBrad Bishop  callback: example callback group
2342b31c988SPatrick Williams  countop: ">="
2354041d720SBrad Bishop  countbound: 3
2362b31c988SPatrick Williams  op: ">="
2374041d720SBrad Bishop  bound: 115
238c458deeaSMatt Spinler  oneshot: true
2393539db64SBrad Bishop
2403539db64SBrad Bishop- name: example deferred condition
2413539db64SBrad Bishop  description: >
2423539db64SBrad Bishop      'Deferred conditions operate in the same fashion as conditional callbacks
2433539db64SBrad Bishop      with the added behavior that when the condition is tested and is met,
2443539db64SBrad Bishop      invocation of the callback is deferred by the interval specified.
2453539db64SBrad Bishop
2462b31c988SPatrick Williams      When the configured time has elapsed, if the condition has not been
2472b31c988SPatrick Williams      reevaluated the callback is invoked.
2483539db64SBrad Bishop
2492b31c988SPatrick Williams      Any condition type can be deferred in this way by setting the defer
2502b31c988SPatrick Williams      attribute.'
2513539db64SBrad Bishop
2523539db64SBrad Bishop  class: condition
2533539db64SBrad Bishop  condition: count
2543539db64SBrad Bishop  paths: example path group
2553539db64SBrad Bishop  properties: example property group
2563539db64SBrad Bishop  defer: 1000us
2573539db64SBrad Bishop  callback: example callback group
2582b31c988SPatrick Williams  countop: ">="
2593539db64SBrad Bishop  countbound: 3
2602b31c988SPatrick Williams  op: ">="
2613539db64SBrad Bishop  bound: 115
26280c70610SMarri Devender Rao
26380c70610SMarri Devender Rao- name: errorlog path group
26480c70610SMarri Devender Rao  class: group
26580c70610SMarri Devender Rao  group: path
26680c70610SMarri Devender Rao  members:
26780c70610SMarri Devender Rao      - meta: PATH
26880c70610SMarri Devender Rao        path: /xyz/openbmc_project/logging
26980c70610SMarri Devender Rao
27080c70610SMarri Devender Rao- name: pathwatch errorlog
27180c70610SMarri Devender Rao  description: >
272*0c1e024fSManojkiran Eda      'A pathwatch watches on the specified object path group. pathcallback are
2732b31c988SPatrick Williams      actions PDM should take when instructed to do so.'
27480c70610SMarri Devender Rao
27580c70610SMarri Devender Rao  class: pathwatch
27680c70610SMarri Devender Rao  pathwatch: path
27780c70610SMarri Devender Rao  paths: errorlog path group
27880c70610SMarri Devender Rao  pathcallback: create errorlog event
27980c70610SMarri Devender Rao
28080c70610SMarri Devender Rao- name: create errorlog event
28180c70610SMarri Devender Rao  description: >
28280c70610SMarri Devender Rao      'eventType specifies the type of the SNMP notification.'
28380c70610SMarri Devender Rao  class: pathcallback
28480c70610SMarri Devender Rao  pathcallback: eventpath
28580c70610SMarri Devender Rao  paths: errorlog path group
28680c70610SMarri Devender Rao  eventType: ErrorTrap
287