Prometheus export / import data for backup

Since Prometheus version 2.1 it is possible to ask the server for a snapshot. The documentation provides more details - https://web.archive.org/web/20200101000000/https://prometheus.io/docs/prometheus/2.1/querying/api/#snapshot

Once a snapshot is created, it can be copied somewhere for safe keeping and if required a new server can be created using this snapshot as its database.

The documentation website constantly changes all the URLs, this links to fairly recent documentation on this - https://prometheus.io/docs/prometheus/latest/querying/api/#tsdb-admin-apis


There is no export and especially no import feature for Prometheus.

If you need to keep data collected by prometheus for some reason, consider using the remote write interface to write it somewhere suitable for archival, such as InfluxDB (configured as a time-series database).

Prometheus isn't a long term storage: if the database is lost, the user is expected to shrug, mumble "oh well", and restart Prometheus.

credits and many thanks to amorken from IRC #prometheus.