About
grafana-wtf is a command-line program for accessing Grafana in ways beyond we have been able to do before.
Features
- Use the Grafana HTTP API to inquire detailed information about what’s inside your Grafana instance.
- Filter and convert ingress data based on different perspectives, using Python code and a CLI interface.
- Output results in different formats. The program covers JSON, YAML, plain tabular, and colorful CLI reports.
- Provide a framework for becoming one of the best-in-class looking-glass tools for Grafana, based on a lovely community spirit and creative coding, with a high acceptance for contributions of any sort.
Examples
Some reports of grafana-wtf are provided in JSON and YAML formats, others are just implemented using textual console output. Where data-based reports are used, they can be easily filtered, customized, and converted using downstream programs like jq, by piping the output of grafana-wtf into it.
Search Content
Search Grafana (dashboards and datasources).
grafana-wtf find weatherbase
Explore dashboards and datasources in more detail.
grafana-wtf explore dashboards
grafana-wtf explore datasources
Replace Content
Replace all string matches with another string within the given dashboard’s JSON values.
grafana-wtf --select-dashboard=_JJ22OZZk replace ldi_v2 ldi_v3
Inquire Metadata
General metadata and status inquiry is always nice to have.
# Display a bunch of meta information and statistics.
grafana-wtf info --format=yaml
# Display Grafana version.
grafana-wtf info --format=json | jq -r '.grafana.version'
Want to know something about the status of your plugins?
# Explore plugins.
grafana-wtf plugins list
grafana-wtf plugins status
Watching out for recent editing activity happening on any of your dashboards?
# Display the 50 most recent changes across all dashboards.
grafana-wtf log --number=50
Enjoy exploring more grafana-wtf hands-on recipes on its README.
Install
grafana-wtf is provided as a Python package on PyPI and as an OCI image per GHCR, so you can either install it within a Python environment on your workstation, add it as a library dependency to your project, or easily run it on Docker, Podman, Kubernetes, and friends.
- PyPI: grafana-wtf
- OCI: ghcr.io/grafana-toolbox/grafana-wtf
Permanent
pipx install grafana-wtf
Container
Access Grafana instance on localhost, without authentication.
docker run --rm -it \
--env GRAFANA_URL="http://host.docker.internal:3000" \
ghcr.io/grafana-toolbox/grafana-wtf grafana-wtf info
Access remote Grafana instance with authentication.
docker run --rm -it \
--env GRAFANA_URL="https://grafana.example.org/grafana" \
--env GRAFANA_TOKEN="eyJrIjoiWHg...dGJpZCI6MX0=" \
ghcr.io/grafana-toolbox/grafana-wtf grafana-wtf info
Read about more detailed setup instructions of grafana-wtf on its README.