Skip to main content

Getting Started with grafanalib

Documentation Status

Do you like Grafana but wish you could version your dashboard configuration? Do you find yourself repeating common patterns? If so, grafanalib is for you.

grafanalib lets you generate Grafana dashboards from simple Python scripts.

How it works

Take a look at the examples directory, e.g. this dashboard will configure a dashboard with a single row, with one QPS graph broken down by status code and another latency graph showing median and 99th percentile latency.

In the code is a fair bit of repetition here, but once you figure out what works for your needs, you can factor that out. See our Weave-specific customizations for inspiration.

You can read the entire grafanlib documentation on readthedocs.io.

Getting started

grafanalib is just a Python package, so:

$ pip install grafanalib

Generate the JSON dashboard like so:

$ curl -o example.dashboard.py https://raw.githubusercontent.com/weaveworks/grafanalib/main/grafanalib/tests/examples/example.dashboard.py
$ generate-dashboard -o frontend.json example.dashboard.py

Support

This library is in its very early stages. We’ll probably make changes that break backwards compatibility, although we’ll try hard not to.

grafanalib works with Python 3.6 through 3.11.

Developing

If you’re working on the project, and need to build from source, it’s done as follows:

$ virtualenv .env
$ . ./.env/bin/activate
$ pip install -e .

Configuring Grafana Datasources

This repo used to contain a program gfdatasource for configuring Grafana data sources, but it has been retired since Grafana now has a built-in way to do it. See https://grafana.com/docs/administration/provisioning/#datasources

Community

We currently don’t follow a roadmap for grafanalib and both maintainers <https://github.com/weaveworks/grafanalib/blob/main/MAINTAINERS> have recently become somewhat occupied otherwise.

We’d like you to join the grafanalib community! If you would like to help out maintaining grafanalib that would be great. It’s a fairly laid-back and straight-forward project. Please talk to us on Slack (see the links below).

We follow the CNCF Code of Conduct.

Getting Help

If you have any questions about, feedback for or problems with grafanalib:

Your feedback is always welcome!

Release files for grafanalib 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grafanalib 0.7.1
File Size Uploaded
grafanalib-0.7.1.tar.gz 59.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for grafanalib 0.7.1
File Interpreter ABI Platform
grafanalib-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 122.4 kB

Release files / grafanalib-0.7.1.tar.gz

Download URL grafanalib-0.7.1.tar.gz
Size 59.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3d92bb4e92ae78fe4e21c5b252ab51f4fdcacd8523ba5a44545b897b2a375b83
BLAKE2b-256 checksum
How to use checksums
b7a4e413c2aa91e3ea631b0493f0c1473d6a48afa1fdc2b576ae6364a372bf30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / grafanalib-0.7.1-py3-none-any.whl

Download URL grafanalib-0.7.1-py3-none-any.whl
Size 62.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fab5d7b837a1f2d1322ef762cd52e565ec0422707a7512765c59f668bdceb58
BLAKE2b-256 checksum
How to use checksums
d36e825081b0ae89031ec16de0c57bf6dbb06d26b69dc938c3461c831e409c9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.14

2 release files

0.5.13

2 release files

0.5.12

2 release files

0.5.10

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

3 release files

0.5.2

3 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page