xref: /openbmc/phosphor-fan-presence/docs/monitor/README.md (revision 43829ea99c2eb6b09e6bc8cb3d049deaa85caa16)
1# Fan Monitor Configuration File
2
3## Table of Contents
4* [Overview](#overview)
5* [Data Format](#data-format)
6* [Example](#example)
7* [System Config Location](#system-config-location)
8* [Contents](#contents)
9* [Validation](#validation)
10* [Firmware Updates](#firmware-updates)
11* [Loading and Reloading](#loading-and-reloading)
12
13
14## Overview
15
16The `phosphor-fan-monitor` application is controlled by a configuration
17file (config file) to manage the `Functional` property's state on the
18`xyz.openbmc_project.State.Decorator.OperationalStatus` interface for fan
19inventory objects. The config file defines the method to use in determining the
20functional state and the logging of errors for each fan within a machine. It
21also provides the ability to adjust the determination of a fan being
22non-functional due to fan hardware limitations.
23
24
25## Data Format
26
27The config file is written using the [JSON (JavaScript Object
28Notation)](https://www.json.org/) data format and can be created using a text
29editor.
30
31
32## Example
33
34See [config.json](../../monitor/example/config.json).
35
36
37## System Config Location
38
39The config file name is `config.json`.
40
41### Supported Directory
42
43`/usr/share/phosphor-fan-presence/monitor/`
44
45The supported version of the config file is installed under this read-only
46directory location as part of the firmware image install. This is where the
47config file will be loaded from when no overriding config file exists.
48
49#### Default Location
50
51Where a single config file for 1-or-more system types can be used,
52the config file can be located at the base of the supported directory.
53
54i.e.) `/usr/share/phosphor-fan-presence/monitor/config.json`
55
56#### Compatible System Type Location
57
58The config file location can also be based on a system type. This is necessary
59where more than one type of machine is supported in a single BMC firmware image
60and those system types can not share a common config file.
61
62A system type sub-directory can be obtained from the `IBMCompatibleSystem`
63D-Bus interface's `Names` property. The `Names` property contains a list of one
64or more compatible system types, ordered from most specific to the most general.
65
66Example:
67* `ibm,rainier-2u`
68* `ibm,rainier`
69
70The `phosphor-fan-monitor` application then traverses the supported
71directory, appending each compatible system type entry as a sub-directory from
72most specific to most general until the config file is found.
73
74Example:
751. `/usr/share/phosphor-fan-presence/monitor/ibm,rainier-2u/`
76   * (directory/config file does not exist)
772. `/usr/share/phosphor-fan-presence/monitor/ibm,rainier/config.json`
78   * (config file found)
79
80If a config file is not found and the machine is powered on, an error is logged
81and `phosphor-fan-monitor` application terminates preventing the machine
82from successfully powering on.
83
84### Override Directory
85
86`/etc/phosphor-fan-presence/monitor/`
87
88A different version of the config file can be loaded by placing it into this
89writable directory location. This avoids the need to build and install a new
90firmware image on the BMC when changing the configuration, such as for testing
91purposes.
92
93The override directory may not exist on the BMC, therefore to be able to use
94an overriding config file it must be created using the following command:
95
96`mkdir -p /etc/phosphor-fan-presence/monitor`
97
98### Search Order
99
100The `phosphor-fan-monitor` application will search for the config file at
101the directory locations in the following order:
1021. Override directory
1032. Supported directory
104   * Default location
105   * Compatible System Type location
106
107
108## Contents
109
110### Structure
111
112TBD
113
114### Syntax
115
116TBD
117
118### Comments
119
120TBD
121
122
123## Validation
124
125TBD
126
127
128## Firmware Updates
129
130When a new firmware image is installed on the BMC, it will update the config
131file in the standard directory.
132
133The override directory will **not** be modified by a firmware update. If a
134config file exists in the override directory, it will continue to be used as
135the fan presence configuration instead of the config file located under the
136appropriate location within the supported directory.
137
138
139## Loading and Reloading
140
141The config file is loaded when the `phosphor-fan-monitor` application
142starts.
143
144To force the application to reload the config file, use the following command
145on the BMC:
146
147`systemctl kill -s HUP phosphor-fan-monitor@0.service`
148
149To confirm which config file was loaded, use the following command on the BMC:
150
151`journalctl -u phosphor-fan-monitor@0.service | grep Loading`
152