157caa923SMatthew Barth# method
257caa923SMatthew Barth
357caa923SMatthew Barth## Description
4*a49e3f19SPatrick Williams
50d29fb79SMatthew BarthThe method to use in monitoring a fan's functional state. One method can be
60d29fb79SMatthew Barthconfigured per fan and each supported method requires its own set of attributes
70d29fb79SMatthew Barthto be provided.
857caa923SMatthew Barth
957caa923SMatthew Barth## Attribute Value(s)
10*a49e3f19SPatrick Williams
110d29fb79SMatthew BarthMethods:
12*a49e3f19SPatrick Williams
13*a49e3f19SPatrick Williams- ["timebased"](#timebased) - Default
14*a49e3f19SPatrick Williams- ["count"](#count)
1557caa923SMatthew Barth
160d29fb79SMatthew Barth### "timebased"
17*a49e3f19SPatrick Williams
180d29fb79SMatthew BarthUses timers for determining when a fan's sensor should be marked nonfunctional
190d29fb79SMatthew Barthor functional after its been in that state for that continuous amount of time.
200d29fb79SMatthew BarthSeparate timers are used to transition a fan from functional to
210d29fb79SMatthew Barthnonfunctional(`allowed_out_of_range_time`) and nonfunctional to
220d29fb79SMatthew Barthfunctional(`functional_delay`).
230d29fb79SMatthew Barth
24*a49e3f19SPatrick Williams- `allowed_out_of_range_time` - Time(in seconds) that each fan sensor is allowed
25*a49e3f19SPatrick Williams  to be calculated out of range of a current target before being marked
260d29fb79SMatthew Barth  nonfunctional.
27*a49e3f19SPatrick Williams- `functional_delay` - Optional, default = 0
28*a49e3f19SPatrick Williams  - Time(in seconds) that each fan sensor must be calculated within range of a
290d29fb79SMatthew Barth    current target before being marked functional.
300d29fb79SMatthew Barth
310d29fb79SMatthew Barth```
320d29fb79SMatthew Barth"method": "timebased",
330d29fb79SMatthew Barth"allowed_out_of_range_time": 30,
340d29fb79SMatthew Barth"functional_delay": 5
350d29fb79SMatthew Barth```
36*a49e3f19SPatrick Williams
370d29fb79SMatthew Barth**Note: Since this method is the default, simply providing
380d29fb79SMatthew Barth`allowed_out_of_range_time` and `functional_delay` attributes will result in
390d29fb79SMatthew Barththis method being used.**
40*a49e3f19SPatrick Williams
41*a49e3f19SPatrick Williams- This is equivalent to above:
420d29fb79SMatthew Barth  ```
430d29fb79SMatthew Barth  "allowed_out_of_range_time": 30,
440d29fb79SMatthew Barth  "functional_delay": 5
450d29fb79SMatthew Barth  ```
460d29fb79SMatthew Barth
470d29fb79SMatthew Barth### "count"
48*a49e3f19SPatrick Williams
490d29fb79SMatthew BarthAn up/down counter for determining when a fan's sensor should be marked
500d29fb79SMatthew Barthnonfunctional based on a `threshold` or functional when the counter = 0. Each
510d29fb79SMatthew Barthfan sensor update where its feedback speed is calculated out of range of the
520d29fb79SMatthew Barthcurrent target increments the counter by 1. Once the counter reaches the
53*a49e3f19SPatrick Williams`threshold`, the fan is marked nonfunctional. However, at any point the sensor's
54*a49e3f19SPatrick Williamsfeedback speed is within range, the counter is decremented by 1. Therefore the
55*a49e3f19SPatrick Williamsfan's sensor(s) do not have to continuously be in a faulted state to be marked
56*a49e3f19SPatrick Williamsnonfunctional and instead is deemed nonfunctional once it accumulates the
57*a49e3f19SPatrick Williams`threshold` number of times deemed out of range. The same is true for a
58*a49e3f19SPatrick Williamsnonfunctional fan sensor to become functional, where the counter must accumulate
59*a49e3f19SPatrick Williamsenough times deemed within range to decrement the counter to 0. This checking
60*a49e3f19SPatrick Williamsoccurs at an interval dictated by the `count_interval` field.
610d29fb79SMatthew Barth
62*a49e3f19SPatrick Williams- `threshold` - Number of total times a fan sensor must be calculated out of
630d29fb79SMatthew Barth  range before being marked nonfunctional.
640d29fb79SMatthew Barth
65*a49e3f19SPatrick Williams- `count_interval` - The interval, in seconds, to check the feedback speed and
66623635c6SMatt Spinler  increment/decrement the counter. Defaults to 1s if not present.
67623635c6SMatt Spinler
680d29fb79SMatthew Barth```
690d29fb79SMatthew Barth"method": "count",
70623635c6SMatt Spinler"count_interval": 5,
710d29fb79SMatthew Barth"sensors": [
720d29fb79SMatthew Barth  {
730d29fb79SMatthew Barth    "threshold": 30
740d29fb79SMatthew Barth  }
750d29fb79SMatthew Barth]
760d29fb79SMatthew Barth```
7757caa923SMatthew Barth
7857caa923SMatthew Barth## Example
79*a49e3f19SPatrick Williams
800d29fb79SMatthew Barth<pre><code>
810d29fb79SMatthew Barth{
820d29fb79SMatthew Barth  "fans": [
830d29fb79SMatthew Barth    {
840d29fb79SMatthew Barth      "inventory": "/system/chassis/motherboard/fan0",
850d29fb79SMatthew Barth      <b><i>"allowed_out_of_range_time": 30,
860d29fb79SMatthew Barth      "functional_delay": 5</i></b>,
870d29fb79SMatthew Barth      "deviation": 15,
880d29fb79SMatthew Barth      "num_sensors_nonfunc_for_fan_nonfunc": 1,
890d29fb79SMatthew Barth      "monitor_start_delay": 30,
900d29fb79SMatthew Barth      "fan_missing_error_delay": 20,
910d29fb79SMatthew Barth      "nonfunc_rotor_error_delay": 0,
920d29fb79SMatthew Barth      "sensors": [
930d29fb79SMatthew Barth        {
940d29fb79SMatthew Barth          "name": "fan0_0",
950d29fb79SMatthew Barth          "has_target": true
960d29fb79SMatthew Barth        },
970d29fb79SMatthew Barth        {
980d29fb79SMatthew Barth          "name": "fan0_1",
990d29fb79SMatthew Barth          "has_target": false,
1000d29fb79SMatthew Barth          "factor": 1.45,
1010d29fb79SMatthew Barth          "offset": -909
1020d29fb79SMatthew Barth        }
1030d29fb79SMatthew Barth      ]
1040d29fb79SMatthew Barth    },
1050d29fb79SMatthew Barth    {
1060d29fb79SMatthew Barth      "inventory": "/system/chassis/motherboard/fan1",
107623635c6SMatt Spinler      <b><i>"method": "count",
108623635c6SMatt Spinler      "count_interval": 1</i></b>,
1090d29fb79SMatthew Barth      "deviation": 15,
1100d29fb79SMatthew Barth      "num_sensors_nonfunc_for_fan_nonfunc": 1,
1110d29fb79SMatthew Barth      "monitor_start_delay": 30,
1120d29fb79SMatthew Barth      "fan_missing_error_delay": 20,
1130d29fb79SMatthew Barth      "nonfunc_rotor_error_delay": 0,
1140d29fb79SMatthew Barth      "sensors": [
1150d29fb79SMatthew Barth        {
1160d29fb79SMatthew Barth          "name": "fan0_0",
1170d29fb79SMatthew Barth          "has_target": true,
1180d29fb79SMatthew Barth          <b><i>"threshold": 30</i></b>
1190d29fb79SMatthew Barth        },
1200d29fb79SMatthew Barth        {
1210d29fb79SMatthew Barth          "name": "fan0_1",
1220d29fb79SMatthew Barth          "has_target": false,
1230d29fb79SMatthew Barth          "factor": 1.45,
1240d29fb79SMatthew Barth          "offset": -909,
1250d29fb79SMatthew Barth          <b><i>"threshold": 30</i></b>
1260d29fb79SMatthew Barth        }
1270d29fb79SMatthew Barth      ]
1280d29fb79SMatthew Barth    }
1290d29fb79SMatthew Barth  ]
1300d29fb79SMatthew Barth}
1310d29fb79SMatthew Barth</code></pre>
132