Had the same issue so really grateful for this. However, bash doesn't seem to be installed by default and I didn't want to install it specifically for this so implemented the same capability but slightly differently (more inline with the example in the docs looking back).
Monit:
1. Service settings:
Add test:
- Condition: failed ping4 count 3 with timeout 3 seconds for 2 cycles
- Action: Restart
2. Add a service:
- Type: "Remote Host"
- Address: <the WireGuard server's IP address>.
- Tests: <the defined ping test>
- Start: /usr/local/opnsense/scripts/Wireguard/wg-service-control.php start <wireguard instance uuid>
- Stop: /usr/local/opnsense/scripts/Wireguard/wg-service-control.php stop <wireguard instance uuid>
Achieves the same result but without installing bash - keeping my fingers crossed it works! But thanks again, your post was a real help.
Monit:
1. Service settings:
Add test:
- Condition: failed ping4 count 3 with timeout 3 seconds for 2 cycles
- Action: Restart
2. Add a service:
- Type: "Remote Host"
- Address: <the WireGuard server's IP address>.
- Tests: <the defined ping test>
- Start: /usr/local/opnsense/scripts/Wireguard/wg-service-control.php start <wireguard instance uuid>
- Stop: /usr/local/opnsense/scripts/Wireguard/wg-service-control.php stop <wireguard instance uuid>
Achieves the same result but without installing bash - keeping my fingers crossed it works! But thanks again, your post was a real help.