From aadb42cc9cb6a2d999260c6fcafe8647950d9de3 Mon Sep 17 00:00:00 2001 From: ekhudiyev <88712424+ekhudiyev@users.noreply.github.com> Date: Mon, 13 Dec 2021 14:38:19 +0400 Subject: Updated document with health-check script example. --- docs/configexamples/dual-hub-dmvpn.rst | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/configexamples/dual-hub-dmvpn.rst b/docs/configexamples/dual-hub-dmvpn.rst index ea4d69f7..8659a896 100644 --- a/docs/configexamples/dual-hub-dmvpn.rst +++ b/docs/configexamples/dual-hub-dmvpn.rst @@ -162,7 +162,22 @@ _________________________________________ .. code-block:: none - TBC + #!/bin/bash + + eth0status="$(cat /sys/class/net/eth0/operstate | grep 'up')" + + if [[ ! -z ${eth0status} ]]; then + eth0gw="$(ip -j r show 0.0.0.0/0 dev eth0 | awk 'match($0, /\"gateway":\"([[:digit:]\.]+)/, gw) {print gw[1]}')" + if [[ ! -z $eth0gw ]]; then + /bin/ping -I eth0 -c 1 -W 1 $eth0gw && exit 0 || exit 1 + else + exit 1 + fi + else + #Exit 0 because eth0 down is handled by vrrp transition + exit 0 + fi + **Note**: some parts of the script might be dependent on your network topology and connectivity. Be careful before using it on your own devices. -- cgit v1.2.3