diff options
| author | Paul Buetow <paul@buetow.org> | 2025-12-30 22:10:23 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-12-30 22:10:23 +0200 |
| commit | 382e396055c1f4f7d517bd539633d423aa82374d (patch) | |
| tree | 281dc926b20737d3ea22c0e6566433407ed21cb8 /f3s | |
| parent | 7f248f4464f653e0216a7db7327eaace3c39490f (diff) | |
Consolidate into single prometheus-pusher binary
Unified all functionality into one binary instead of multiple variants.
## Changes
- Removed: prometheus-pusher-auto, prometheus-pusher-historic
- Single binary: prometheus-pusher (supports all modes)
- Updated all documentation to reference single binary
- Updated run.sh to use unified binary
## Usage
One binary, four modes:
```bash
# Realtime mode (default)
./prometheus-pusher -mode=realtime -continuous
# Historic mode (single datapoint)
./prometheus-pusher -mode=historic -hours-ago=24
# Backfill mode (range of datapoints)
./prometheus-pusher -mode=backfill -start-hours=48 -end-hours=0 -interval=1
# Auto mode (automatic timestamp detection)
./prometheus-pusher -mode=auto -file=data.csv
```
All features accessible from one unified tool!
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'f3s')
| -rw-r--r-- | f3s/prometheus-pusher/ANSWER.md | 6 | ||||
| -rw-r--r-- | f3s/prometheus-pusher/AUTO-MODE.md | 16 | ||||
| -rw-r--r-- | f3s/prometheus-pusher/HISTORIC.md | 20 | ||||
| -rw-r--r-- | f3s/prometheus-pusher/SETUP-COMPLETE.md | 26 | ||||
| -rwxr-xr-x | f3s/prometheus-pusher/prometheus-pusher | bin | 12149010 -> 14022801 bytes | |||
| -rwxr-xr-x | f3s/prometheus-pusher/prometheus-pusher-auto | bin | 14022801 -> 0 bytes | |||
| -rwxr-xr-x | f3s/prometheus-pusher/prometheus-pusher-historic | bin | 13852824 -> 0 bytes | |||
| -rwxr-xr-x | f3s/prometheus-pusher/run.sh | 6 |
8 files changed, 37 insertions, 37 deletions
diff --git a/f3s/prometheus-pusher/ANSWER.md b/f3s/prometheus-pusher/ANSWER.md index 8766cb0..a6339cb 100644 --- a/f3s/prometheus-pusher/ANSWER.md +++ b/f3s/prometheus-pusher/ANSWER.md @@ -19,7 +19,7 @@ You had to: ### After (AUTO Mode) 🤖 You just: 1. Provide data with timestamps -2. Run: `./prometheus-pusher-auto -mode=auto -file=yourdata.csv` +2. Run: `./prometheus-pusher -mode=auto -file=yourdata.csv` 3. **Done!** The tool automatically detects ages and routes correctly ## Demonstration @@ -71,7 +71,7 @@ kubectl port-forward -n monitoring svc/pushgateway 9091:9091 & kubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 9090:9090 & # 2. Import ALL time ranges in one command! -./prometheus-pusher-auto \ +./prometheus-pusher \ -mode=auto \ -file=test-all-ages.csv \ -pushgateway=http://localhost:9091 \ @@ -188,7 +188,7 @@ And it does this **automatically** - you don't need to think about it! 🎉 Just run: ```bash -./prometheus-pusher-auto -mode=auto -file=your-data.csv +./prometheus-pusher -mode=auto -file=your-data.csv ``` The tool will: diff --git a/f3s/prometheus-pusher/AUTO-MODE.md b/f3s/prometheus-pusher/AUTO-MODE.md index ae791ef..03db0b5 100644 --- a/f3s/prometheus-pusher/AUTO-MODE.md +++ b/f3s/prometheus-pusher/AUTO-MODE.md @@ -32,20 +32,20 @@ Now you can: ```bash # CSV format -./prometheus-pusher-auto -mode=auto -file=metrics.csv -format=csv +./prometheus-pusher -mode=auto -file=metrics.csv -format=csv # JSON format -./prometheus-pusher-auto -mode=auto -file=metrics.json -format=json +./prometheus-pusher -mode=auto -file=metrics.json -format=json ``` ### From Stdin ```bash # Pipe CSV data -cat metrics.csv | ./prometheus-pusher-auto -mode=auto -format=csv +cat metrics.csv | ./prometheus-pusher -mode=auto -format=csv # Interactive input -./prometheus-pusher-auto -mode=auto -format=csv +./prometheus-pusher -mode=auto -format=csv # (then paste data and press Ctrl+D) ``` @@ -132,7 +132,7 @@ kubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 909 kubectl port-forward -n monitoring svc/pushgateway 9091:9091 & # 4. Auto-import all data -./prometheus-pusher-auto \ +./prometheus-pusher \ -mode=auto \ -file=test-all-ages.csv \ -format=csv \ @@ -259,13 +259,13 @@ For very old data (> few months), consider: ./generate-test-data.sh # Import yesterday's backup -./prometheus-pusher-auto -mode=auto -file=backup_yesterday.csv +./prometheus-pusher -mode=auto -file=backup_yesterday.csv # Import last week's logs -./prometheus-pusher-auto -mode=auto -file=logs_lastweek.json -format=json +./prometheus-pusher -mode=auto -file=logs_lastweek.json -format=json # Import current metrics -./prometheus-pusher-auto -mode=auto -file=current_metrics.csv +./prometheus-pusher -mode=auto -file=current_metrics.csv ``` All data is automatically routed to the correct ingestion method! diff --git a/f3s/prometheus-pusher/HISTORIC.md b/f3s/prometheus-pusher/HISTORIC.md index 92da15d..22c397d 100644 --- a/f3s/prometheus-pusher/HISTORIC.md +++ b/f3s/prometheus-pusher/HISTORIC.md @@ -42,14 +42,14 @@ You should see: `msg="Experimental features enabled" features=[remote-write-rece ## Usage -The `prometheus-pusher-historic` binary supports three modes: +The `prometheus-pusher` binary supports three modes: ### Mode 1: Realtime (Default) Push current metrics to Pushgateway (same as before): ```bash -./prometheus-pusher-historic -mode=realtime -continuous +./prometheus-pusher -mode=realtime -continuous ``` Options: @@ -66,13 +66,13 @@ Push a single datapoint from X hours ago: kubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 9090:9090 & # Push data from 24 hours ago -./prometheus-pusher-historic -mode=historic -hours-ago=24 +./prometheus-pusher -mode=historic -hours-ago=24 # Push data from 3 hours ago -./prometheus-pusher-historic -mode=historic -hours-ago=3 +./prometheus-pusher -mode=historic -hours-ago=3 # Push data from yesterday (48 hours ago) -./prometheus-pusher-historic -mode=historic -hours-ago=48 +./prometheus-pusher -mode=historic -hours-ago=48 ``` Options: @@ -85,13 +85,13 @@ Backfill a range of historic data: ```bash # Backfill last 48 hours with 1-hour intervals -./prometheus-pusher-historic -mode=backfill -start-hours=48 -end-hours=0 -interval=1 +./prometheus-pusher -mode=backfill -start-hours=48 -end-hours=0 -interval=1 # Backfill last week with 6-hour intervals -./prometheus-pusher-historic -mode=backfill -start-hours=168 -end-hours=0 -interval=6 +./prometheus-pusher -mode=backfill -start-hours=168 -end-hours=0 -interval=6 # Backfill specific range (24h ago to 12h ago, every 2 hours) -./prometheus-pusher-historic -mode=backfill -start-hours=24 -end-hours=12 -interval=2 +./prometheus-pusher -mode=backfill -start-hours=24 -end-hours=12 -interval=2 ``` Options: @@ -138,7 +138,7 @@ sleep 2 # 2. Backfill data for every hour in the last 24 hours cd /home/paul/git/conf/f3s/prometheus-pusher -./prometheus-pusher-historic \ +./prometheus-pusher \ -mode=backfill \ -prometheus=http://localhost:9090/api/v1/write \ -start-hours=24 \ @@ -222,7 +222,7 @@ For very large historic datasets, you can use `promtool` to create TSDB blocks: ```bash # 1. Generate OpenMetrics format file -./prometheus-pusher-historic -mode=export -output=metrics.txt +./prometheus-pusher -mode=export -output=metrics.txt # 2. Create blocks from the file promtool tsdb create-blocks-from openmetrics metrics.txt /path/to/prometheus/data diff --git a/f3s/prometheus-pusher/SETUP-COMPLETE.md b/f3s/prometheus-pusher/SETUP-COMPLETE.md index 5739a83..c4d6430 100644 --- a/f3s/prometheus-pusher/SETUP-COMPLETE.md +++ b/f3s/prometheus-pusher/SETUP-COMPLETE.md @@ -28,7 +28,7 @@ prometheus-pusher/ ├── main.go # Main entry point with mode selection ├── realtime.go # Original Pushgateway functionality ├── historic.go # NEW: Remote Write with timestamps -├── prometheus-pusher-historic # NEW: Binary with all modes +├── prometheus-pusher # NEW: Binary with all modes └── HISTORIC.md # Complete documentation ``` @@ -93,7 +93,7 @@ cd /home/paul/git/conf/f3s/prometheus-pusher kubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 9090:9090 & # Push data from 24 hours ago -./prometheus-pusher-historic \ +./prometheus-pusher \ -mode=historic \ -hours-ago=24 \ -prometheus=http://localhost:9090/api/v1/write @@ -116,7 +116,7 @@ curl -s 'http://localhost:9090/api/v1/query?query=app_requests_total{job="histor ```bash # Backfill last 48 hours with 2-hour intervals -./prometheus-pusher-historic \ +./prometheus-pusher \ -mode=backfill \ -start-hours=48 \ -end-hours=0 \ @@ -179,13 +179,13 @@ Now you can: ### Realtime Mode ```bash # Single push (original behavior) -./prometheus-pusher-historic -mode=realtime +./prometheus-pusher -mode=realtime # Continuous pushing every 15s -./prometheus-pusher-historic -mode=realtime -continuous +./prometheus-pusher -mode=realtime -continuous # Custom Pushgateway URL -./prometheus-pusher-historic \ +./prometheus-pusher \ -mode=realtime \ -pushgateway=http://custom-pushgateway:9091 \ -job=my_app @@ -194,16 +194,16 @@ Now you can: ### Historic Mode ```bash # Yesterday's data -./prometheus-pusher-historic -mode=historic -hours-ago=24 +./prometheus-pusher -mode=historic -hours-ago=24 # 3 hours ago -./prometheus-pusher-historic -mode=historic -hours-ago=3 +./prometheus-pusher -mode=historic -hours-ago=3 # Last week -./prometheus-pusher-historic -mode=historic -hours-ago=168 +./prometheus-pusher -mode=historic -hours-ago=168 # Custom Prometheus URL -./prometheus-pusher-historic \ +./prometheus-pusher \ -mode=historic \ -hours-ago=24 \ -prometheus=http://custom-prometheus:9090/api/v1/write @@ -212,13 +212,13 @@ Now you can: ### Backfill Mode ```bash # Last 24 hours, hourly -./prometheus-pusher-historic -mode=backfill -start-hours=24 -end-hours=0 -interval=1 +./prometheus-pusher -mode=backfill -start-hours=24 -end-hours=0 -interval=1 # Last week, every 6 hours -./prometheus-pusher-historic -mode=backfill -start-hours=168 -end-hours=0 -interval=6 +./prometheus-pusher -mode=backfill -start-hours=168 -end-hours=0 -interval=6 # Specific range (48h ago to 24h ago, every 2h) -./prometheus-pusher-historic -mode=backfill -start-hours=48 -end-hours=24 -interval=2 +./prometheus-pusher -mode=backfill -start-hours=48 -end-hours=24 -interval=2 ``` ## 📚 Documentation diff --git a/f3s/prometheus-pusher/prometheus-pusher b/f3s/prometheus-pusher/prometheus-pusher Binary files differindex 27a4196..cbb807a 100755 --- a/f3s/prometheus-pusher/prometheus-pusher +++ b/f3s/prometheus-pusher/prometheus-pusher diff --git a/f3s/prometheus-pusher/prometheus-pusher-auto b/f3s/prometheus-pusher/prometheus-pusher-auto Binary files differdeleted file mode 100755 index 62ce6d1..0000000 --- a/f3s/prometheus-pusher/prometheus-pusher-auto +++ /dev/null diff --git a/f3s/prometheus-pusher/prometheus-pusher-historic b/f3s/prometheus-pusher/prometheus-pusher-historic Binary files differdeleted file mode 100755 index 68fbd2c..0000000 --- a/f3s/prometheus-pusher/prometheus-pusher-historic +++ /dev/null diff --git a/f3s/prometheus-pusher/run.sh b/f3s/prometheus-pusher/run.sh index 18811c8..d55fad5 100755 --- a/f3s/prometheus-pusher/run.sh +++ b/f3s/prometheus-pusher/run.sh @@ -14,12 +14,12 @@ PF_PID=$! # Wait for port-forward to be ready sleep 2 -echo "Step 2: Running prometheus-pusher binary..." +echo "Step 2: Running prometheus-pusher binary (realtime mode)..." echo "Press Ctrl+C to stop" echo "" -# Run the binary and capture its exit status -./prometheus-pusher +# Run the binary in realtime mode and capture its exit status +./prometheus-pusher -mode=realtime -continuous EXIT_CODE=$? # Clean up port-forward |
