-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Dear @chenlujjj and @jangaraj,
Originally coming from How to find out unused datasources?, based on our discussion at Finding unhealthy data sources, we finally made a start to lay out the foundation with #19. Health checks for a few data source types will be supported already 1, but we will have to complete the list diligently, which requires dedicated work.
Corresponding documentation how to work with the health check subsystem on behalf of an example program examples/datasource-health.py can be inspected at examples/datasource-health.rst. The program is intended to evaluate the new subsystem with different databases, in order to gradually improve the implementation. We tried to make it easily usable for others to run in order to support this endeavor.
When the feature is reasonably ready over here, we will return to grafana-toolbox/grafana-wtf#19 in order to continue the discussion how to use it within grafana-wtf
appropriately.
If this resonates with you, you might want to lend a hand? All kinds of feedback, both in terms of testing and further contributions will be greatly appreciated. Thank you very much in advance.
With kind regards,
Andreas.
Usage
The documentation at examples/datasource-health.rst will guide you through a full development sandbox installation, including running Grafana and some database services as Docker containers, and setting up the working tree from the Git repository.
In this section, we outline an alternative approach how to work with the feature using the example program examples/datasource-health.py. It might save a few keystrokes, specifically when aiming to work on an existing infrastructure.
# Setup
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade git+https://github.com/panodata/grafana-client
wget https://raw.githubusercontent.com/panodata/grafana-client/main/examples/datasource-health.py
# Run
export GRAFANA_URL=http://daq.example.org:3000
export GRAFANA_TOKEN=eyJrIjoiUWVrYXJh....aWQiOjJ9
python datasource-health.py --type=influxdb --url=http://daq.example.org:8086
Details
The example program will create a data source item named probe-{dstype}
, with the designated database target URL. Then, it will run a data source health check on it and report about its outcome.
This will work well in situations when running the database services as Docker containers, as outlined in the reference documentation at examples/datasource-health.rst. It might not work well in other situations, where the data source configuration might need further adjustments.
In this case, don't hesitate to adjust the datasource_factory()
code correspondingly to match your setup.
References
- Original feature request: Finding unhealthy data sources grafana-wtf#19
- Discussion: Introducing the data source health check subsystem #20
- First patch: Improve data source API by adding a data source health-check probe #19
- Documentation: examples/datasource-health.rst
- Example program: examples/datasource-health.py
Footnotes
-
CrateDB, Elasticsearch, InfluxDB, PostgreSQL, Prometheus, Testdata ↩