Grafana version : v10.3.3 (252761264e22ece57204b327f9130d3b44592c01)
OS : docker official image
Fetch to a PostgresSQL DB
What i want to do :
Hello, I want to add variables to my queries. My dashboard is a database of possible new CVEs for each host (IPs) and Port that our Red Team needs to test.
Problem:
Status: 500. Message: db query error: pq: syntax error at or near ".6"
Whether I select any IP, the third block of the IP is always returned as an error.
My query works fine without the parameter in the variable.
My query :
SELECT
(TO_TIMESTAMP(MIN(results.date)) AT TIME ZONE 'UTC' AT TIME ZONE 'Europe/Paris' + interval '1 hour') AS "Date de Detection",
results.host,
results.port,
results.severity,
nvts.cve,
nvts.summary AS "Description",
STRING_AGG(results.description, ', ') AS "Patch"
FROM
results
JOIN
nvts ON results.nvt = nvts.uuid
WHERE
results.type NOT LIKE '%Log%'
AND results.host = ${ip}
AND results.port = ${port}
GROUP BY
results.host,
results.port,
results.severity,
nvts.summary,
nvts.cve
ORDER BY
results.severity DESC;
Here are my variables. (I put varchar in my filter query, thinking it would solve my problem, but in the end it didn’t).
Question: Does anyone know where the error might have come from ?