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