A WebSocket data source plugin for realtime data updates in Grafana Dashboards.
This plugin allows you to connect a WebSocket endpoint as a Data Source for your Grafana dashboard. Unlike REST APIs, WebSockets automatically update as soon as new data is available from the source, without having to periodically fetch data from it.
When a WebSocket endpoint is added as a data source in Grafana, the plugin will open the WebSocket connection with the source API and keep it open. When there is new data, the WebSocket endpoint will send it directly to the plugin through the open WebSocket connection and your dashboard will be updated automatically.
Here are the steps to configure and use the WebSocket Data Source Plugin in Grafana.
-
Add the WebSocket data source plugin in Grafana
- Click the gear icon on the left sidebar and choose "data sources"
- Click "Add data source"
- Scroll to the bottom and chose "WebSocket API" in the "Others" category.
-
Configure WebSocket endpoint information
- WebSocket Host (use this format):
wss://your-host/some/prefix-path
- Add Query Parameters and Custom Headers if necessary (consult your WebSocket API data source). This example shows the use of an API key.
- WebSocket Host (use this format):
-
Add a panel to the Grafana Dashboard to begin seeing data
- Click
+
in the left sidebar. Choose "Dashboard" --> "Add a new panel" - Select
WebSocket API
as Data Source in the select drop-down - In the bottom left, set the "Fields" tab to
$
- Click the "Path" tab and set the path (if necessary) of the websocket endpoint that you want to connect
- Above the panel, click the "Table view" toggle at the top of the window
- Any data coming from the WebSocket Endpoint will be shown as JSON in the panel
- Click
Once you have confirmed that you are receiving realtime data, it can be visualized: