Fix: override entrypoint to run promtool (prom/prometheus image default entrypoint is prometheus, not sh)
This commit is contained in:
18
backfill.sh
18
backfill.sh
@@ -11,15 +11,27 @@ echo ""
|
||||
echo "Step 1: Stopping Prometheus..."
|
||||
docker stop timmy-prometheus
|
||||
|
||||
# 2. Copy backfill file into the Prometheus data volume
|
||||
# 2. Create TSDB blocks using promtool (override entrypoint)
|
||||
echo "Step 2: Creating TSDB blocks from historical data..."
|
||||
|
||||
# Run promtool inside a temporary container with access to the Prometheus volume
|
||||
docker run --rm \
|
||||
--entrypoint promtool \
|
||||
-v timmy-telemetry_prometheus-data:/prometheus \
|
||||
-v "$(pwd)/backfill.txt:/tmp/backfill.txt:ro" \
|
||||
prom/prometheus:latest \
|
||||
promtool tsdb create-blocks-from openmetrics /tmp/backfill.txt /prometheus
|
||||
tsdb create-blocks-from openmetrics /tmp/backfill.txt /prometheus
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ""
|
||||
echo "promtool not available in image, trying alternative..."
|
||||
# Some prometheus images don't ship promtool — download it
|
||||
docker run --rm \
|
||||
--entrypoint /bin/sh \
|
||||
-v timmy-telemetry_prometheus-data:/prometheus \
|
||||
-v "$(pwd)/backfill.txt:/tmp/backfill.txt:ro" \
|
||||
prom/prometheus:latest \
|
||||
-c "ls /bin/prom*; ls /usr/bin/prom*; which promtool" 2>&1 || true
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Step 3: Restarting Prometheus..."
|
||||
|
||||
Reference in New Issue
Block a user