Values displayed wrong in email alert

Hello, I have a problem with my alerts. I manage to configure my grafana so that it sends alerts through email from a query in mysql.

The alert works perfectly but the data displayed is wrong, for each number it adds a decimal point that does not exist and 3 zeros that only cause confusion of the data. as it is possible to correct this error?, i see the json and the data is correct, there must be an error in the template

Hi @maximilianoalbert,

Can you share more details about your JSON and the datasource? What does the data look like when you query it? How does it appear in a panel?

this is an example from test alert:

firing:true

state:“pending”

conditionEvals:“true = true”

timeMs:“2.848ms”

matches:Array[23]

0:Object

metric:“156 - Cese del Regimen (Inscriptos)”

value:1786

1:Object

metric:“194 - Inscriptos sin actividad principal (Inscriptos)”

value:2676

2:Object

metric:“25 - Vinculos sin Responsabilidad (Objetos)”

value:517

3:Object

metric:“44 - Saldo Negativo obligacion (Obligaciones)”

value:733

4:Object

metric:"47 - Obligaciones con estado material ANUL o APEX (Obligaciones) "

value:419

5:Object

metric:“195 - Inscriptos con mas de una actividad como principal (Inscriptos)”

value:6253

this is pannel json:
{
“alert”: {
“alertRuleTags”: {},
“conditions”: [
{
“evaluator”: {
“params”: [
0
],
“type”: “gt”
},
“operator”: {
“type”: “and”
},
“query”: {
“params”: [
“A”,
“1s”,
“now”
]
},
“reducer”: {
“params”: ,
“type”: “last”
},
“type”: “query”
}
],
“executionErrorState”: “alerting”,
“for”: “1s”,
“frequency”: “5m”,
“handler”: 1,
“message”: “Los Siguientes puntos de Cleansing superaron el rango máximo establecido, según los parámetros indicado por cada función.”,
“name”: “Reporte Semanal”,
“noDataState”: “ok”,
“notifications”: [
{
“uid”: “NIul8WPGk”
}
]
},
“aliasColors”: {},
“dashLength”: 10,
“fieldConfig”: {
“defaults”: {
“custom”: {}
},
“overrides”:
},
“fill”: 1,
“gridPos”: {
“h”: 8,
“w”: 12,
“x”: 12,
“y”: 0
},
“id”: 2,
“legend”: {
“avg”: false,
“current”: false,
“max”: false,
“min”: false,
“show”: true,
“total”: false,
“values”: false
},
“lines”: true,
“linewidth”: 1,
“nullPointMode”: “null”,
“options”: {
“alertThreshold”: true
},
“pluginVersion”: “7.3.4”,
“pointradius”: 2,
“renderer”: “flot”,
“seriesOverrides”: ,
“spaceLength”: 10,
“targets”: [
{
“format”: “time_series”,
“group”: ,
“metricColumn”: “none”,
“rawQuery”: true,
“rawSql”: “SELECT\n cch.CCH_FECHA_INICIO AS "time",\n concat(cch.cfs_id,’ - ',cm.cdn_descripcion) as metric,\n CCH_CANTIDAD as value\nFROM CONTROL_CALIDAD_HEADER cch, CALIDAD_MODULOS cm\nWHERE\n cch.CCH_COLOR_CONTROL like ‘Rojo’\n and cm.cfs_id = cch.cfs_id\n”,
“refId”: “A”,
“select”: [
[
{
“params”: [
“CCH_CANTIDAD”
],
“type”: “column”
}
]
],
“table”: “CONTROL_CALIDAD_HEADER”,
“timeColumn”: “CCH_FECHA_INICIO”,
“timeColumnType”: “datetime”,
“where”: [
{
“datatype”: “varchar”,
“name”: “”,
“params”: [
“CCH_COLOR_CONTROL”,
“=”,
“Rojo”
],
“type”: “expression”
}
]
}
],
“thresholds”: [
{
“value”: 0,
“op”: “gt”,
“fill”: true,
“line”: true,
“colorMode”: “critical”
}
],
“timeRegions”: ,
“title”: “Reporte Semanal Cleansing”,
“tooltip”: {
“shared”: true,
“sort”: 0,
“value_type”: “individual”
},
“type”: “graph”,
“xaxis”: {
“buckets”: null,
“mode”: “time”,
“name”: null,
“show”: true,
“values”:
},
“yaxes”: [
{
“$$hashKey”: “object:622”,
“format”: “casos”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
},
{
“$$hashKey”: “object:623”,
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: false
}
],
“yaxis”: {
“align”: false,
“alignLevel”: null
},
“bars”: false,
“dashes”: false,
“fillGradient”: 0,
“hiddenSeries”: false,
“percentage”: false,
“points”: false,
“stack”: false,
“steppedLine”: false,
“timeFrom”: null,
“timeShift”: null,
“datasource”: null
}

my source is a db in mysql:

Captura de pantalla de 2021-05-12 10-39-14

this is the pannel:

Hi @maximilianoalbert,

thanks for sharing–that is strange, and I’ll look into this. In the meantime, I wanted to let you know that Grafana 8 will be released in two weeks, and it should ship with major improvements to alerting

hi, i tried with different versions and the problem keeps appearing, i tried to see the json from alert panel and i get this eg:

Object
firing:true
state:"pending"
conditionEvals:"true = true"
timeMs:"1.972ms"
matches:Array[1]
0:Object
metric:"44 - Saldo Negativo obligacion (Obligaciones)"
value:681
logs:Array[3]
0:Object
message:"Condition[0]: Query"
data:Object
1:Object
message:"Condition[0]: Query Result"
data:Object
meta:Object
series:Array[1]
0:Object
2:Object
message:"Condition[0]: Eval: true, Metric: 44 - Saldo Negativo obligacion (Obligaciones), Value: 681.000"
data:null

in some place the object is changed and added some zeros

Hi @maximilianoalbert

Have you tried using the new Unified Alerting in Grafana 8? It’s still behind a feature toggle but is a large improvement on our alerting platform:

You can pass the feature toggle as an environemnal variable or update it in your configuration file:

docker run -p 3000:3000 -e "GF_FEATURE_TOGGLES_ENABLE=ngalert" grafana/grafana:latest

Hi @maximilianoalbert
i have the same problom in grafana 8.2.2

did you find solution?

how could the value that shows in email alert change without decimal

value
73.000

Hi @rahelask4 i never found the solution, values are changed when grafana values the alert

Just to make sure we’re all on the same page here, are you both using the new Grafana 8 alerts and still having this problem? As a reminder, you have to enable it explicitly still by either setting the env_var or feature toggle (in the grafana.ini)

hi @davidparrott i did a new try. installed grafana 8.2 (lastest) in my computer, setted the datasource, setted the smtp config and setted a new alert panel for test. and the result is this:


here i show you that alerting is enabled.
Screen Email
still getting errors in my values, my values are integer, not doubles. i never use a double in all the database.

the value for 139 must be 323 not 323K !!!

1 Like

Hi

Did anybody find a resolution to this?

Thanks