grafana / influxdb-flux-datasource

Grafana datasource plugin for Flux (InfluxDB)
Apache License 2.0
51 stars 21 forks source link

Unable to add Flux Datasource in Grafana V6.0 #34

Closed ajayanaj closed 5 years ago

ajayanaj commented 5 years ago

What happened: Unable to add Flux datasource in Grafana version 6.0, I'm getting Network Error (500) and Network Error (504). I have an another Grafana instance version 5.4.2, which is working fine as expected. image

image

What you expected to happen: It should be added without any errors

How to reproduce it (as minimally and precisely as possible): Add datasource>> Update credentials >> Save and test

Anything else we need to know?:

Environment:

Grafana version: V6.0 Data source type & version: InfluxDB(Flux) datasource and version: 5.2.9 OS Grafana is installed on: Ubuntu 14 User OS & Browser: MAC and Chrome Grafana plugins: Others:

ajayanaj commented 5 years ago

This is the error i'm seeing in the browser console.

Failed to load resource: the server /api/datasources/proxy/74/api/v2/query:1 responded with a status of 500 () Failed to load resource: the server /api/datasources/proxy/83/api/v2/query:1 responded with a status of 504 ()

digrich commented 5 years ago

Similar isssue, not able to load the plugin on 6.2 grafana build.

Screen Shot 2019-05-09 at 1 28 52 PM
mqsoh commented 5 years ago

I'm not even able to authenticate the same as the InfluxDB datasource. Using this Docker Compose:

version: "3.7"
services:
  grafana:
    image: grafana/grafana:6.2.0
    volumes:
      - ./plugins:/var/lib/grafana/plugins
    ports:
      - "3000:3000"

  myinfluxdb:
    image: influxdb:1.7.5
    environment:
      - INFLUXDB_HTTP_AUTH_ENABLED=true
      - INFLUXDB_HTTP_REALM=testing
      - INFLUXDB_ADMIN_USER=testing
      - INFLUXDB_ADMIN_PASSWORD=testing
      - INFLUXDB_DB=testing
      - INFLUXDB_LOGGING_LEVEL=debug
      - HTTP_FLUX_ENABLED=true

There's a volume mapping for the plugins directory. So:

mkdir plugins
cd plugins
# Downloading the latest, 5.2.11
wget https://github.com/grafana/influxdb-flux-datasource/releases/download/5.2.11/influxdb-flux-datasource-5.2.11.zip
unzip influxdb-flux-datasource-5.2.11.zip

The InfluxDB datasource works fine.

image

But the Flux 5.2.11 datasource doesn't. I'm getting a 403, though, which is different than the other people in this issue.

image

ajayanaj commented 5 years ago

Hello team, Any update on this?

mqsoh commented 5 years ago

Is this in a nebulous state because of the InfluxDB 2.0 alpha? I tried to hook that up to this plugin and it seems like there's very substantial changes in configuration and, I assume, the API.

I may be able to pitch in on this project, but I'm not sure what's going on.

For example, this article says Flux will be a built in datasource. But I saw the commit in the main repo where you split this plugin into its own repository.

Also...are you an employee of Grafana or contributing your free time to this?

davkal commented 5 years ago

This repo is maintained by Grafana. Apologies if things are moving a bit slow on this front, keeping up with API changes for 2.0 has been a bit slow. Community contributions are welcome, and if you rely on this shortterm, those might be your best bet.

mqsoh commented 5 years ago

Okay! I hope I didn't seem like I was rushing you.

I'll try and contribute something soon.

briangann commented 5 years ago
- HTTP_FLUX_ENABLED=true

In my docker-compose file i had to use this to enable flux:

- INFLUXDB_HTTP_FLUX_ENABLED=true
mqsoh commented 5 years ago

Oh, shit. What an irritating oversight on my part! Yes, it actually works because the new error message is:

Data source connected, but has no data. Verify the "bucket" field and make sure the bucket has data.

I inserted some data and was able to see it in a panel with the Flux data source. I'm not sure what's going on in my main application, but since it works in the test harness I'm sure I can figure it out. Thanks, @briangann, for noticing that!

ajayanaj commented 5 years ago

@briangann I updated the latest version 5.3.0 and tried to configure the same, but am getting the below error. image

briangann commented 5 years ago

That configuration doesn't look right, can you try recreating the datasource?

ajayanaj commented 5 years ago

@briangann It's not even showing the configuration part, I tried to to remove the datasource then added back again. I'm just seeing this only. image

When I click on Save&test It's throwing validation failed error.

Bewiikam commented 5 years ago

It looks like the module.js is missing. If you download the grafana-influxdb-flux-datasource-5.3.0.tar.gz file from "Releases" here at "grafana/influxdb-flux-datasource", then extract it you will find that module.js is located into the "dist" folder. When checking out the source with git or installing with "grafana-cli plugins install grafana-influxdb-flux-datasource" you will also miss the "dist" folder.

So installing the flux datasource plugin with the "release file" will make things work for you.

dswarbrick commented 5 years ago

FWIW, I coerced grafana-cli to install the plugin from the github release like so:

# grafana-cli --pluginUrl https://github.com/grafana/influxdb-flux-datasource/releases/download/v5.3.0/grafana-influxdb-flux-datasource-5.3.0.zip plugins install grafana-influxdb-flux-datasource

Plugin is working for me, against a v1.7.6 server.

Bewiikam commented 5 years ago

Thanks @dswarbrick That worked after I picked the "correct" plugin file: grafana-influxdb-flux-datasource-5.3.0.zip

briangann commented 5 years ago

It was a faulty release to grafana.com, upgrading to 5.3.1 (latest) will fix it.

We've implemented a good build pipeline for releases, but there's one step where a mistake can occur, and that's what I managed to do :(

davkal commented 5 years ago

Closing this issue, as it works now (tested with Grafana 6.2, Influx 2.0.0-alpha, Plugin 5.3.1)

ajayanaj commented 5 years ago

@davkal Sorry to reopen this issue again. I'm still facing error with this plugin. I installed flux V5.3.1 in grafana V6.0, while trying to configure the plugin am getting "Network Error: Forbidden(403)" In grafana log I found the below.


t=2019-07-26T10:55:19+0530 lvl=info msg=Requesting logger=data-proxy-log url="http://localhost:8086/api/v2/query?org=undefined" t=2019-07-26T10:55:19+0530 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/proxy/20/flux/api/v2/query status=403 remote_addr=199.16.196.4 time_ms=2 size=100 referer=http://52.10.116.16:3000/datasources/edit/20/

It seems it's looking for for InfluxDB V2.0 org. Even I tried to put "InfluxDB 2.0.0 Details" as vacant, but no luck. I'm using influxDB version 1.7.4.

I also noticed another error "Network Error: Bad Request(400)" with Flux plugin on one of our production grafana instance(With influxDB version 1.7.6). There I found grafana log as below.


t=2019-07-26T04:26:01+0000 lvl=info msg=Requesting logger=data-proxy-log url="http://grafanahost.com/api/v2/query?org=undefined" t=2019-07-26T04:26:01+0000 lvl=info msg="Request Completed" logger=context userId=99 orgId=1 uname=admin method=POST path=/api/datasources/proxy/83/flux/api/v2/query status=400 remote_addr=10.88.14.14 time_ms=40 size=182 referer=https://grafana-dev-oktapoc.sre.apps.fireeye.com/datasources/edit/83/

In the production instance grafana I put "InfluxDB 2.0.0 Details" as vacant and tried to configure the plugin, but still it fails. Can you please check and help me here?