Update the README.md.

This commit is contained in:
Random-Liu
2017-02-15 13:07:01 -08:00
parent 10fc831409
commit dba47bdc27
2 changed files with 43 additions and 21 deletions
+3 -3
View File
@@ -49,12 +49,12 @@ List of supported problem daemons:
| Problem Daemon | NodeCondition | Description | | Problem Daemon | NodeCondition | Description |
|----------------|:---------------:|:------------| |----------------|:---------------:|:------------|
| [KernelMonitor](https://github.com/kubernetes/node-problem-detector/tree/master/pkg/logmonitor) | KernelDeadlock | A problem daemon monitors kernel log and reports problem according to predefined rules. | | [KernelMonitor](https://github.com/kubernetes/node-problem-detector/blob/master/config/kernel-monitor.json) | KernelDeadlock | A system log monitor monitors kernel log and reports problem according to predefined rules. |
# Usage # Usage
## Flags ## Flags
* `--version`: Print current version of node-problem-detector. * `--version`: Print current version of node-problem-detector.
* `--kernel-monitor`: The configuration used by the kernel monitor, e.g. * `--system-log-monitor`: The configuration used by the system log monitor, e.g.
[config/kernel-monitor.json](https://github.com/kubernetes/node-problem-detector/blob/master/config/kernel-monitor.json). [config/kernel-monitor.json](https://github.com/kubernetes/node-problem-detector/blob/master/config/kernel-monitor.json).
* `--apiserver-override`: A URI parameter used to customize how node-problem-detector * `--apiserver-override`: A URI parameter used to customize how node-problem-detector
connects the apiserver. The format is same as the connects the apiserver. The format is same as the
@@ -112,7 +112,7 @@ spec:
hostPath: hostPath:
path: /etc/localtime path: /etc/localtime
``` ```
* Edit node-problem-detector.yaml to fit your environment: Set `log` volume to your system log diretory. (Used by KernelMonitor) * Edit node-problem-detector.yaml to fit your environment: Set `log` volume to your system log diretory. (Used by SystemLogMonitor)
* Create the DaemonSet with `kubectl create -f node-problem-detector.yaml` * Create the DaemonSet with `kubectl create -f node-problem-detector.yaml`
* If needed, you can use [ConfigMap](http://kubernetes.io/docs/user-guide/configmap/) * If needed, you can use [ConfigMap](http://kubernetes.io/docs/user-guide/configmap/)
to overwrite the `config/`. to overwrite the `config/`.
+40 -18
View File
@@ -1,21 +1,22 @@
# Kernel Monitor # System Log Monitor
*Kernel Monitor* is a problem daemon in node problem detector. It monitors kernel log *System Log Monitor* is a problem daemon in node problem detector. It monitors
and detects known kernel issues following predefined rules. specified system daemon log and detects problems following predefined rules.
The Kernel Monitor matches kernel issues according to a set of predefined rule list in The System Log Monitor matches problems according to a set of predefined rule list in
[`config/kernel-monitor.json`](https://github.com/kubernetes/node-problem-detector/blob/master/config/kernel-monitor.json). the configuration files. (
[`config/kernel-monitor.json`](https://github.com/kubernetes/node-problem-detector/blob/master/config/kernel-monitor.json) as an example).
The rule list is extensible. The rule list is extensible.
## Limitations ## Limitations
* Kernel Monitor only supports syslog (rsyslog) and journald now, but it is easy * System Log Monitor only supports file based log and journald now, but it is easy
to extend it with [new log watcher](#new-log-watcher) to extend it with [new log watcher](#new-log-watcher)
## Add New NodeConditions ## Add New NodeConditions
To support new node conditions, you can extend the `conditions` field in To support new node conditions, you can extend the `conditions` field in
`config/kernel-monitor.json` with new condition definition: the configuration file with new condition definition:
```json ```json
{ {
@@ -27,7 +28,7 @@ To support new node conditions, you can extend the `conditions` field in
## Detect New Problems ## Detect New Problems
To detect new problems, you can extend the `rules` field in `config/kernel-monitor.json` To detect new problems, you can extend the `rules` field in the configuration file
with new rule definition: with new rule definition:
```json ```json
@@ -35,27 +36,48 @@ with new rule definition:
"type": "temporary/permanent", "type": "temporary/permanent",
"condition": "NodeConditionOfPermanentIssue", "condition": "NodeConditionOfPermanentIssue",
"reason": "CamelCaseShortReason", "reason": "CamelCaseShortReason",
"message": "regexp matching the issue in the kernel log" "message": "regexp matching the issue in the log"
} }
``` ```
## Log Watchers ## Log Watchers
Kernel monitor supports different log management tools with different log System log monitor supports different log management tools with different log
watchers: watchers:
* [syslog](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/logmonitor/logwatchers/syslog) * [filelog](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/systemlogmonitor/logwatchers/filelog): Log watcher for
* [journald](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/logmonitor/logwatchers/journald) arbitrary file based log.
* [journald](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/systemlogmonitor/logwatchers/journald): Log watcher for
journald.
Set `plugin` in the configuration file to specify log watcher.
### Plugin Configuration
Log watcher specific configurations are configured in `pluginConfig`.
* **journald**
* source: The [`SYSLOG_IDENTIFIER`](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html)
of the log to watch.
* **filelog**:
* timestamp: The regular expression used to match timestamp in the log line.
Submatch is supported, but only the last result will be used as the actual
timestamp.
* message: The regular expression used to match message in the log line.
Submatch is supported, but only the last result will be used as the actual
message.
* timestampFormat: The format of the timestamp. The format string is the time
`2006-01-02T15:04:05Z07:00` in the expected format. (See
[golang timestamp format](https://golang.org/pkg/time/#pkg-constants))
### Change Log Path ### Change Log Path
Kernel log on different OS distros may locate in different path. The `logPath` Log on different OS distros may locate in different path. The `logPath`
field in `config/kernel-monitor.json` is the log path inside the container. field in the configurtion file is the log path. You can always configure
You can always configure `logPath` and volume mount to match your OS distro. `logPath` to match your OS distro.
* syslog: `logPath` is the kernel log path, usually `/var/log/kern.log`. * filelog: `logPath` is the path of log file, e.g. `/var/log/kern.log` for kernel
log.
* journald: `logPath` is the journal log directory, usually `/var/log/journal`. * journald: `logPath` is the journal log directory, usually `/var/log/journal`.
### New Log Watcher ### New Log Watcher
Kernel monitor uses [Log System log monitor uses [Log
Watcher](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/logmonitor/logwatchers/types/log_watcher.go) to support different log management tools. Watcher](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/systemlogmonitor/logwatchers/types/log_watcher.go) to support different log management tools.
It is easy to implement a new log watcher. It is easy to implement a new log watcher.