Created
June 27, 2023 11:50
-
-
Save growse/5639073c93ef72b308e32771de1c72fb to your computer and use it in GitHub Desktop.
Prometheus snapshot server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from flask import Flask, jsonify | |
import requests | |
import click | |
app = Flask(__name__) | |
@app.route("/snapshots", methods=['GET']) | |
def list_snapshots(): | |
return jsonify("hi there") | |
@click.command() | |
@click.argument('prometheus-snapshots-dir', type=click.Path(exists=True), default="/prometheus/prometheus-db/snapshots/") | |
def server(prometheus_snapshots_dir): | |
app.config['prometheus_snapshots_dir'] = prometheus_snapshots_dir | |
app.run(port=8080, host="::") | |
if __name__ == '__main__': | |
server() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment