-
Grafana OSS 12.0.1
-
What are you trying to achieve?
- Force the refresh of a dashboard from a external source using /api/live/ws
-
How are you trying to achieve it?
- Using a nodejs code to push a order to dashboard
-
What happened?
- Nothing.
-
What did you expect to happen?
- a silent refresh of the dashboard
-
Can you copy/paste the configuration(s) that you are having problems with?
* const ws = new WebSocket(grafanaUrl, {
headers: {
Authorization: \`Bearer ${apiToken}\`
},
rejectUnauthorized: false // ⚠️ seulement pour debug
});
ws.on('open', () => {
console.log('✅ Connected to Grafana Live WebSocket');
// Auth message (optional depending on Grafana version)
const authMsg = {
type: 'auth',
payload: { Authorization: \`Bearer ${apiToken}\` }
};
ws.send(JSON.stringify(authMsg));
const refreshMsg = {
action: 'dashboard-refresh',
payload: {
dashboardUid: dashboardUid
}
};
ws.send(JSON.stringify(refreshMsg));
console.log(\`🔄 Refresh event sent for dashboard UID: ${dashboardUid}\`);
});
ws.on('message', (data) => {
console.log('📩 Message from Grafana:', data.toString());});
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
- in log :
logger=context userId=11 orgId=1 uname=sa-1-push-agent t=2025-11-15T18:31:15.215186654+01:00 level=info msg=“Request Completed” method=GET path=/api/live/ws status=-1 remote_addr=10.63.33.110 time_ms=18 duration=18.269947ms size=0 referer= handler=/api/live/ws status_source=server
-
Did you follow any online instructions? If so, what is the URL?
- /api/live documentation