grafana-timelion-datasource icon indicating copy to clipboard operation
grafana-timelion-datasource copied to clipboard

HTTP Error Not Found

Open manni8 opened this issue 6 years ago • 24 comments

kibana v6.2.3 grafana v5.0.3

Install cmd : grafana-cli --pluginUrl https://github.com/gbrian/grafana-timelion-datasource/archive/master.zip plugins install grafana-timelion-datasource

Timelion host-url: http://localhost:5601/app/timelion (works witch curl and browser)

Grafana UI-Response :

HTTP Error Not Found

grafana.log:

lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/datasources/proxy/10/run status=404 remote_addr=127.0.0.1 time_ms=9 size=69 referer=https://my-pub-url/datasources/edit/10

Some one else with the same issue ?

manni8 avatar Mar 26 '18 19:03 manni8

Same issue. Kibana 6.0.1 Grafana 5.1.2

Plugin tries to execute GET method on /run location. But, as soon as i using AWS ES stack, only POST method allowed.

Mitrofanov avatar May 10 '18 12:05 Mitrofanov

HI @Mitrofanov , Where did you read about POST for AWS? Can you post the link and I'll try to make it compatible Thanks @repofunding support repofunding

gbrian avatar May 10 '18 16:05 gbrian

:wave: Hi, @repofunding is helping @manni8 on maintaining this repository. We are an open source initiative aiming to help developers on maintain their projects by using crowdfunding.

Why using repofunding for this project?

Supporting

  • You can support this repository by providing a pull request here
  • Crowdfunding this issue with:

Important

@repofunding status is prototye be patiente :wink: don't hesitate to contact us Join the chat at https://gitter.im/repofunding/Lobby

tags: crowdfunding

repofunding avatar May 10 '18 16:05 repofunding

@manni8 http://localhost:5601/app/timelion used with grafana proxy mode will resolve to the same machine as grafana. Is that correct?

gbrian avatar May 10 '18 16:05 gbrian

@gbrian I've just tried to debug the error message and tried to GET the config url. I get the following from AWS ES service:

{"error":"Incorrect HTTP method for uri [/api/timelion] and method [GET], allowed: [POST]","status":405}

Mitrofanov avatar May 11 '18 11:05 Mitrofanov

@Mitrofanov , Ok, found. The GET request is executed as part of the TESTmethod during data source definition.

image

Currently, you can ignore this error and just try the Timelion data source on a dashboard. I'll fix this behavior asap. Hope this helps.

gbrian avatar May 11 '18 11:05 gbrian

So i tried to use plugin but looks like it's not works. It returns no datapoints. Here is Grafana's query inspector output:

xhrStatus:"complete"
request:Object
method:"POST"
url:"api/datasources/proxy/8/run"
data:Object
sheet:Array[1]
0:",.es(*)"
time:Object
from:"2018-05-12T16:17:06 +0300"
interval:"auto"
mode:"absolute"
timezone:"GMT"
to:"2018-05-14T16:17:06 +0300"
response:Object
_index:"api"
_type:"timelion"
_id:"run"
_version:22
result:"updated"
_shards:Object
total:2
successful:2
failed:0
_seq_no:21
_primary_term:1

@gbrian Could you help with this?

Mitrofanov avatar May 14 '18 13:05 Mitrofanov

Hi @Mitrofanov , I see an error in the query caused by a known bug. I committed new version this morning. I recommend to update to the latest version first and try again your test. Please let me know if the error persists with the latest version. Thanks

gbrian avatar May 14 '18 14:05 gbrian

@gbrian I just tried to use new version but with no luck. So my issue is:

  1. I added Timelion datasource (got error in validation but trying to work with it)
  2. I trying to get some data from my datasource- i executing .es(*) query (tested in Kibana's timelion- it has some data)
  3. When i try it in grafana i get no datapoints, although i don't see any errors in query inspector:
  "xhrStatus": "complete",
  "request": {
    "method": "POST",
    "url": "api/datasources/proxy/8/run",
    "data": {
      "sheet": [
        ",.es(*)"
      ],
      "time": {
        "from": "2018-05-15T05:28:37 +0300",
        "interval": "auto",
        "mode": "absolute",
        "timezone": "GMT",
        "to": "2018-05-15T11:28:37 +0300"
      }
    }
  },
  "response": {
    "_index": "api",
    "_type": "timelion",
    "_id": "run",
    "_version": 41,
    "result": "updated",
    "_shards": {
      "total": 2,
      "successful": 2,
      "failed": 0
    },
    "_seq_no": 40,
    "_primary_term": 1
  }
}```

Could you please help?

Mitrofanov avatar May 15 '18 08:05 Mitrofanov

@Mitrofanov I have to apologize, bug still there 😔 image

I'm checking code right now, I'll keep you posted. Sorry again and thanks for your patience

gbrian avatar May 15 '18 15:05 gbrian

@Mitrofanov , I can not see this behavior with the latest version 🤔 please, remember to restart grafana after updating the plugin. image

gbrian avatar May 15 '18 16:05 gbrian

@gbrian Very strange. Just checked again- this bug seems fixed to me but no data on graph again. This is query inspector response:

{
  "xhrStatus": "complete",
  "request": {
    "method": "POST",
    "url": "api/datasources/proxy/8/run",
    "data": {
      "sheet": [
        ".es(*)"
      ],
      "time": {
        "from": "2018-05-15T15:59:17 +0300",
        "interval": "auto",
        "mode": "absolute",
        "timezone": "GMT",
        "to": "2018-05-15T21:59:17 +0300"
      }
    }
  },
  "response": {
    "_index": "api",
    "_type": "timelion",
    "_id": "run",
    "_version": 45,
    "result": "updated",
    "_shards": {
      "total": 2,
      "successful": 2,
      "failed": 0
    },
    "_seq_no": 44,
    "_primary_term": 1
  }
}

Mitrofanov avatar May 15 '18 19:05 Mitrofanov

Dammit! @Mitrofanov , Please post Chrome/Firefox Network view and check Preview tab you must see something like

image

gbrian avatar May 15 '18 19:05 gbrian

@gbrian Here it is: screen shot 2018-05-16 at 08 10 32

Mitrofanov avatar May 16 '18 05:05 Mitrofanov

@Mitrofanov 😥 It seems to be posting to an ES index... check if an "api" index has been created on your ES. Please be sure your Timelion's plugin setup is in the form of: http://192.168.182.186:5601/api/timelion image

Take care: the port is the Kibana's port 5601 or your specific, do not point to ES port 9200 BTW please post the Headers section as well (removing sensitive data)

gbrian avatar May 16 '18 05:05 gbrian

@gbrian Looks like this issues related to AWS ES setup. Let me explain: In AWS ES service has a build-in kibana. All that stuff are available via single port (443), but uses different locations (/_plugin/kibana/app/kibana for kibana; / for ES). Also i don't nave api index in ES (as soon as nobody uses that). Here is my timelion config settings in Kibana (may be it would be helpful): screen shot 2018-05-16 at 09 40 33

Mitrofanov avatar May 16 '18 06:05 Mitrofanov

@Mitrofanov ok!

So, the best way to know which URL to use is to spy kibana's Timelion page: image

Copy paste that url and fingers crossed there's no CORS restriction in place 😨

gbrian avatar May 16 '18 08:05 gbrian

@gbrian Another round: i checked URI and it appears to be like follow: /_plugin/kibana/api/timelion/run. But i get 404 if i run queries against it:

{
  "xhrStatus": "complete",
  "request": {
    "method": "POST",
    "url": "api/datasources/proxy/8/run",
    "data": {
      "sheet": [
        ".es(*)"
      ],
      "time": {
        "from": "2018-05-16T05:59:50 +0300",
        "interval": "auto",
        "mode": "absolute",
        "timezone": "GMT",
        "to": "2018-05-16T11:59:50 +0300"
      }
    }
  },
  "response": {
    "statusCode": 404,
    "error": "Not Found",
    "message": "Not Found"
  }
}

Could be it something not related to CORS, or in another case looks like it's our finish here.

Mitrofanov avatar May 16 '18 09:05 Mitrofanov

Never surrender, CORS does not apply in proxy mode and i realized your using this mode :+1: Just try to reach the whole url from your browser: http://ec....amazon.../...//_plugin/kibana/api/timelion/run If its directly accesible will get some error back about the http method used Good luck

repofunding avatar May 16 '18 09:05 repofunding

Ops. Wrong account above!

gbrian avatar May 16 '18 09:05 gbrian

@gbrian Now i got 400 error on run POST

Mitrofanov avatar May 17 '18 07:05 Mitrofanov

@Mitrofanov ,

I set up an ES on amazon but need to know your configuration. (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-ac.html) If it's open or you can share with me( temporary login) I'll be glad on checking and test myself, as I'm really curious about this issue.

BTW is grafana running on AWS as well? Thanks.

gbrian avatar May 17 '18 16:05 gbrian

@gbrian So i can tell you my config: My ES running inside of VPC. Access control allows all from such VPC to access it:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "es:*",
      "Resource": "arn:aws:es:*****:******:domain/*****-es6/*"
    }
  ]
}

Grafana runs on ECS cluster in docker within the same VPC (so no connectivity issues here). Also we do have a lot of dashboards with ES datasource in this grafana, and they works well.

Mitrofanov avatar May 18 '18 06:05 Mitrofanov

Just following up on this. Would be interested in a similar set up - AWS ES cluster running in a VPC with grafana hosted in the same VPC (probably not on ECS though).

Any luck getting the queries to run correctly or figuring out the networking issues?

phillbaker avatar Jul 02 '18 21:07 phillbaker