I’am so tired to spend so many times on this subjet… Is there any way to have a correct alerting sent to Rocket Chat? I mean, I can define a title or a message but what I receive in rocket is just a “ping”, I cannot see the title nor the message.
Is there any way to configure the payload? As there anyway to see the equivalent in cURL or something like that to have more information and debug the system?
1 Like
Hello! I can share you my script at rocket chat incoming webhook, I hope it will help you! I spent so much time to debug it (Grafana 9.4)
Script
class Script {
process_incoming_request({ request }) {
var alerts = request.content.alerts[0];
var panelURL = alerts.panelURL;
var dashboardURL = alerts.dashboardURL;
var editURL = alerts.generatorURL;
var silenceURL = alerts.silenceURL;
let color = "#00FF00"; // green
switch(request.content.status) {
case 'resolved':
color = '#00FF00';
emoji = '[OK]✅';
break;
case 'firing':
color = '#FF0000';
emoji = '[ALERTING]🔥';
break;
default:
color = '#666666';
}
return {
content:{
text: `${emoji}`+ request.content.commonLabels.alertname + " \n" + request.content.commonAnnotations.message,
"attachments": [{
"color": color,
"fields": [
{
"short": true,
"title": "График",
"value": "[Panel](" + `${panelURL}` + ")"
},
{
"short": true,
"title": "Дэшборд",
"value": "[Dashboard](" + `${dashboardURL}` + ")"
},
{
"short": true,
"title": "Редактировать алерт",
"value": "[Edit](" + `${editURL}` + ")"
},
{
"short": true,
"title": "Временно отключить алерт",
"value": "[Silence](" + `${silenceURL}` + ")"
}
],
}]
}
};
}
}
1 Like
Ha many thanks… But how / where do I use this script?
Thanks in advance!
You should use it at rocket chat integrations settings
Administration → Workspace → Integrations → Incoming
Thaaaaanks a lot!
What I did not understood was the fact rocket configuration is mandatory! I used previously Discord, and with discord you have nothing to configure, this is only on the Grafana side.
“With Rocket, you have to configure the both sides” ok, ok!
1 Like