Serve Pandas dataframes to Grafana
Project description
About
A REST API based on Flask for serving Pandas Dataframes to Grafana.
This way, a native Python application can be used to directly supply data to Grafana both easily and powerfully.
It was inspired by and is compatible with the simple json datasource.
https://gist.github.com/linar-jether/95ff412f9d19fdf5e51293eb0c09b850
Resources
Example
This is a demo program which generates a sine wave for data and annotations for designating midnight times. For both, we are using NumPy.
Setup
virtualenv .venv --python=python3.8 source .venv/bin/activate pip install -r requirements.txt
Invoke
# Run Grafana. docker run --rm -it \ --publish=3000:3000 --volume="$(pwd)/var/lib/grafana":/var/lib/grafana \ --env='GF_SECURITY_ADMIN_PASSWORD=admin' --env='GF_INSTALL_PLUGINS=grafana-simple-json-datasource' \ grafana/grafana:7.3.6 # Run Grafana Pandas Datasource demo. export PYTHONPATH=$(pwd) python examples/sinewave-midnights/demo.py
Configure
You can have a quickstart by putting examples/sinewave-midnights/datasource.json and examples/sinewave-midnights/dashboard.json into Grafana:
# Login to Grafana. export GRAFANA_URL=http://localhost:3000 http --session=grafana ${GRAFANA_URL} --auth=admin:admin # Create datasource. cat examples/sinewave-midnights/datasource.json | \ http --session=grafana POST ${GRAFANA_URL}/api/datasources # Create dashboard. cat examples/sinewave-midnights/dashboard.json | \ http --session=grafana POST ${GRAFANA_URL}/api/dashboards/db open ${GRAFANA_URL}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for grafana-pandas-datasource-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e816f5c3bec5b1e98cb8aedd68dd66f802455e80dd7b18a0263d1b1fe31a5b7 |
|
MD5 | bdafbd537f2f4fccb285dd2b4043e575 |
|
BLAKE2b-256 | d034d921eced615a533483bc0ae2710289dc6c5d23fc934b273cea06263092ab |
Hashes for grafana_pandas_datasource-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3594b12a37b1a1068bd35f55c894cf8ffd95f47afc808cfac544abae0bc5cfb6 |
|
MD5 | ccdc28ea53d020c0738e87204b4e0ccd |
|
BLAKE2b-256 | aeb6ccc080dd537febb460d2fb2915d981b234ad7e4d95d025452efdc2bd6837 |