xref: /openbmc/phosphor-dbus-monitor/src/example/example.yaml (revision ae786ef6dbf2ff72266240880fef3569cb694642)
1# Example PDM configuration file.
2
3- name: example path group
4  description: >
5    'A path group is a named collection of D-Bus object
6    paths and associated metadata.  These collections
7    serve only to be referenced by other configuration
8    directives.
9
10    The metadata element has different uses depending
11    on the referencing directive.
12
13    Within a single configuration file path group names
14    must be unique.  The same name can appear in multiple
15    configuration files; however, the referencing directive
16    will only search for the group in the same configuration
17    file.'
18  class: group
19  group: path
20  members:
21    - meta: PATH
22      path: /xyz/openbmc_project/testing/inst1
23    - meta: PATH
24      path: /xyz/openbmc_project/testing/inst2
25    - meta: PATH
26      path: /xyz/openbmc_project/testing/inst3
27    - meta: PATH
28      path: /xyz/openbmc_project/testing/inst4
29
30- name: example property group
31  description: >
32    'Like path groups, a property group is a named collection
33    of D-Bus property names and associated metadata.
34
35    Properties in a group must all have the same D-Bus type signature
36    and must be explicitly declared.'
37  class: group
38  group: property
39  type: uint32
40  members:
41    - interface: xyz.openbmc_project.Sensor.Value
42      meta: PROPERTY
43      property: ValueA
44    - interface: xyz.openbmc_project.Sensor.Value
45      meta: PROPERTY
46      property: ValueB
47
48- name: example property watch
49  description: >
50    'A property watch instructs PDM to maintain a cache of the state
51    of the specified properties on the specified D-Bus objects.
52
53    An optional set of filters can be applied to the specified properties,
54    where each property's cache is cleared when it fails to pass
55    any one filter. The property's cache is cleared so it will not have an
56    affect on any optional callback that may be triggered.
57
58    An optional callback can be triggered when property values change and
59    those values pass all filters that may be defined.'
60  class: watch
61  watch: property
62  paths: example path group
63  properties: example property group
64  callback: example count condition
65  filters:
66    - op: '>='
67      bound: 0
68    - op: '<='
69      bound: 100
70
71- name: example journal callback
72  description: >
73    'Callbacks are actions PDM should take when instructed to do so.
74
75    Some callback types refer to a group of paths and group of properties
76    in a similar fashion as the property watch directive.
77
78    The journal callback logs the specified message to the systemd journal
79    with the specified severity.
80
81    Additionally, the journal callback will add to the journal key value
82    pair metadata for each property in the specified property group with
83    the key being the property element metadata and the value being the
84    property value.'
85  class: callback
86  callback: journal
87  paths: example path group
88  properties: example property group
89  severity: INFO
90  message: Hello world from PDM!
91
92- name: example elog callback
93  description: >
94    'Callbacks are actions PDM should take when instructed to do so.
95
96    Some callback types refer to a group of paths and group of properties
97    in a similar fashion as the property watch directive.
98
99    The elog callback logs the elog and elog metadata.'
100  class: callback
101  callback: elog
102  paths: example path group
103  properties: example property group
104  error: xyz::openbmc_project::Common::Error::InvalidArgument
105  metadata:
106    - name: xyz::openbmc_project::Common::InvalidArgument::ARGUMENT_NAME
107      value: testing...
108      type: string
109    - name: xyz::openbmc_project::Common::InvalidArgument::ARGUMENT_VALUE
110      value: testing...
111      type: string
112
113- name: example elog with metadata capture callback
114  description: >
115    'Callbacks are actions pdm should take when instructed to do so.
116
117    This callback creates an elog, and it will capture the values of the
118    properties that passed its condition check in the metadata field
119    (that must be a string type) in the form:
120
121        |path1:property1=value1|path2:property2=value2|
122
123    Note that as this callback depends on the condition that called it to
124    fill in the result of its checks on each property, this callback should
125    use the same properties and paths keywords as the condition that calls it.
126
127    Currently an error log with only 1 metadata entry of type string is
128    supported.'
129
130  class: callback
131  callback: elog_with_metadata
132  paths: example path group
133  properties: example property group
134  error: xyz::openbmc_project::Common::Callout::Error::Inventory
135  metadata: xyz::openbmc_project::Common::Callout::Inventory::CALLOUT_INVENTORY_PATH
136
137- name: example event callback
138  description: >
139    'Callbacks are actions PDM should take when instructed to do so.
140
141    Some callback types refer to a group of paths and group of properties
142    in a similar fashion as the property watch directive.
143
144    The event callback creates the event D-Bus object with the given name
145    and the event message.
146    eg /xyz/openbmc_project/events/test/<id>'
147  class: callback
148  callback: event
149  paths: example path group
150  properties: example property group
151  eventName: test
152  eventMessage: "Test configuration changed."
153
154- name: example method callback
155  description: >
156    'The method callback invokes the specified D-Bus method.'
157  class: callback
158  callback: method
159  service: org.freedesktop.systemd1
160  path: /org/freedesktop/systemd1
161  interface: org.freedesktop.systemd1.Manager
162  method: StartUnit
163  args:
164    - value: foo.unit
165      type: string
166    - value: replace
167      type: string
168
169- name: example resolve callouts callback
170  description: >
171    'The resolve callout callback resolves all error log entries that
172    are associated with the inventory path specified by setting the
173    Resolved property in the entries to true.
174
175    A use case could be to watch the Present property on the inventory
176    item and resolve all errors for it when a new one is plugged in and
177    the property changes to true.'
178
179  class: callback
180  callback: resolve callout
181  paths: example path group
182  properties: example property group
183  callout: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0
184
185- name: example callback group
186  description: >
187    'Callbacks groups are simply named collections of other callbacks.
188    Configuration file directives can only refer to a single callback.
189    Through use of a group, these configuration file directives can
190    refer to more than one callback.
191
192    For example for a given event, one may wish to trace multiple
193    messages to the systemd journal.  The journal callback does not
194    support tracing multiple messages.  To do that, define a callback
195    group composed of multiple journal callbacks.'
196
197  class: callback
198  callback: group
199  members:
200    - example journal callback
201    - example deferred condition
202    - example elog callback
203
204- name: example count condition
205  description: >
206    'Conditions or conditional callbacks apply a test prior to invoking
207    the callback function.
208
209    All conditional callbacks must specify the callback to issue if
210    the condition evaluates.
211
212    The count condition applies the op comparison operator to the value of each
213    property in the specified groups.  It then counts the number of properties
214    that pass the comparison, and applies another comparison on the result
215    against the specified bound.
216
217    For example, a callback that requires at least three temperature sensors
218    in the group to be higher than 115 degrees might use a count condition
219    with an op of >, a count op of >=, a bound of 115, and a countbound of 3.
220
221    The optional oneshot parameter defaults to false.  If it is specified and
222    set to true, then the callback will only be called once for as long as the
223    condition is repeatedly passing.  The condition needs to fail at least
224    once to rearm the callback.'
225
226  class: condition
227  condition: count
228  paths: example path group
229  properties: example property group
230  callback: example callback group
231  countop: '>='
232  countbound: 3
233  op: '>='
234  bound: 115
235  oneshot: true
236
237- name: example deferred condition
238  description: >
239    'Deferred conditions operate in the same fashion as conditional callbacks
240    with the added behavior that when the condition is tested and is met,
241    invocation of the callback is deferred by the interval specified.
242
243    When the configured time has elapsed, if the condition has not been reevaluated
244    the callback is invoked.
245
246    Any condition type can be deferred in this way by setting the defer attribute.'
247
248  class: condition
249  condition: count
250  paths: example path group
251  properties: example property group
252  defer: 1000us
253  callback: example callback group
254  countop: '>='
255  countbound: 3
256  op: '>='
257  bound: 115
258
259- name: errorlog path group
260  class: group
261  group: path
262  members:
263    - meta: PATH
264      path: /xyz/openbmc_project/logging
265
266- name: pathwatch errorlog
267  description: >
268    'A pathwatch watches on the specified object path goup.
269    pathcallback are actions PDM should take when instructed to do so.'
270
271  class: pathwatch
272  pathwatch: path
273  paths: errorlog path group
274  pathcallback: create errorlog event
275
276- name: create errorlog event
277  description: >
278    'eventType specifies the type of the SNMP notification.'
279  class: pathcallback
280  pathcallback: eventpath
281  paths: errorlog path group
282  eventType: ErrorTrap
283