IzakMarais / reporter

Service that generates a PDF report from a Grafana dashboard
Apache License 2.0
946 stars 304 forks source link

Timeout Error #343

Closed Atharv945 closed 1 year ago

Atharv945 commented 1 year ago

Hello, I am getting " took to long to respond" error while trying to generate pdf using grafana reporter service. Please find attached screenshot for the same. Can anyone kindly help with this? Grafana_PDF issue

yuzjzj commented 1 year ago

rollback your image version: grafana/grafana-image-renderer:3.6.1 It works to me.

bmdeshmukh18 commented 1 year ago

Current version of Grafana Image Renderer is 3.6.3.

image

How do I rollback to 3.6.1. Could you please help with the commands

In addition to above details, this Grafana instance is hosted on a AWS private cloud instance. Is there anything in specific we need to setup to be able to access the Grafana reporter URL that will be generated.

Also the grafana server is configured for LDAP access and not accessible by the IP. The host name is configured as "https://client.service-server/grafana"

As the protocol is https so the port will be 443.

How should be the URL for generating the PDF in this scenario.

yuzjzj commented 1 year ago

I just use docker desktop try something.

If you are using ECS , change "latest" for your compose.yml.

    image: grafana/grafana-image-renderer:latest

If you are using EC2 or other way, Maybe you can try grafana-cli:

grafana-cli plugins install grafana-image-renderer <version>

Or Install a packaged plugin(download zip from this page)

bmdeshmukh18 commented 1 year ago

We did a rollback to the version 3.6.1.

and running the grafana-reporter service as below.

[root@sandbox5 bin]# grafana-reporter -ip client.service.com/grafana -proto https:// -port :443 2023/01/19 14:53:31 grafana reporter, version: 2.3-1 hash: 6cfc3e220dc4f8fc0175ae0ec8698d35546d8c10 2023/01/19 14:53:31 serving at ':443' and using grafana at 'https://client.service.com/grafana' 2023/01/19 14:53:31 SSL check enforced 2023/01/19 14:53:31 Using sequential report layout. Consider enabling 'grid-layout' so that your report more closely follow the dashboard layout.

And the URL I am running is as below. https://client.service.com/grafana/api/v5/report/{dashboard-ID}

When this url is called with or without the apitoken, I am seeing below result on the page.

image

Also when I try to ping this url from the EC2 console, I am getting below error. ping: https://client.service.com/grafana/api/v5/report/{dashboard-ID}: Name or service not known

Grafana version = v8.4.10

yuzjzj commented 1 year ago

Found your reporter port(and url) and use it(like this). If it is not work, try renderer port(and url).

bmdeshmukh18 commented 1 year ago

Found the issue. Image renderer was not working due to some missing libraries. Fixed that. Again texlive-latex package was missing. Fixed that too.

After this I was able to generate the pdf via command line mode using below command.

grafana-reporter -cmd_enable=1 -cmd_apiKey eyJrIjoid0Y0VkszdFpKUzlyenhEeh0ekM1Y0xBUzJsZENRZzIiLCJuIjoiR3JhZmFuYVBERiIsImlkIjoyfQ= -proto https:// -ip client.service.com/grafana -cmd_dashboard XgN0Spsd4k -cmd_ts from=now-1y -cmd_o Output.pdf

But I am not able to generate the PDF using the URL. I am still getting "message": "Not found" OR "message": "Unauthorized"

what might be the causing the issue here. Any inputs? I am trying to generate the pdf using below URL's.

https://client.service.com/grafana/api/v5/report/XgN0Spsd4k

https://client.service.com/grafana/api/v5/report/XgN0Spsd4k?apitoken=eyJrIjoid0Y0VkszdFpKUzlyenhEeh0ekM1Y0xBUzJsZENRZzIiLCJuIjoiR3JhZmFuYVBERiIsImlkIjoyfQ=

https://client.service.com/grafana/api/v5/report/XgN0Spsd4k?apitoken=eyJrIjoid0Y0VkszdFpKUzlyenhEeh0ekM1Y0xBUzJsZENRZzIiLCJuIjoiR3JhZmFuYVBERiIsImlkIjoyfQ=&from=now-1y&to=now

In all the scenarios, I am getting below result in the browser.

image

Please suggest if there is something I am missing or I need to fix.

yuzjzj commented 1 year ago

Following is my sample:

I have 3 containers(services), they call http://{container_name} between subnet(mynet). Call [http://localhost:{host_port}]() for public.

compose.yml

services:
  grafana:
    image: grafana/grafana:9.3.2
    ports:
      # {host_port}:{container_port}
      - 3000:3000
    environment:
      # renderer
      - GF_RENDERING_SERVER_URL=http://renderer:8081/render
      - GF_RENDERING_CALLBACK_URL=http://grafana:3000/
      - GF_LOG_FILTERS=rendering:debug
    networks:
      - mynet

  renderer:
    image: grafana/grafana-image-renderer:3.6.1
    ports:
      # for reporter, we don't using from public
      - 8081
    networks:
      - mynet

  reporter:
    image: izakmarais/grafana-reporter:2.3.1
    ports:
      - 8686:8686
    depends_on:
      - renderer
    command: "-ip grafana:3000"
    networks:
      - mynet

I using [http://localhost:8686/api/v5/report/{dashboard_ID}?apitoken={apitoken}&]() in my dashboard.(notice "&") If you call [http://localhost:3000/api...](), You will get {"message": Not found"}

IzakMarais commented 1 year ago

Thanks to @yuzjzj for the replies!

Closing this issue. The reporter is provided as is and I cannot help with debugging network setups.