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.
1.5 KiB
1.5 KiB
Chamado Health
Simple health check script for Healthchecks.io, designed to run every minute using a systemd timer.
Installation
Run the setup script:
bash setup.sh
The script will:
- Ask for your
HEALTHCHECK_URL(Healthchecks.io ping endpoint) and validate it. - Ask for a
DEVICE_NAMEto identify this machine. - Clone the repository to
~/src/health-monitor. - Save the configuration to
~/.config/health-monitor. - Install and enable the systemd timer via
install_systemd.sh. - Run a test ping to confirm everything works.
Both
HEALTHCHECK_URLandDEVICE_NAMEcan be pre-set as environment variables to skip the interactive prompts.
Configuration
The configuration file is ~/.config/health-monitor:
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:
./healthcheck.py https://hc-ping.com/<your-uuid>
Systemd units
The unit files installed to ~/.config/systemd/user/ are:
health-check.servicehealth-check.timer
To reload and restart after changes:
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
- Sends an HTTP GET to the configured Healthchecks.io URL.
- Exits with code
0when the request succeeds with2xx. - Logs diagnostic errors to journal if the request fails.