1# method
2
3## Description
4
5The method to use in monitoring a fan's functional state. One method can be
6configured per fan and each supported method requires its own set of attributes
7to be provided.
8
9## Attribute Value(s)
10
11Methods:
12
13- ["timebased"](#timebased) - Default
14- ["count"](#count)
15
16### "timebased"
17
18Uses timers for determining when a fan's sensor should be marked nonfunctional
19or functional after its been in that state for that continuous amount of time.
20Separate timers are used to transition a fan from functional to
21nonfunctional(`allowed_out_of_range_time`) and nonfunctional to
22functional(`functional_delay`).
23
24- `allowed_out_of_range_time` - Time(in seconds) that each fan sensor is allowed
25  to be calculated out of range of a current target before being marked
26  nonfunctional.
27- `functional_delay` - Optional, default = 0
28  - Time(in seconds) that each fan sensor must be calculated within range of a
29    current target before being marked functional.
30
31```
32"method": "timebased",
33"allowed_out_of_range_time": 30,
34"functional_delay": 5
35```
36
37**Note: Since this method is the default, simply providing
38`allowed_out_of_range_time` and `functional_delay` attributes will result in
39this method being used.**
40
41- This is equivalent to above:
42  ```
43  "allowed_out_of_range_time": 30,
44  "functional_delay": 5
45  ```
46
47### "count"
48
49An up/down counter for determining when a fan's sensor should be marked
50nonfunctional based on a `threshold` or functional when the counter = 0. Each
51fan sensor update where its feedback speed is calculated out of range of the
52current target increments the counter by 1. Once the counter reaches the
53`threshold`, the fan is marked nonfunctional. However, at any point the sensor's
54feedback speed is within range, the counter is decremented by 1. Therefore the
55fan's sensor(s) do not have to continuously be in a faulted state to be marked
56nonfunctional and instead is deemed nonfunctional once it accumulates the
57`threshold` number of times deemed out of range. The same is true for a
58nonfunctional fan sensor to become functional, where the counter must accumulate
59enough times deemed within range to decrement the counter to 0. This checking
60occurs at an interval dictated by the `count_interval` field.
61
62- `threshold` - Number of total times a fan sensor must be calculated out of
63  range before being marked nonfunctional.
64
65- `count_interval` - The interval, in seconds, to check the feedback speed and
66  increment/decrement the counter. Defaults to 1s if not present.
67
68```
69"method": "count",
70"count_interval": 5,
71"sensors": [
72  {
73    "threshold": 30
74  }
75]
76```
77
78## Example
79
80<pre><code>
81{
82  "fans": [
83    {
84      "inventory": "/system/chassis/motherboard/fan0",
85      <b><i>"allowed_out_of_range_time": 30,
86      "functional_delay": 5</i></b>,
87      "deviation": 15,
88      "num_sensors_nonfunc_for_fan_nonfunc": 1,
89      "monitor_start_delay": 30,
90      "fan_missing_error_delay": 20,
91      "nonfunc_rotor_error_delay": 0,
92      "sensors": [
93        {
94          "name": "fan0_0",
95          "has_target": true
96        },
97        {
98          "name": "fan0_1",
99          "has_target": false,
100          "factor": 1.45,
101          "offset": -909
102        }
103      ]
104    },
105    {
106      "inventory": "/system/chassis/motherboard/fan1",
107      <b><i>"method": "count",
108      "count_interval": 1</i></b>,
109      "deviation": 15,
110      "num_sensors_nonfunc_for_fan_nonfunc": 1,
111      "monitor_start_delay": 30,
112      "fan_missing_error_delay": 20,
113      "nonfunc_rotor_error_delay": 0,
114      "sensors": [
115        {
116          "name": "fan0_0",
117          "has_target": true,
118          <b><i>"threshold": 30</i></b>
119        },
120        {
121          "name": "fan0_1",
122          "has_target": false,
123          "factor": 1.45,
124          "offset": -909,
125          <b><i>"threshold": 30</i></b>
126        }
127      ]
128    }
129  ]
130}
131</code></pre>
132