blob: fa0e0658147fab45d73569223c3be663652335b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/bin/bash
# Backfill historic data to Prometheus for Epimetheus dashboard
set -e
echo "=== Epimetheus Historic Data Backfill ==="
echo ""
echo "This script will populate Prometheus with historic test data"
echo "going back 7 days, with data points every 12 hours."
echo ""
# Port-forward to Prometheus
echo "Step 1: Setting up port-forward to Prometheus..."
kubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 9090:9090 > /tmp/epimetheus-prom-pf.log 2>&1 &
PF_PID=$!
echo "Port-forward started (PID: $PF_PID)"
# Wait for port-forward to be ready
sleep 5
# Run backfill
echo ""
echo "Step 2: Backfilling data from 7 days ago to now (12-hour intervals)..."
echo ""
./epimetheus -mode=backfill \
-prometheus=http://localhost:9090/api/v1/write \
-start-hours=168 \
-end-hours=0 \
-interval=12
EXIT_CODE=$?
# Clean up
echo ""
echo "Step 3: Cleaning up port-forward..."
kill $PF_PID 2>/dev/null || true
if [ $EXIT_CODE -eq 0 ]; then
echo ""
echo "✅ Historic data backfill complete!"
echo ""
echo "The Grafana dashboard timeline should now show data from:"
echo " - 7 days ago"
echo " - 6 days ago"
echo " - 5 days ago"
echo " - 4 days ago"
echo " - 3 days ago"
echo " - 2 days ago"
echo " - 1 day ago"
echo " - 12 hours ago"
echo " - Now (from previous realtime push)"
echo ""
echo "View the dashboard at: https://grafana.f3s.buetow.org/d/epimetheus-test/epimetheus-test-metrics"
else
echo ""
echo "❌ Backfill failed with exit code $EXIT_CODE"
echo "Check /tmp/epimetheus-prom-pf.log for port-forward logs"
fi
exit $EXIT_CODE
|