A set of tools, types and libraries for building and manipulating Grafana objects.
Project description
Grafana Foundation SDK – Python
A set of tools, types and builder libraries for building and manipulating Grafana objects in Python.
ℹ️ This branch contains types and builders generated for Grafana v10.4.x. Other supported versions of Grafana can be found at this repository's root.
Maturity
The code in this repository should be considered experimental. Documentation is only available alongside the code. It comes with no support, but we are keen to receive feedback on the product and suggestions on how to improve it, though we cannot commit to resolution of any particular issue. No SLAs are available. It is not meant to be used in production environments, and the risks are unknown/high.
Grafana Labs defines experimental features as follows:
Projects and features in the Experimental stage are supported only by the Engineering teams; on-call support is not available. Documentation is either limited or not provided outside of code comments. No SLA is provided.
Experimental projects or features are primarily intended for open source engineers who want to participate in ensuring systems stability, and to gain consensus and approval for open source governance projects.
Projects and features in the Experimental phase are not meant to be used in production environments, and the risks are unknown/high.
Installing
python3 -m pip install 'grafana_foundation_sdk==1712659373!10.4.0'
Example usage
from grafana_foundation_sdk.builders.dashboard import Dashboard, Row
from grafana_foundation_sdk.builders.prometheus import Dataquery as PrometheusQuery
from grafana_foundation_sdk.builders.timeseries import Panel as Timeseries
from grafana_foundation_sdk.cog.encoder import JSONEncoder
from grafana_foundation_sdk.models.common import TimeZoneBrowser
def build_dashboard() -> Dashboard:
builder = (
Dashboard("[TEST] Node Exporter / Raspberry")
.uid("test-dashboard-raspberry")
.tags(["generated", "raspberrypi-node-integration"])
.refresh("1m")
.time("now-30m", "now")
.timezone(TimeZoneBrowser)
.with_row(Row("Overview"))
.with_panel(
Timeseries()
.title("Network Received")
.unit("bps")
.min_val(0)
.with_target(
PrometheusQuery()
.expr('rate(node_network_receive_bytes_total{job="integrations/raspberrypi-node", device!="lo"}[$__rate_interval]) * 8')
.legend_format("{{ device }}")
)
)
)
return builder
if __name__ == '__main__':
dashboard = build_dashboard().build()
encoder = JSONEncoder(sort_keys=True, indent=2)
print(encoder.encode(dashboard))
License
Project details
Release history Release notifications | RSS feed
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_foundation_sdk-1712659373!10.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c630a2df41b6d53c148b4ee32a1e0e59e52edea8be99d8da76b7ae5b2b583df |
|
MD5 | b0517ac19ce5f819aa0aefdb707ec444 |
|
BLAKE2b-256 | df3f18ca9ebd12bbc5bbc20c3b02681dfa91ef82c543f2e0b6cdc1fb2fa824fc |
Hashes for grafana_foundation_sdk-1712659373!10.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7de3da1d1d5d880cc907a0e1f1b3945fd1cf5b73d71467e13c9fdd86cd5f244 |
|
MD5 | b5fb885471c7e78322c2f11fc3000500 |
|
BLAKE2b-256 | 7329875d1ecad141bd8ba1405d7e6e478ea007d5eb4d4386e9d050b4816b407a |