|
| 1 | +# Kernel Monitor |
| 2 | + |
| 3 | +*Kernel Monitor* is a problem daemon in node problem detector. It monitors kernel log |
| 4 | +and detects known kernel issues following predefined rules. |
| 5 | + |
| 6 | +The Kernel Monitor matches kernel issues according to a set of predefined rule list in |
| 7 | +[`config/kernel-monitor.json`](https://github.com/kubernetes/node-problem-detector/blob/master/config/kernel-monitor.json). |
| 8 | +The rule list is extensible. |
| 9 | + |
| 10 | +## Limitations |
| 11 | + |
| 12 | +* Kernel Monitor only supports file based kernel log now. It doesn't support log tools |
| 13 | +like journald. There is an [open issue](https://github.com/kubernetes/node-problem-detector/issues/14) |
| 14 | +to add journald support. |
| 15 | + |
| 16 | +* Kernel Monitor has assumption on kernel log format, now it only works on Ubuntu and |
| 17 | +Debian. However, it is easy to extend it to [support other log format](#support-other-log-format). |
| 18 | + |
| 19 | +## Add New NodeConditions |
| 20 | + |
| 21 | +To support new node conditions, you can extend the `conditions` field in |
| 22 | +`config/kernel-monitor.json` with new condition definition: |
| 23 | + |
| 24 | +```json |
| 25 | +{ |
| 26 | + "type": "NodeConditionType", |
| 27 | + "reason": "CamelCaseDefaultNodeConditionReason", |
| 28 | + "message": "arbitrary default node condition message" |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +## Detect New Problems |
| 33 | + |
| 34 | +To detect new problems, you can extend the `rules` field in `config/kernel-monitor.json` |
| 35 | +with new rule definition: |
| 36 | + |
| 37 | +```json |
| 38 | +{ |
| 39 | + "type": "temporary/permanent", |
| 40 | + "condition": "NodeConditionOfPermanentIssue", |
| 41 | + "reason": "CamelCaseShortReason", |
| 42 | + "message": "regexp matching the issue in the kernel log" |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +## Change Log Path |
| 47 | + |
| 48 | +Kernel log in different OS distros may locate in different path. The `log` |
| 49 | +field in `config/kernel-monitor.json` is the log path inside the container. |
| 50 | +You can always configure it to match your OS distro. |
| 51 | + |
| 52 | +## Support Other Log Format |
| 53 | + |
| 54 | +Kernel monitor uses [`Translator`](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/kernelmonitor/translator/translator.go) |
| 55 | +plugin to translate kernel log the internal data structure. It is easy to |
| 56 | +implement a new translator for a new log format. |
0 commit comments