And here’s the JSON:
{
"id": 1,
"title": "Test",
"originalTitle": "Test",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"datasource": "collectd",
"editable": true,
"error": false,
"fill": 1,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": 1,
"isNew": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"dsType": "influxdb",
"groupBy": [
{
"params": [
"auto"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"hide": true,
"measurement": "cpu_load_short",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [],
"query": "SELECT mean("value") FROM "cpu_load_short" GROUP BY time($interval) fill(previous)",
"rawQuery": true
}
],
"timeFrom": null,
"timeShift": null,
"title": "Woop",
"tooltip": {
"msResolution": false,
"shared": true,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"interval": ">1s"
}
],
"title": "Row"
},
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [],
"title": "New row"
}
],
"time": {
"from": "now-6h",
"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"
]
},
"templating": {
"list": []
},
"annotations": {
"list": []
},
"schemaVersion": 12,
"version": 0,
"links": []
}
Am trying for days to pull some date from influxDB and am getting the below missing parameter «q» with 400 error or if i change something in the parameters am getting 404 error on the response
if anyone faced the same issue on the past or someone to help to understand how can i resolve this issue?
url='https://<hostname>8086/query'
values=[]
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
params = {
'db': 'tail_screw_20',
}
data = 'q=select time, "RH(%)", "T(C)" from PM_histo WHERE time >= '2022-05-04T11:00:00Z'
and time <= '2022-05-04T11:10:00Z' order by time asc'
response = requests.get(url=url, params=params, headers=headers,verify=False,data=data)
print(response.text)
print(response)
Error:
{«error»:»missing required parameter «q»»}
<Response [400]>
Editing the Query:
url='https://<localHost>:8086/query?db=tail_screw_20'
client = influxdb_client.InfluxDBClient(
url=url,
token='None',
ssl=False,
verify_ssl=False,
)
query_api = client.query_api()
result = query_api.query('''
from(bucket:"PM_histo") |> range(start: _start)
|> filter(fn: (r) => r["time"] == "time")
|> filter(fn: (r) => r["RH(%)"] == "RH(%)")
|> filter(fn: (r) => r["T(C)"] == "T(C)")
|> sort(columns: ["_time"], desc: _asc)
''')
resultsA = query_api.query_csv(query=result)
print(resultsA)
error:
HTTP response body: b'{«error»:»missing required parameter «q»»}n’
Jean-Charles de Longueville
Hi,
On a fresh Ubuntu 16.04 LTS Xenial, grafana is v3.1.1 and influxdb is
v0.10.0
When trying to add the datasource, The UI shows
InfluxDB Error Response: missing required parameter «q»
Tracking the request I found that the browser issues
GET /api/datasources/proxy/3/query?db=collectd&q=SHOW%20MEASUREMENTS%20LIMIT%201&epoch=ms
If I do a curl manually to the influxDB, I got a fine response.
My guess is that the proxied request is not correctly escaped and the
«&» breaks the url as shell separator or something…
Is this a known bug? Is there a fix?
The docs says that grafana supports influxdb v0.9. Do I need to
downgrade?
Regards,
JCh
Jean-Charles de Longueville
I see the same behaviour with influxdb 0.9 or 1.0.2…
Something must be wrong in my grafana setup but I do not find any clue how to debug it
Make sure you have a query enabled and not all hidden (with the eye)
toggle quoted message
Show quoted text
On 16 Oct 2016 23:55, «Jean-Charles de Longueville» <jch@…> wrote:
I see the same behaviour with influxdb 0.9 or 1.0.2…
Something must be wrong in my grafana setup but I do not find any clue how to debug it
![]()
Jean-Charles de Longueville
I finaly found that it is a reverse proxy (nginx) misconfiguration… But then I do not find (till now) the right setup for the reverse proxy. It’s working in direct access at least…
In #365 / #366 new functionality was added to allow InfluxQL queries to be run against the compatibility API using the client.
However, this change is not compatible with Influx 1.8.x because of an implementation detail in InfluxQLQueryService
That interface does the following
@Headers({ "Accept:application/csv", "Content-Type:application/vnd.influxql" })
@POST("query")
Call<ResponseBody> query(
@Body String query,
@Nonnull @Query("db") String db,
@Query("rp") String retentionPolicy,
@Query("epoch") String epoch,
@Header("Zap-Trace-Span") String zapTraceSpan
);
This sends the InfluxQL query as the request body, with a content-type of application/vnd.influxql
This is broadly equivalent to doing
curl -H "Authorization: Token $MYTOK" -d "select last(download) from internet_speed limit 1" -v "http://192.168.3.5:18086/query?db=telegraf" -H "Content-Type: application/vnd.influxql"
However, InfluxDB 1.8.x does not support this, and requires that the query be sent with the query in q
ben@bumblebee:~$ curl -H "Authorization: Token $MYTOK" -d "select last(download) from internet_speed limit 1" -v "http://192.168.3.84:8086/query?db=telegraf" -H "Content-Type: application/vnd.influxql"
* Trying 192.168.3.84:8086...
* Connected to 192.168.3.84 (192.168.3.84) port 8086 (#0)
> POST /query?db=telegraf HTTP/1.1
> Host: 192.168.3.84:8086
> User-Agent: curl/7.81.0
> Accept: */*
> Authorization: Token <redacted>
> Content-Type: application/vnd.influxql
> Content-Length: 49
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Request-Id: 3775f635-5456-11ed-8071-0242ac130002
< X-Influxdb-Build: OSS
< X-Influxdb-Error: missing required parameter "q"
< X-Influxdb-Version: 1.8.10
< X-Request-Id: 3775f635-5456-11ed-8071-0242ac130002
< Date: Tue, 25 Oct 2022 11:14:39 GMT
< Content-Length: 45
<
{"error":"missing required parameter "q""}
2.x can support either format, so it would probably make most sense to adjust the interface to send a form-encoded request body.
Steps to reproduce:
List the minimal actions needed to reproduce the behavior.
- Run InfluxDB 1.8.10
- Use
getInfluxQLQueryApi()
to get the API - Run an InfluxQL query
- Receive
{"error":"missing required parameter "q""}
Expected behavior:
The query should run
Actual behavior:
The query is not run
Specifications:
- Client Version: 6.6.0
- InfluxDB Version: 1.8.10
- JDK Version: Any
- Platform: Any