Variables not refreshing rigth

I am working in version 5.0.3
I have defined 7 variables with queries to MySql.
The problem is that, when I try to use them in panels, did not always get their values.
Example: $S1nombre is defined in this way:
select CONCAT(’"’,clave1,’"’) from sensores where id=100*($numUlm-1)
and it works fine.
Other one, $S7nombre, is defined in the same way:
select CONCAT(’"’,clave1,’"’) from sensores where id=100*($numUlm-1)+6
and shows up well in the top of the dashboard but shows as ‘$S7nombre’ in the tittle of a panel.
What can it be wrong?
Thanks for your attention.

Seems like a typo. $7nombre vs $S7nombre

Marcus

Thanks for your answer, is not that.
It was my error, I wanted to say ‘$S7nombre’.

Please include more information. Dashboard json model and possibly screenshots that can help us understand your issue.

Marcus


On the top of the image can be seen dropdowns with actual values of every variable and, at the bottom can be seen several tittles of panels that represent ‘[[S9nombre]]’ instead of “PIE-SA0-292-3”, ‘[[S11nombre]]’ instead of “PIE-SA0-292-4”, etc.
Others variables, like S1Nombre or S3Nombre show up correctly.
It seems like a problem of Grafana recovering variables but I am not an expert at all.

Concerning json model, is too big for uploading it. Maybe there are another way.

I have cut it a bit, here is json file:
{
“annotations”: {
“list”: [
{
“$$hashKey”: “object:927”,
“builtIn”: 1,
“datasource”: “-- Grafana --”,
“enable”: true,
“hide”: true,
“iconColor”: “rgba(0, 211, 255, 1)”,
“name”: “Annotations & Alerts”,
“type”: “dashboard”
}
]
},
“editable”: true,
“gnetId”: null,
“graphTooltip”: 0,
“id”: 10,
“iteration”: 1522058438409,
“links”: [],
“panels”: [
{
“cacheTimeout”: null,
“colorBackground”: false,
“colorValue”: false,
“colors”: [
#299c46”,
“rgba(237, 129, 40, 0.89)”,
#d44a3a
],
“datasource”: “dbAlbages”,
“decimals”: 2,
“format”: “none”,
“gauge”: {
“maxValue”: 80,
“minValue”: 0,
“show”: true,
“thresholdLabels”: true,
“thresholdMarkers”: true
},
“gridPos”: {
“h”: 5,
“w”: 3,
“x”: 0,
“y”: 0
},
“id”: 5,
“interval”: null,
“links”: [],
“mappingType”: 1,
“mappingTypes”: [
{
“name”: “value to text”,
“value”: 1
},
{
“name”: “range to text”,
“value”: 2
}
],
“maxDataPoints”: 100,
“nullPointMode”: “connected”,
“nullText”: null,
“postfix”: “”,
“postfixFontSize”: “50%”,
“prefix”: “”,
“prefixFontSize”: “50%”,
“rangeMaps”: [
{
“from”: “null”,
“text”: “N/A”,
“to”: “null”
}
],
“sparkline”: {
“fillColor”: “rgba(31, 118, 189, 0.18)”,
“full”: false,
“lineColor”: “rgb(31, 120, 193)”,
“show”: false
},
“tableColumn”: “”,
“targets”: [
{
“alias”: “”,
“format”: “time_series”,
“hide”: false,
“rawSql”: “SELECT\n UNIX_TIMESTAMP(tiempo) as time_sec,\n S9 as value,\n “noImporta” as metric\nFROM lecturas\nWHERE $__timeFilter(tiempo) and S9>0 and S9<30 and DATE(tiempo) > (NOW() - INTERVAL 2 DAY) and idUlm=200+$numUlm\nORDER BY tiempo ASC\n”,
“refId”: “A”
}
],
“thresholds”: “20,30”,
“title”: “[[S9nombre]]”,
“type”: “singlestat”,
“valueFontSize”: “70%”,
“valueMaps”: [
{
“op”: “=”,
“text”: “N/A”,
“value”: “null”
}
],
“valueName”: “current”
},
{
“cacheTimeout”: null,
“colorBackground”: false,
“colorValue”: false,
“colors”: [
#299c46”,
“rgba(237, 129, 40, 0.89)”,
#d44a3a
],
“datasource”: “dbAlbages”,
“decimals”: 2,
“format”: “none”,
“gauge”: {
“maxValue”: 80,
“minValue”: 0,
“show”: true,
“thresholdLabels”: true,
“thresholdMarkers”: true
},
“gridPos”: {
“h”: 5,
“w”: 3,
“x”: 3,
“y”: 0
},
“id”: 4,
“interval”: null,
“links”: [],
“mappingType”: 1,
“mappingTypes”: [
{
“name”: “value to text”,
“value”: 1
},
{
“name”: “range to text”,
“value”: 2
}
],
“maxDataPoints”: 100,
“nullPointMode”: “connected”,
“nullText”: null,
“postfix”: “”,
“postfixFontSize”: “50%”,
“prefix”: “”,
“prefixFontSize”: “50%”,
“rangeMaps”: [
{
“from”: “null”,
“text”: “N/A”,
“to”: “null”
}
],
“sparkline”: {
“fillColor”: “rgba(31, 118, 189, 0.18)”,
“full”: false,
“lineColor”: “rgb(31, 120, 193)”,
“show”: false
},
“tableColumn”: “”,
“targets”: [
{
“alias”: “”,
“format”: “time_series”,
“hide”: false,
“rawSql”: “SELECT\n UNIX_TIMESTAMP(tiempo) as time_sec,\n S11 as value,\n “no se value” as metric\nFROM lecturas\nWHERE S11 IS NOT NULL and idUlm=200+numUlm\nORDER BY id DESC\nLIMIT 1\n", "refId": "A" } ], "thresholds": "20,30", "title": "[[S11nombre]]", "type": "singlestat", "valueFontSize": "70%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "current" }, { "cacheTimeout": null, "colorBackground": false, "colorValue": false, "colors": [ "#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a" ], "datasource": "dbAlbages", "decimals": 2, "format": "none", "gauge": { "maxValue": 80, "minValue": 0, "show": true, "thresholdLabels": true, "thresholdMarkers": true }, "gridPos": { "h": 5, "w": 3, "x": 6, "y": 0 }, "id": 7, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "", "postfixFontSize": "50%", "prefix": "", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "alias": "", "format": "time_series", "hide": true, "rawSql": "SELECT\n UNIX_TIMESTAMP(tiempo) as time_sec,\n S13 as value,\n \"no se ve\" as metric\nFROM lecturas\nWHERE __timeFilter(tiempo) and DATE(tiempo) > (NOW() - INTERVAL 2 DAY) and idUlm=200+$numUlm\nORDER BY tiempo ASC\n”,
“refId”: “A”
}
],
“thresholds”: “20,30”,
“title”: “[[S13nombre]]”,
“type”: “singlestat”,
“valueFontSize”: “70%”,
“valueMaps”: [
{
“op”: “=”,
“text”: “N/A”,
“value”: “null”
}
],
“valueName”: “current”
},
{
“cacheTimeout”: null,
“colorBackground”: false,
“colorValue”: false,
“colors”: [
#299c46”,
“rgba(237, 129, 40, 0.89)”,
#d44a3a
],
“datasource”: “dbAlbages”,
“decimals”: 2,
“format”: “none”,
“gauge”: {
“maxValue”: 80,
“minValue”: 0,
“show”: true,
“thresholdLabels”: true,
“thresholdMarkers”: true
},
“gridPos”: {
“h”: 5,
“w”: 3,
“x”: 3,
“y”: 5
},
“id”: 8,
“interval”: null,
“links”: [],
“mappingType”: 1,
“mappingTypes”: [
{
“name”: “value to text”,
“value”: 1
},
{
“name”: “range to text”,
“value”: 2
}
],
“maxDataPoints”: 100,
“nullPointMode”: “connected”,
“nullText”: null,
“postfix”: “”,
“postfixFontSize”: “50%”,
“prefix”: “”,
“prefixFontSize”: “50%”,
“rangeMaps”: [
{
“from”: “null”,
“text”: “N/A”,
“to”: “null”
}
],
“sparkline”: {
“fillColor”: “rgba(31, 118, 189, 0.18)”,
“full”: false,
“lineColor”: “rgb(31, 120, 193)”,
“show”: false
},
“tableColumn”: “”,
“targets”: [
{
“alias”: “”,
“format”: “time_series”,
“hide”: false,
“rawSql”: “SELECT\n UNIX_TIMESTAMP(tiempo) as time_sec,\n S5 as value,\n “no se value” as metric\nFROM lecturas\nWHERE S5 IS NOT NULL and idUlm=200+$numUlm\nORDER BY id DESC\nLIMIT 1”,
“refId”: “A”
}
],
“thresholds”: “20,45”,
“title”: “[[S5nombre]]”,
“type”: “singlestat”,
“valueFontSize”: “70%”,
“valueMaps”: [
{
“op”: “=”,
“text”: “N/A”,
“value”: “null”
}
],
“valueName”: “current”
},
{
“cacheTimeout”: null,
“colorBackground”: false,
“colorValue”: false,
“colors”: [
#299c46”,
“rgba(237, 129, 40, 0.89)”,
#d44a3a
],
“datasource”: “dbAlbages”,
“decimals”: 2,
“format”: “none”,
“gauge”: {
“maxValue”: 80,
“minValue”: 0,
“show”: true,
“thresholdLabels”: true,
“thresholdMarkers”: true
},
“gridPos”: {
“h”: 5,
“w”: 3,
“x”: 6,
“y”: 5
},
“id”: 9,
“interval”: null,
“links”: [],
“mappingType”: 1,
“mappingTypes”: [
{
“name”: “value to text”,
“value”: 1
},
{
“name”: “range to text”,
“value”: 2
}
],
“maxDataPoints”: 100,
“nullPointMode”: “connected”,
“nullText”: null,
“postfix”: “”,
“postfixFontSize”: “50%”,
“prefix”: “”,
“prefixFontSize”: “50%”,
“rangeMaps”: [
{
“from”: “null”,
“text”: “N/A”,
“to”: “null”
}
],
“sparkline”: {
“fillColor”: “rgba(31, 118, 189, 0.18)”,
“full”: false,
“lineColor”: “rgb(31, 120, 193)”,
“show”: false
},
“tableColumn”: “”,
“targets”: [
{
“alias”: “”,
“format”: “time_series”,
“hide”: false,
“rawSql”: “SELECT\n UNIX_TIMESTAMP(tiempo) as time_sec,\n S7 as value,\n “no se value” as metric\nFROM lecturas\nWHERE S7 IS NOT NULL and idUlm=200+$numUlm\nORDER BY id DESC\nLIMIT 1\n”,
“refId”: “A”
}
],
“thresholds”: “20,45”,
“title”: “[[S7nombre]]”,
“type”: “singlestat”,
“valueFontSize”: “70%”,
“valueMaps”: [
{
“op”: “=”,
“text”: “N/A”,
“value”: “null”
}
],
“valueName”: “current”
},
{
“cacheTimeout”: null,
“colorBackground”: false,
“colorValue”: false,
“colors”: [
#299c46”,
“rgba(237, 129, 40, 0.89)”,
#d44a3a
],
“datasource”: “dbAlbages”,
“decimals”: 2,
“format”: “none”,
“gauge”: {
“maxValue”: 80,
“minValue”: 0,
“show”: true,
“thresholdLabels”: true,
“thresholdMarkers”: true
},
“gridPos”: {
“h”: 5,
“w”: 3,
“x”: 3,
“y”: 10
},
“id”: 10,
“interval”: null,
“links”: [],
“mappingType”: 1,
“mappingTypes”: [
{
“name”: “value to text”,
“value”: 1
},
{
“name”: “range to text”,
“value”: 2
}
],
“maxDataPoints”: 100,
“nullPointMode”: “connected”,
“nullText”: null,
“postfix”: “”,
“postfixFontSize”: “50%”,
“prefix”: “”,
“prefixFontSize”: “50%”,
“rangeMaps”: [
{
“from”: “null”,
“text”: “N/A”,
“to”: “null”
}
],
“sparkline”: {
“fillColor”: “rgba(31, 118, 189, 0.18)”,
“full”: false,
“lineColor”: “rgb(31, 120, 193)”,
“show”: false
},
“tableColumn”: “”,
“targets”: [
{
“alias”: “”,
“format”: “time_series”,
“hide”: false,
“rawSql”: “SELECT\n UNIX_TIMESTAMP(tiempo) as time_sec,\n S1 as value,\n “no se value” as metric\nFROM lecturas\nWHERE S1 IS NOT NULL and idUlm=200+$numUlm\nORDER BY id DESC\nLIMIT 1”,
“refId”: “A”
}
],
“thresholds”: “20,55”,
“title”: “[[S1nombre]]”,
“type”: “singlestat”,
“valueFontSize”: “70%”,
“valueMaps”: [
{
“op”: “=”,
“text”: “N/A”,
“value”: “null”
}
],
“valueName”: “current”
},
{
“cacheTimeout”: null,
“colorBackground”: false,
“colorValue”: false,
“colors”: [
#299c46”,
“rgba(237, 129, 40, 0.89)”,
#d44a3a
],
“datasource”: “dbAlbages”,
“decimals”: 2,
“format”: “none”,
“gauge”: {
“maxValue”: 80,
“minValue”: 0,
“show”: true,
“thresholdLabels”: true,
“thresholdMarkers”: true
},
“gridPos”: {
“h”: 5,
“w”: 3,
“x”: 6,
“y”: 10
},
“id”: 11,
“interval”: null,
“links”: [],
“mappingType”: 1,
“mappingTypes”: [
{
“name”: “value to text”,
“value”: 1
},
{
“name”: “range to text”,
“value”: 2
}
],
“maxDataPoints”: 100,
“nullPointMode”: “connected”,
“nullText”: null,
“postfix”: “”,
“postfixFontSize”: “50%”,
“prefix”: “”,
“prefixFontSize”: “50%”,
“rangeMaps”: [
{
“from”: “null”,
“text”: “N/A”,
“to”: “null”
}
],
“sparkline”: {
“fillColor”: “rgba(31, 118, 189, 0.18)”,
“full”: false,
“lineColor”: “rgb(31, 120, 193)”,
“show”: false
},
“tableColumn”: “”,
“targets”: [
{
“alias”: “”,
“format”: “time_series”,
“hide”: false,
“rawSql”: “SELECT\n UNIX_TIMESTAMP(tiempo) as time_sec,\n S3 as value,\n “no se value” as metric\nFROM lecturas\nWHERE S3 IS NOT NULL and idUlm=200+$numUlm\nORDER BY id DESC\nLIMIT 1\n”,
“refId”: “A”
}
],
“thresholds”: “20,58”,
“title”: “[[S3nombre]]”,
“type”: “singlestat”,
“valueFontSize”: “70%”,
“valueMaps”: [
{
“op”: “=”,
“text”: “N/A”,
“value”: “null”
}
],
“valueName”: “current”
}
],
“refresh”: false,
“schemaVersion”: 16,
“style”: “dark”,
“tags”: [],
“templating”: {
“list”: [
{
“allValue”: null,
“current”: {
“tags”: [],
“text”: “1”,
“value”: “1”
},
“hide”: 0,
“includeAll”: false,
“label”: null,
“multi”: false,
“name”: “numUlm”,
“options”: [
{
“selected”: true,
“text”: “1”,
“value”: “1”
},
{
“selected”: false,
“text”: “2”,
“value”: “2”
},
{
“selected”: false,
“text”: “3”,
“value”: “3”
},
{
“selected”: false,
“text”: “4”,
“value”: “4”
},
{
“selected”: false,
“text”: “5”,
“value”: “5”
}
],
“query”: “1,2,3,4,5”,
“type”: “custom”
},
{
“allValue”: null,
“current”: {
“text”: ““PIE-SA0-274-4"”,
“value”: ““PIE-SA0-274-4"”
},
“datasource”: “dbAlbages”,
“hide”: 0,
“includeAll”: false,
“label”: “S1 nombre”,
“multi”: false,
“name”: “S1nombre”,
“options”: [],
“query”: “select CONCAT(’”’,clave1,’”’) from sensores where id=100*($numUlm-1)”,
“refresh”: 2,
“regex”: “”,
“sort”: 0,
“tagValuesQuery”: “”,
“tags”: [],
“tagsQuery”: “”,
“type”: “query”,
“useTags”: false
},
{
“allValue”: null,
“current”: {
“text”: "“PIE-SA0-292-6"”,
“value”: "“PIE-SA0-292-6"”
},
“datasource”: “dbAlbages”,
“hide”: 0,
“includeAll”: false,
“label”: “S13 nombre”,
“multi”: false,
“name”: “S13Nombre”,
“options”: [
{
“selected”: true,
“text”: ““PIE-SA0-292-6"”,
“value”: ““PIE-SA0-292-6"”
}
],
“query”: “select CONCAT(’”’,clave1,’”’) from sensores where id=100*($numUlm-1)+12”,
“refresh”: 0,
“regex”: “”,
“sort”: 0,
“tagValuesQuery”: “”,
“tags”: [],
“tagsQuery”: “”,
“type”: “query”,
“useTags”: false
},
{
“allValue”: null,
“current”: {
“text”: "“PIE-SA0-274-6"”,
“value”: "“PIE-SA0-274-6"”
},
“datasource”: “dbAlbages”,
“hide”: 0,
“includeAll”: false,
“label”: “S3 nombre”,
“multi”: false,
“name”: “S3nombre”,
“options”: [
{
“selected”: true,
“text”: ““PIE-SA0-274-6"”,
“value”: ““PIE-SA0-274-6"”
}
],
“query”: “select CONCAT(’”’,clave1,’”’) from sensores where id=100*($numUlm-1)+2”,
“refresh”: 0,
“regex”: “”,
“sort”: 0,
“tagValuesQuery”: “”,
“tags”: [],
“tagsQuery”: “”,
“type”: “query”,
“useTags”: false
},
{
“allValue”: null,
“current”: {
“text”: "“PIE-SA0-283-4"”,
“value”: "“PIE-SA0-283-4"”
},
“datasource”: “dbAlbages”,
“hide”: 0,
“includeAll”: false,
“label”: “S5 nombre”,
“multi”: false,
“name”: “S5nombre”,
“options”: [
{
“selected”: true,
“text”: ““PIE-SA0-283-4"”,
“value”: ““PIE-SA0-283-4"”
}
],
“query”: “select CONCAT(’”’,clave1,’”’) from sensores where id=100*($numUlm-1)+4”,
“refresh”: 0,
“regex”: “”,
“sort”: 0,
“tagValuesQuery”: “”,
“tags”: [],
“tagsQuery”: “”,
“type”: “query”,
“useTags”: false
},
{
“allValue”: null,
“current”: {
“text”: "“PIE-SA0-283-6"”,
“value”: "“PIE-SA0-283-6"”
},
“datasource”: “dbAlbages”,
“hide”: 0,
“includeAll”: false,
“label”: “S7 nombre”,
“multi”: false,
“name”: “S7Nombre”,
“options”: [
{
“selected”: true,
“text”: ““PIE-SA0-283-6"”,
“value”: ““PIE-SA0-283-6"”
}
],
“query”: “select CONCAT(’”’,clave1,’”’) from sensores where id=100*($numUlm-1)+6”,
“refresh”: 0,
“regex”: “”,
“sort”: 0,
“tagValuesQuery”: “”,
“tags”: [],
“tagsQuery”: “”,
“type”: “query”,
“useTags”: false
},
{
“allValue”: null,
“current”: {
“text”: "“PIE-SA0-292-3"”,
“value”: "“PIE-SA0-292-3"”
},
“datasource”: “dbAlbages”,
“hide”: 0,
“includeAll”: false,
“label”: “S9 nombre”,
“multi”: false,
“name”: “S9Nombre”,
“options”: [
{
“selected”: true,
“text”: ““PIE-SA0-292-3"”,
“value”: ““PIE-SA0-292-3"”
}
],
“query”: “select CONCAT(’”’,clave1,’”’) from sensores where id=100*($numUlm-1)+8”,
“refresh”: 0,
“regex”: “”,
“sort”: 0,
“tagValuesQuery”: “”,
“tags”: [],
“tagsQuery”: “”,
“type”: “query”,
“useTags”: false
},
{
“allValue”: null,
“current”: {
“text”: "“PIE-SA0-292-4"”,
“value”: "“PIE-SA0-292-4"”
},
“datasource”: “dbAlbages”,
“hide”: 0,
“includeAll”: false,
“label”: “S11 nombre”,
“multi”: false,
“name”: “S11Nombre”,
“options”: [
{
“selected”: true,
“text”: ““PIE-SA0-292-4"”,
“value”: ““PIE-SA0-292-4"”
}
],
“query”: “select CONCAT(’”’,clave1,’”’) from sensores where id=100*($numUlm-1)+10”,
“refresh”: 0,
“regex”: “”,
“sort”: 0,
“tagValuesQuery”: “”,
“tags”: [],
“tagsQuery”: “”,
“type”: “query”,
“useTags”: false
}
]
},
“time”: {
“from”: “2017-11-21T08:34:56.879Z”,
“to”: “now”
},
“timepicker”: {
“refresh_intervals”: [
“5s”,
“10s”,
“30s”,
“1m”,
“5m”,
“15m”,
“30m”,
“1h”,
“2h”,
“1d”
],
“time_options”: [
“5m”,
“15m”,
“1h”,
“6h”,
“12h”,
“24h”,
“2d”,
“7d”,
“30d”
]
},
“timezone”: “”,
“title”: “Albages_SA0 c Copy”,
“uid”: “pPMVBakmk”,
“version”: 2
}

Thanks. It seems like you’ve named the variable S7Nombre but are referring to it in panel title using [[S7nombre]] which should be [[S7Nombre]] instead. Please note that referring to variable is case sensitive.

Marcus

Yes, you are right, it was my fault. Many thanks Marcus.
Now it works right. Marvelous support.