summaryrefslogtreecommitdiff
path: root/scripts/run.sh
blob: d6036397bf6653ea26b8bbf625cae859501123a6 (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
#!/bin/bash

# Simple script to run Epimetheus
# Automatically sets up port-forwarding and runs the binary
# Run from repo root: ./scripts/run.sh

set -e

echo "Starting Epimetheus..."
echo ""
echo "Step 1: Setting up port-forward to Pushgateway..."
kubectl port-forward -n monitoring svc/pushgateway 9091:9091 > /tmp/pushgateway-port-forward.log 2>&1 &
PF_PID=$!

# Wait for port-forward to be ready
sleep 2

echo "Step 2: Running epimetheus binary (realtime mode)..."
echo "Press Ctrl+C to stop"
echo ""

# Run from repo root so ./epimetheus resolves
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$REPO_ROOT"

# Run the binary in realtime mode and capture its exit status
./epimetheus -mode=realtime -continuous
EXIT_CODE=$?

# Clean up port-forward
echo ""
echo "Cleaning up port-forward..."
kill $PF_PID 2>/dev/null || true

echo "Done!"
exit $EXIT_CODE