No description
|
|
||
|---|---|---|
| docs | ||
| health_check | ||
| systemd | ||
| .gitignore | ||
| .shellcheckrc | ||
| healthcheck.py | ||
| install_systemd.fish | ||
| install_systemd.sh | ||
| pyproject.toml | ||
| README.md | ||
| setup.fish | ||
| setup.sh | ||
Chamado Health
Simple health check script for Healthchecks.io, designed to run every minute using a systemd timer.
Installation
1. Install Git
# Debian/Ubuntu
sudo apt update && sudo apt install -y git python3
# RHEL/CentOS/Fedora
sudo dnf install -y git python3
2. Configure Git identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
3. Clone the repository
mkdir -p ~/src
git clone https://github.com/SantosFC/health-check.git ~/src/health-check
cd ~/src/health-check
4. 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. - Save the configuration to
~/.config/health-check. - Install and enable the systemd timer.
- Run a test ping to confirm everything works.
Both
HEALTHCHECK_URLandDEVICE_NAMEcan be pre-set as environment variables to skip the interactive prompts:HEALTHCHECK_URL=https://hc-ping.com/<your-uuid> DEVICE_NAME=my-machine bash setup.sh
Configuration
The configuration file is ~/.config/health-check:
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.