# pve-net-hang-watchdog

`pve-net-hang-watchdog` este un serviciu simplu care urmareste jurnalul kernel pentru hang-uri de NIC si incearca recuperarea uplink-ului prin `ifdown` si `ifup`.

## Rol

Util pentru noduri Proxmox unde interfata fizica din spatele unui bridge WAN poate intra in stare de hang hardware, iar recovery-ul cel mai pragmatic este ciclarea link-ului.

## Componente

- [bin/pve-net-hang-watchdog.sh](/Users/bogdan/Documents/Workspaces/Xdev/Madagascar/cluster/projects/pve-net-hang-watchdog/bin/pve-net-hang-watchdog.sh) - scriptul principal
- [systemd/pve-net-hang-watchdog.service](/Users/bogdan/Documents/Workspaces/Xdev/Madagascar/cluster/projects/pve-net-hang-watchdog/systemd/pve-net-hang-watchdog.service) - unitatea systemd
- [config/xdev-pve-net-hang-watchdog](/Users/bogdan/Documents/Workspaces/Xdev/Madagascar/cluster/projects/pve-net-hang-watchdog/config/xdev-pve-net-hang-watchdog) - defaults standard
- [scripts/install.sh](/Users/bogdan/Documents/Workspaces/Xdev/Madagascar/cluster/projects/pve-net-hang-watchdog/scripts/install.sh) - install local
- [scripts/uninstall.sh](/Users/bogdan/Documents/Workspaces/Xdev/Madagascar/cluster/projects/pve-net-hang-watchdog/scripts/uninstall.sh) - uninstall canonic
- [setup.sh](/Users/bogdan/Documents/Workspaces/Xdev/Madagascar/cluster/projects/pve-net-hang-watchdog/setup.sh) - wrapper local/remote

## Locatii instalate pe host

- comanda/daemon script: `/usr/local/sbin/pve-net-hang-watchdog.sh`
- uninstall canonic: `/usr/local/lib/xdev/pve-net-hang-watchdog/uninstall.sh`
- wrapper optional pentru uninstall: `/usr/local/sbin/xdev-pve-net-hang-watchdog-uninstall`
- defaults: `/etc/default/xdev-pve-net-hang-watchdog`
- unitate systemd: `/etc/systemd/system/pve-net-hang-watchdog.service`
- documentatie instalata: `/usr/local/share/doc/xdev/pve-net-hang-watchdog`

## Configurare

Parametri suportati prin defaults:

- `WATCH_BRIDGE`
- `WATCH_IFACE`
- `COOLDOWN_SECONDS`
- `HANG_PATTERN`

Daca `WATCH_IFACE` este gol, scriptul incearca sa descopere automat interfata fizica din `bridge-ports`.

## Flux rapid

```bash
sudo ./setup.sh --local
sudo systemctl status pve-net-hang-watchdog.service
```

## Operare

Loguri:

```bash
journalctl -u pve-net-hang-watchdog.service -f
```

Configurare:

```bash
sudo editor /etc/default/xdev-pve-net-hang-watchdog
sudo systemctl restart pve-net-hang-watchdog.service
```

Installerul face si `enable --now`, deci dupa instalare serviciul este deja pornit.

## Uninstall

```bash
sudo ./setup.sh --local --uninstall
```

Sau direct:

```bash
sudo /usr/local/lib/xdev/pve-net-hang-watchdog/uninstall.sh
```
