docs: atualizar README para refletir setup.sh e install_systemd.sh
Corrige nomes de unit files (health-check.*), caminho do arquivo de configuração (~/.config/health-monitor), documenta setup.sh como ponto de entrada da instalação e adiciona DEVICE_NAME às variáveis de config.
This commit is contained in:
parent
11bcf52a70
commit
1dce175a98
1 changed files with 39 additions and 28 deletions
57
README.md
57
README.md
|
|
@ -4,42 +4,53 @@ Simple health check script for Healthchecks.io, designed to run every minute usi
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Copy the systemd unit files to your user systemd directory:
|
Run the setup script:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p ~/.config/systemd/user
|
bash setup.sh
|
||||||
cp systemd/chamado-health.service ~/.config/systemd/user/
|
|
||||||
cp systemd/chamado-health.timer ~/.config/systemd/user/
|
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Update the `HEALTHCHECK_URL` in the service unit or set it in `~/.config/chamado-health`.
|
The script will:
|
||||||
|
1. Ask for your `HEALTHCHECK_URL` (Healthchecks.io ping endpoint) and validate it.
|
||||||
|
2. Ask for a `DEVICE_NAME` to identify this machine.
|
||||||
|
3. Clone the repository to `~/src/health-monitor`.
|
||||||
|
4. Save the configuration to `~/.config/health-monitor`.
|
||||||
|
5. Install and enable the systemd timer via `install_systemd.sh`.
|
||||||
|
6. Run a test ping to confirm everything works.
|
||||||
|
|
||||||
3. Reload the user daemon and enable the timer:
|
> Both `HEALTHCHECK_URL` and `DEVICE_NAME` can be pre-set as environment variables to skip the interactive prompts.
|
||||||
|
|
||||||
```bash
|
|
||||||
systemctl --user daemon-reload
|
|
||||||
systemctl --user enable --now chamado-health.timer
|
|
||||||
systemctl --user status chamado-health.timer
|
|
||||||
```
|
|
||||||
|
|
||||||
4. If you change the service or timer unit later, reload the user daemon and restart the timer using the unit name (not the file path):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
systemctl --user daemon-reload
|
|
||||||
systemctl --user restart --now chamado-health.timer
|
|
||||||
systemctl --user list-timers --all | grep chamado-health
|
|
||||||
journalctl --user -u chamado-health.service -n 10 --no-pager
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
- `HEALTHCHECK_URL` must be set to your Healthchecks.io ping endpoint.
|
The configuration file is `~/.config/health-monitor`:
|
||||||
- You can also pass the URL as a command-line argument to the script:
|
|
||||||
|
```
|
||||||
|
HEALTHCHECK_URL=https://hc-ping.com/<your-uuid>
|
||||||
|
DEVICE_NAME=my-machine
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also pass the URL as a command-line argument to the script:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./healthcheck.py https://hc-ping.com/<your-uuid>
|
./healthcheck.py https://hc-ping.com/<your-uuid>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Systemd units
|
||||||
|
|
||||||
|
The unit files installed to `~/.config/systemd/user/` are:
|
||||||
|
|
||||||
|
- `health-check.service`
|
||||||
|
- `health-check.timer`
|
||||||
|
|
||||||
|
To reload and restart after changes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl --user daemon-reload
|
||||||
|
systemctl --user restart health-check.timer
|
||||||
|
systemctl --user list-timers --all | grep health-check
|
||||||
|
journalctl --user -u health-check.service -n 10 --no-pager
|
||||||
|
```
|
||||||
|
|
||||||
## Script behavior
|
## Script behavior
|
||||||
|
|
||||||
- Sends an HTTP GET to the configured Healthchecks.io URL.
|
- Sends an HTTP GET to the configured Healthchecks.io URL.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue