Petr Ruzicka | ba0a49d | 2018-01-31 22:16:20 +0100 | [diff] [blame] | 1 | |
| 2 | ================================== |
| 3 | Watchdog Formula |
| 4 | ================================== |
| 5 | |
Petr Ruzicka | 802abc2 | 2018-03-19 08:49:43 +0100 | [diff] [blame] | 6 | The Linux kernel can reset the system if serious problems are detected. This can |
| 7 | be implemented via special watchdog hardware, or via a slightly less reliable |
| 8 | software-only watchdog inside the kernel. Either way, there needs to be a daemon |
| 9 | that tells the kernel the system is working fine. If the daemon stops doing that, |
| 10 | the system is reset. |
Petr Ruzicka | ba0a49d | 2018-01-31 22:16:20 +0100 | [diff] [blame] | 11 | |
Petr Ruzicka | 802abc2 | 2018-03-19 08:49:43 +0100 | [diff] [blame] | 12 | watchdog is such a daemon. It opens `/dev/watchdog`, and keeps writing to it |
| 13 | often enough to keep the kernel from resetting, at least once per minute. Each |
| 14 | write delays the reboot time another minute. After a minute of inactivity the |
| 15 | watchdog hardware will cause the reset. In the case of the software watchdog the |
| 16 | ability to reboot will depend on the state of the machines and interrupts. |
| 17 | |
azvyagintsev | 8731ac4 | 2018-04-30 14:03:00 +0300 | [diff] [blame] | 18 | This formula installs and configure watchdog daemon |
Petr Ruzicka | ba0a49d | 2018-01-31 22:16:20 +0100 | [diff] [blame] | 19 | |
| 20 | Sample Pillars |
| 21 | ============== |
| 22 | |
| 23 | Single watchdog service |
| 24 | |
| 25 | .. code-block:: yaml |
| 26 | |
| 27 | watchdog: |
| 28 | server: |
Petr Ruzicka | 7a333c3 | 2018-02-01 14:02:59 +0100 | [diff] [blame] | 29 | admin: root |
Petr Ruzicka | ba0a49d | 2018-01-31 22:16:20 +0100 | [diff] [blame] | 30 | enabled: true |
Petr Ruzicka | 7a333c3 | 2018-02-01 14:02:59 +0100 | [diff] [blame] | 31 | interval: 1 |
| 32 | log_dir: /var/log/watchdog |
| 33 | realtime: yes |
Petr Ruzicka | ba0a49d | 2018-01-31 22:16:20 +0100 | [diff] [blame] | 34 | timeout: 60 |
Petr Ruzicka | 7a333c3 | 2018-02-01 14:02:59 +0100 | [diff] [blame] | 35 | device: /dev/watchdog |
| 36 | |
azvyagintsev | 8731ac4 | 2018-04-30 14:03:00 +0300 | [diff] [blame] | 37 | |
| 38 | Sample Pillars with kernel module |
| 39 | ================================= |
| 40 | |
| 41 | Salt Stack will automatically detect the necessary kernel module which needs to be loaded (ex. hpwdt, iTCO_wdt). |
| 42 | If the hardware model is not predefined in map.jinja the default watchdog driver is used: softdog |
| 43 | You may specify the kernel parameters if needed: |
| 44 | |
| 45 | .. code-block:: yaml |
| 46 | |
| 47 | watchdog: |
| 48 | server: |
| 49 | admin: root |
| 50 | enabled: true |
| 51 | interval: 1 |
| 52 | log_dir: /var/log/watchdog |
| 53 | realtime: yes |
| 54 | timeout: 60 |
| 55 | device: /dev/watchdog |
| 56 | module: softdog |
| 57 | ...... |
| 58 | ...... |
| 59 | linux: |
| 60 | system: |
Petr Ruzicka | ba0a49d | 2018-01-31 22:16:20 +0100 | [diff] [blame] | 61 | kernel: |
azvyagintsev | 8731ac4 | 2018-04-30 14:03:00 +0300 | [diff] [blame] | 62 | module: |
| 63 | softdog: |
| 64 | option: |
| 65 | soft_panic: 1 |
| 66 | |
Pavel Cizinsky | b71fc89 | 2018-12-12 12:03:39 +0100 | [diff] [blame^] | 67 | INFO: extra formula [salt-formula-linux](https://gerrit.mcp.mirantis.com/salt-formulas/linux) required. |
azvyagintsev | 8731ac4 | 2018-04-30 14:03:00 +0300 | [diff] [blame] | 68 | |
| 69 | In that case, apply command should also care about linux state. For example: |
| 70 | |
| 71 | |
| 72 | .. code-block:: bash |
| 73 | |
| 74 | salt "kvm0*" -l debug state.apply watchdog.server,linux.system.kernel -l debug |
Petr Ruzicka | ba0a49d | 2018-01-31 22:16:20 +0100 | [diff] [blame] | 75 | |
| 76 | |
| 77 | More Information |
| 78 | ================ |
| 79 | |
| 80 | https://github.com/torvalds/linux/blob/master/Documentation/watchdog/watchdog-api.txt |
azvyagintsev | 8731ac4 | 2018-04-30 14:03:00 +0300 | [diff] [blame] | 81 | Those formula also support json-schema definition with all options. |
| 82 | Please refer to "watchdog/schemas/\*.yaml" for more information. |
| 83 | |
Petr Ruzicka | de2a51b | 2018-03-08 13:44:59 +0100 | [diff] [blame] | 84 | To-Do |
Pavel Cizinsky | b71fc89 | 2018-12-12 12:03:39 +0100 | [diff] [blame^] | 85 | ===== |
Petr Ruzicka | de2a51b | 2018-03-08 13:44:59 +0100 | [diff] [blame] | 86 | |
Petr Ruzicka | 802abc2 | 2018-03-19 08:49:43 +0100 | [diff] [blame] | 87 | Remove the part in `watchdog/server.sls` about the Ubuntu Xenial bug once it's fixed in upstream: |
Petr Ruzicka | de2a51b | 2018-03-08 13:44:59 +0100 | [diff] [blame] | 88 | https://bugs.launchpad.net/ubuntu/+source/watchdog/+bug/1448924 |