runtime-check.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/bin/sh
  2. wait_for() {
  3. host="${1}"
  4. port="${2}"
  5. name="${3}"
  6. timeout="30"
  7. if command -v nc > /dev/null ; then
  8. netcat="nc"
  9. elif command -v netcat > /dev/null ; then
  10. netcat="netcat"
  11. else
  12. printf "Unable to find a usable netcat command.\n"
  13. return 1
  14. fi
  15. printf "Waiting for %s on %s:%s ... " "${name}" "${host}" "${port}"
  16. sleep 30
  17. i=0
  18. while ! ${netcat} -z "${host}" "${port}"; do
  19. sleep 1
  20. if [ "$i" -gt "$timeout" ]; then
  21. printf "Timed out!\n"
  22. return 2
  23. fi
  24. i="$((i + 1))"
  25. done
  26. printf "OK\n"
  27. }
  28. wait_for localhost 19999 netdata
  29. case $? in
  30. 1) exit 2 ;;
  31. 2) exit 3 ;;
  32. esac
  33. curl -sfS http://127.0.0.1:19999/api/v1/info > ./response || exit 1
  34. cat ./response
  35. jq '.version' ./response || exit 1
  36. curl -sfS http://127.0.0.1:19999/index.html || exit 1
  37. curl -sfS http://127.0.0.1:19999/v0/index.html || exit 1
  38. curl -sfS http://127.0.0.1:19999/v1/index.html || exit 1
  39. curl -sfS http://127.0.0.1:19999/v2/index.html || exit 1
  40. NETDATA_LIBEXEC_PARTS="
  41. plugins.d/apps.plugin
  42. plugins.d/cgroup-network
  43. plugins.d/charts.d.plugin
  44. plugins.d/cups.plugin
  45. plugins.d/debugfs.plugin
  46. plugins.d/ebpf.plugin
  47. plugins.d/freeipmi.plugin
  48. plugins.d/go.d.plugin
  49. plugins.d/ioping.plugin
  50. plugins.d/local-listeners
  51. plugins.d/logs-management.plugin
  52. plugins.d/ndsudo
  53. plugins.d/network-viewer.plugin
  54. plugins.d/nfacct.plugin
  55. plugins.d/perf.plugin
  56. plugins.d/python.d.plugin
  57. plugins.d/slabinfo.plugin
  58. plugins.d/xenstat.plugin
  59. "
  60. if [ -d "${NETDATA_LIBEXEC_PREFIX}" ]; then
  61. success=1
  62. for part in ${NETDATA_LIBEXEC_PARTS}; do
  63. # shellcheck disable=SC2254
  64. if echo "${part}" | grep -qE "${NETDATA_SKIP_LIBEXEC_PARTS}"; then
  65. continue
  66. fi
  67. if [ ! -x "${NETDATA_LIBEXEC_PREFIX}/${part}" ]; then
  68. success=0
  69. echo "!!! ${NETDATA_LIBEXEC_PREFIX}/${part} is missing"
  70. fi
  71. done
  72. if [ "${success}" -eq 0 ]; then
  73. exit 1
  74. fi
  75. fi