#!/usr/bin/env bash
# Simple health sweep across cluster components
set -e
targets=("$@")
if [ ${#targets[@]} -eq 0 ]; then
  targets=(192.168.0.254 192.168.0.2 192.168.88.1 192.168.88.20 192.168.88.249)
fi

for t in "${targets[@]}"; do
  printf "Pinging %-15s ... " "$t"
  if ping -c1 -W1 "$t" >/dev/null 2>&1; then
    echo "OK"
  else
    echo "FAIL"
  fi
done
