Skip to content

Instantly share code, notes, and snippets.

@svet-b
svet-b / grafana_pdf_via_snapshot.md
Last active December 27, 2022 09:01
PDF export of Grafana dashboard via snapshot

Get PDF export of Grafana dashboard

Note

As currently described, this approach does not work. The reason for that is that creating a snapshot via the API does not actually populate any data, as described in e.g. https://community.grafana.com/t/snapshot-using-http-api-does-nothing/. An alternative approach which does work described in https://gist.github.com/svet-b/1ad0656cd3ce0e1a633e16eb20f66425.

Prerequisites

Packages:

  • The jq JSON processing command line tool, which is available for most distributions (https://stedolan.github.io/jq/, sudo apt install jq)
  • NodeJS, and the puppeteer package (npm install puppeteer), which is used to run headless Chrome
jQuery(function( $ ){
if( ! $().select2() || typeof( wc_params ) == "undefined" ) return;
$('#woocommerce_edostavka_city_origin_name').select2({
placeholder: 'Выберите город',
placeholderOption: 'first',
width: '100%',
ajax: {
url: wc_params.api_url,