Skip to content

Instantly share code, notes, and snippets.

@growse
Created June 27, 2023 11:50
Show Gist options
  • Save growse/5639073c93ef72b308e32771de1c72fb to your computer and use it in GitHub Desktop.
Save growse/5639073c93ef72b308e32771de1c72fb to your computer and use it in GitHub Desktop.
Prometheus snapshot server
#!/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