Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/docker-otel-lgtm
Path: blob/main/docker/run-all.sh
401 views
1
#!/bin/bash
2
3
./run-grafana.sh &
4
./run-loki.sh &
5
./run-otelcol.sh &
6
./run-prometheus.sh &
7
./run-tempo.sh &
8
9
echo "Waiting for the OpenTelemetry collector and the Grafana LGTM stack to start up..."
10
11
function wait_ready() {
12
service=$1
13
url=$2
14
15
while [[ $(curl -o /dev/null -sg "${url}" -w "%{response_code}") != "200" ]] ; do
16
echo "Waiting for ${service} to start up..."
17
sleep 1
18
done
19
echo "${service} is up and running."
20
}
21
22
wait_ready "Grafana" "http://localhost:3000/api/health"
23
wait_ready "Loki" "http://localhost:3100/ready"
24
wait_ready "Prometheus" "http://localhost:9090/api/v1/status/runtimeinfo"
25
wait_ready "Tempo" "http://localhost:3200/ready"
26
27
# we query the otelcol_process_uptime_total metric instead, which checks if the collector is up,
28
# and indirectly checks if the prometheus endpoint is up.
29
while ! curl -sg 'http://localhost:9090/api/v1/query?query=otelcol_process_uptime_total{}' | jq -r .data.result[0].value[1] | grep '[0-9]' > /dev/null ; do
30
echo "Waiting for the OpenTelemetry collector to start up..."
31
sleep 1
32
done
33
34
touch /tmp/ready
35
echo "The OpenTelemetry collector and the Grafana LGTM stack are up and running. (created /tmp/ready)"
36
37
echo "Open ports:"
38
echo " - 4317: OpenTelemetry GRPC endpoint"
39
echo " - 4318: OpenTelemetry HTTP endpoint"
40
echo " - 3000: Grafana. User: admin, password: admin"
41
42
sleep infinity
43
44