docs: atualizar README para refletir setup.sh e install_systemd.sh

Corrige nomes de unit files, caminho do arquivo de configuração, documenta setup.sh como ponto de entrada e adiciona guia de instalação completo do zero (git, python3, clone, setup).
This commit is contained in:
SantosFC 2026-06-08 07:24:06 -03:00 committed by GitHub
parent 11bcf52a70
commit 6239b0988f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,42 +4,80 @@ 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: ### 1. Install Git
```bash ```bash
mkdir -p ~/.config/systemd/user # Debian/Ubuntu
cp systemd/chamado-health.service ~/.config/systemd/user/ sudo apt update && sudo apt install -y git python3
cp systemd/chamado-health.timer ~/.config/systemd/user/
# RHEL/CentOS/Fedora
sudo dnf install -y git python3
``` ```
2. Update the `HEALTHCHECK_URL` in the service unit or set it in `~/.config/chamado-health`. ### 2. Configure Git identity
3. Reload the user daemon and enable the timer:
```bash ```bash
systemctl --user daemon-reload git config --global user.name "Your Name"
systemctl --user enable --now chamado-health.timer git config --global user.email "you@example.com"
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): ### 3. Clone the repository
```bash ```bash
systemctl --user daemon-reload mkdir -p ~/src
systemctl --user restart --now chamado-health.timer git clone https://github.com/SantosFC/health-check.git ~/src/health-monitor
systemctl --user list-timers --all | grep chamado-health cd ~/src/health-monitor
journalctl --user -u chamado-health.service -n 10 --no-pager
``` ```
### 4. Run the setup script
```bash
bash setup.sh
```
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. Save the configuration to `~/.config/health-monitor`.
4. Install and enable the systemd timer.
5. Run a test ping to confirm everything works.
> Both `HEALTHCHECK_URL` and `DEVICE_NAME` can be pre-set as environment variables to skip the interactive prompts:
> ```bash
> HEALTHCHECK_URL=https://hc-ping.com/<your-uuid> DEVICE_NAME=my-machine bash setup.sh
> ```
## 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.