Skip to content

Commit 6da3fc6

Browse files
committed
Documentation: Improve README
1 parent e6fbb14 commit 6da3fc6

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

README.rst

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ grafana-wtf - grep through all Grafana entities in the spirit of `git-wtf`_.
4444
Synopsis
4545
********
4646

47-
Search Grafana API for string "weatherbase".
47+
Search Grafana (dashboards and datasources) for string "weatherbase".
4848
::
4949

5050
grafana-wtf find weatherbase
@@ -54,13 +54,24 @@ Display 50 most recent changes across all dashboards.
5454

5555
grafana-wtf log --number=50
5656

57+
Explore dashboards and datasources in more detail.
58+
::
59+
60+
grafana-wtf explore dashboards
61+
grafana-wtf explore datasources
62+
5763
Run with Docker::
5864

5965
# Access Grafana instance on localhost, without authentication.
60-
docker run --rm -it --env GRAFANA_URL="http://host.docker.internal:3000" ghcr.io/panodata/grafana-wtf grafana-wtf info
66+
docker run --rm -it \
67+
--env GRAFANA_URL="http://host.docker.internal:3000" \
68+
ghcr.io/panodata/grafana-wtf grafana-wtf info
6169

6270
# Access Grafana instance with authentication.
63-
docker run --rm -it --env GRAFANA_URL="https://daq.grafana.org/grafana" --env GRAFANA_TOKEN="eyJrIjoiWHg...dGJpZCI6MX0=" ghcr.io/panodata/grafana-wtf grafana-wtf info
71+
docker run --rm -it \
72+
--env GRAFANA_URL="https://grafana.example.org/grafana" \
73+
--env GRAFANA_TOKEN="eyJrIjoiWHg...dGJpZCI6MX0=" \
74+
ghcr.io/panodata/grafana-wtf grafana-wtf info
6475

6576

6677
***********
@@ -102,20 +113,42 @@ Please take these steps to create an API key with your Grafana instance:
102113
please take note of the Bearer token. This is your Grafana API key.
103114

104115

105-
*****
106-
Usage
107-
*****
116+
*************
117+
Configuration
118+
*************
108119

109-
Before running ``grafana-wtf``, define URL and access token of your Grafana instance::
120+
Grafana connection
121+
==================
122+
123+
To configure to which Grafana instance to connect to, and how to authenticate, use
124+
the ``--grafana-url`` and ``--grafana-token`` command line options.
125+
126+
Alternatively, before running ``grafana-wtf``, you can define URL and access token
127+
of your Grafana instance by using environment variables::
110128

111129
export GRAFANA_URL=https://daq.example.org/grafana/
112130
export GRAFANA_TOKEN=eyJrIjoiWHg...dGJpZCI6MX0=
113131

114-
In order to ignore untrusted SSL certificates, append the ``?verify=no`` query string
132+
In order to accept untrusted SSL certificates, append the ``?verify=no`` query string
115133
to the ``GRAFANA_URL``::
116134

117135
export GRAFANA_URL=https://daq.example.org/grafana/?verify=no
118136

137+
Caching
138+
=======
139+
140+
``grafana-wtf`` will cache HTTP responses for 300 seconds by default, in order to save
141+
resources, by not hitting the server each server. You can configure that setting by using
142+
the ``--cache-ttl`` option, or the ``CACHE_TTL`` environment variable.
143+
144+
When invoking the program with the ``--drop-cache`` option, it will drop its cache upfront.
145+
146+
147+
148+
*****
149+
Usage
150+
*****
151+
119152

120153
General information
121154
===================
@@ -152,7 +185,8 @@ How to find dashboards which use non-existing data sources?
152185
grafana-wtf explore dashboards --format=yaml
153186

154187
# Display only dashboards which have missing data sources, along with their names.
155-
grafana-wtf explore dashboards --format=json | jq '.[] | select( .datasources_missing ) | .dashboard + {ds_missing: .datasources_missing[] | [.name]}'
188+
grafana-wtf explore dashboards --format=json | \
189+
jq '.[] | select( .datasources_missing ) | .dashboard + {ds_missing: .datasources_missing[] | [.name]}'
156190

157191
How to list all queries used in all dashboards?
158192
::
@@ -168,12 +202,6 @@ Find the string ``weatherbase`` throughout all dashboards and data sources::
168202

169203
grafana-wtf find weatherbase
170204

171-
.. note::
172-
173-
``grafana-wtf`` will cache HTTP responses for 300 seconds by default.
174-
When running it with the ``--drop-cache`` option, it will drop its cache upfront.
175-
176-
177205
Replacing strings
178206
=================
179207

0 commit comments

Comments
 (0)