Use Grafana Data Source Plugin for Observations
This document describes how to install the Data Source plugin locally in Grafana and make observations using Grafana Data Source.
- Grafana should be in 7.0.0 or later versions.
- The Data Source plugin cannot be installed through
grafana-cli
at this time, because Grafana has not yet accepted the plugin submission for Chaos Mesh Data Source.
Install Data Source Plugin
You can install the Data Source plugin locally in Grafana by following these steps:
Download the plugin zip package with the following command, or visit https://github.com/chaos-mesh/datasource/releases to download the package:
curl -LO https://github.com/chaos-mesh/datasource/releases/download/v2.1.0/chaosmeshorg-datasource-2.1.0.zip
After downloading, extract the plugin to the Grafana plugin directory:
unzip chaosmeshorg-datasource-2.1.0.zip -d YOUR_PLUGIN_DIR
tipTo find the plugin directory, refer to https://grafana.com/docs/grafana/latest/plugins/installation/#install-a-packaged-plugin.
Update and save the configuration file
grafana.ini
of Grafana. Then, add the plugin toallow_loading_unsigned_plugins
to ensure that Grafana can load the unsigned plugin:[plugins]
allow_loading_unsigned_plugins = chaosmeshorg-datasourcetipTo find the configuration file, refer to https://grafana.com/docs/grafana/latest/administration/configuration/#config-file-locations.
Finally, restart Grafana to load the Data Source plugin.
Set up Data Source Plugin
After you have successfully installed the Data Source plugin locally in Grafana, go to Configuration -> Data sources and add Chaos Mesh to there, then visit the following configuration page:
On this page, only the
URL
field needs to be filled in, and the other fields can be ignored.Suppose that you have installed Chaos Mesh locally. In this case, Dashboard exports the API on port
2333
by default. Therefore, if you have not changed anything, you can writehttp://localhost:2333
inURL
.Then use the
port-forward
command to make the API externally accessible:kubectl port-forward -n chaos-mesh svc/chaos-dashboard 2333:2333
Click Save & Test to test the connection. If it shows a successful notification, the set-up is complete.
Query
The Data Source plugin observes Chaos Mesh from the perspective of events. The following options are responsible for filtering different events:
Object ID
: Filter by object UUIDNamespace
: Filter by different namespaceName
: Filter by object nameKind
: Filter by kind (PodChaos, Schedule, and so on)Limit
: Limit the number of events
The settings for these options are passed as parameters to the /api/events
API.
Annotations
You can integrate Chaos Mesh events into the panel by setting up Annotations. For example:
For information on how to fill in the fields in annotations, refer to Query.
Variables
You can query Chaos Mesh for events dynamically by setting different variables.
The types of variables provided by the plugin are as follows:
Namespace
: After your selection, all available namespaces are displayed directly at the bottom of the page underPreview of values
.Kind
: Same as Namespace. It can get all kinds.Experiment
: Same as Namespace. It can get the names of all experiments.Schedule
: Same as Namespace. It can get the names of all schedules.
Questions and feedback
If you encounter problems during installation or set-up, you are welcome to ask questions to the community at CNCF Slack, or create an GitHub issue to communicate with the Chaos Mesh team.
What's next
If you want to learn more details about the Data Source plugin, feel free to check out the source code for the plugin at chaos-mesh/datasource.