Ei kuvausta

soc-status.sh 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  4. export IRIS_HTTPS_PORT="${IRIS_HTTPS_PORT:-8443}"
  5. export SHUFFLE_OPENSEARCH_PORT="${SHUFFLE_OPENSEARCH_PORT:-9201}"
  6. export PAGERDUTY_STUB_PORT="${PAGERDUTY_STUB_PORT:-18080}"
  7. export SOC_INTEGRATOR_PORT="${SOC_INTEGRATOR_PORT:-8088}"
  8. check_http() {
  9. local name="$1"
  10. local url="$2"
  11. local insecure="${3:-false}"
  12. local code
  13. if [[ "${insecure}" == "true" ]]; then
  14. code="$(curl -k -sS -o /dev/null -w "%{http_code}" --max-time 5 "${url}" || true)"
  15. else
  16. code="$(curl -sS -o /dev/null -w "%{http_code}" --max-time 5 "${url}" || true)"
  17. fi
  18. if [[ -n "${code}" && "${code}" != "000" ]]; then
  19. printf "%-20s %-7s %s\n" "${name}" "OK" "${url} (HTTP ${code})"
  20. else
  21. printf "%-20s %-7s %s\n" "${name}" "FAIL" "${url}"
  22. fi
  23. }
  24. echo "SOC stack container status"
  25. docker ps -a \
  26. --filter "name=wazuh-single-" \
  27. --filter "name=iriswebapp_" \
  28. --filter "name=shuffle-" \
  29. --filter "name=pagerduty-stub" \
  30. --filter "name=soc-integrator" \
  31. --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
  32. echo
  33. echo "Endpoint checks"
  34. check_http "Wazuh Dashboard" "https://localhost/" "true"
  35. check_http "Wazuh API" "https://localhost:55000/" "true"
  36. check_http "IRIS Web" "https://localhost:${IRIS_HTTPS_PORT}/" "true"
  37. check_http "Shuffle Frontend" "http://localhost:3001/"
  38. check_http "Shuffle Backend" "http://localhost:5001/"
  39. check_http "Shuffle OpenSearch" "https://localhost:${SHUFFLE_OPENSEARCH_PORT}/" "true"
  40. check_http "PagerDuty Stub" "http://localhost:${PAGERDUTY_STUB_PORT}/"
  41. check_http "SOC Integrator" "http://localhost:${SOC_INTEGRATOR_PORT}/health"
  42. echo
  43. echo "Key URLs"
  44. echo "Wazuh Dashboard : https://localhost"
  45. echo "IRIS Web : https://localhost:${IRIS_HTTPS_PORT}"
  46. echo "Shuffle UI : http://localhost:3001"
  47. echo "PagerDuty Stub : http://localhost:${PAGERDUTY_STUB_PORT}"
  48. echo "SOC Integrator : http://localhost:${SOC_INTEGRATOR_PORT}/docs"