| 1 | # Median |
| 2 | |
| 3 | The median is the value separating the higher half from the lower half of a data sample |
| 4 | (a population or a probability distribution). For a data set, it may be thought of as the |
| 5 | "middle" value. |
| 6 | |
| 7 | `median` is not an accurate average. However, it eliminates all spikes, by sorting |
| 8 | all the values in a period, and selecting the value in the middle of the sorted array. |
| 9 | |
| 10 | Netdata also supports `trimmed-median`, which trims a percentage of the smaller and bigger values prior to finding the |
| 11 | median. The following `trimmed-median` functions are defined: |
| 12 | |
| 13 | - `trimmed-median1` |
| 14 | - `trimmed-median2` |
| 15 | - `trimmed-median3` |
| 16 | - `trimmed-median5` |
| 17 | - `trimmed-median10` |
| 18 | - `trimmed-median15` |
| 19 | - `trimmed-median20` |
| 20 | - `trimmed-median25` |
| 21 | |
| 22 | The function `trimmed-median` is an alias for `trimmed-median5`. |
| 23 | |
| 24 | ## how to use |
| 25 | |
| 26 | Use it in alerts like this: |
| 27 | |
| 28 | ``` |
| 29 | alarm: my_alert |
| 30 | on: my_chart |
| 31 | lookup: median -1m unaligned of my_dimension |
| 32 | warn: $this > 1000 |
| 33 | ``` |
| 34 | |
| 35 | `median` does not change the units. For example, if the chart units is `requests/sec`, the result |
| 36 | will be again expressed in the same units. |
| 37 | |
| 38 | It can also be used in APIs and badges as `&group=median` in the URL. Additionally, a percentage may be given with |
| 39 | `&group_options=` to trim all small and big values before finding the median. |
| 40 | |
| 41 | ## Examples |
| 42 | |
| 43 | Examining last 1 minute `successful` web server responses: |
| 44 | |
| 45 | -  |
| 46 | -  |
| 47 | -  |
| 48 | -  |
| 49 | |
| 50 | ## References |
| 51 | |
| 52 | - <https://en.wikipedia.org/wiki/Median>. |
| 53 | |
| 54 |