GithubHelp home page GithubHelp logo

lu604386020 / grafanatopdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lasagnu/grafanatopdf

0.0 1.0 0.0 468 KB

a service that converts all panels in given dashboard to a PDF report

Python 88.80% Dockerfile 0.50% HTML 6.66% Shell 4.04%

grafanatopdf's Introduction

grafana-pdf-reporter

independent service for generating PDF based on Grafana dashboards, developed mainly for CentOS 7, but might work on different distros/OS with small tweaks.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

For docker-based installation:

CentOS 7, docker, docker-compose

For regular Python-app installation:

CentOS 7, docker, docker-compose, Python3.6+, venv

Installing

Clone repository

git clone https://github.com/lasagnu/GrafanaToPDF/

Enter the dir with reporter:

cd grafana-pdf-reporter/

Make it possible to execute wkhtmltopdf_setup.sh

chmod +x wkhtmltopdf_setup.sh

Execute the script and allow wkhtmltopdf to be installed locally

./wkhtmltopdf_setup.sh

Edit configuration file and provide the IP address and port of Grafana as well as the API key:

Config/__init__.py

Example:

class Grafana:
    address = '192.168.0.1:3000'
    api_key = 'BlAhBlAHblAhBlaHblahsdladOoPaDoOpAdOopAdoOpa=='

Execute as a docker container

Simply run this command to build a container and mount it:

docker-compose -p CONTAINER_NAME up -d

Service should be available on the HOST_IP:5000 by default. It could be changed in the docker-compose.yml:

ports:
            - "<host_port>:5000"

Execute locally as a regular Python app:

I would recommend to install the virtualenv first:

python3 -m venv venv

Once the virtual environment has been established, activate it by:

source venv/bin/activate

And install all dependencies:

pip install -r requirements.txt

Once installed you should be able to run it by using this command:

python3 app.py

Usage

Once the application is up and running, you should be able to generate the PDF with all panels of a dashboard by passing it's UID to the /dashboard endpoint:

localhost:5000/dashboard/<dashboard_uid>

You can view the generated raport once again by accessing the same /dashboard enpoint and passing the ID generated previously

example: localhost:5000/dashboard/1581089563394252

Setting up the link in Grafana

Example

Authors

grafanatopdf's People

Contributors

lasagnu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.