divinity666 / ruby-grafana-reporter

Reporting Service for Grafana
MIT License
66 stars 5 forks source link

Configure domain for my Grafana and reportgenerator #55

Open hoouinkyouma opened 2 weeks ago

hoouinkyouma commented 2 weeks ago

Hi, I'm running grafana and ruby-grafana-reporter as a docker container and I have the respective volumes mounted to it.

My grafana is running on the domain, example: https://my-grafana.com => for accessing grafana

The ruby-reporter is running on 8815 port and my grafana_reporter.config, looks like this:

grafana:
  default:
    host: https://my-grafana.com/ # 
    api_key: glsa_nnRscoPFJXXXX21

grafana-reporter:
# Specifies how often the reporter shall check for newer versions [number of days].
# You may set check-for-updates to 0 to disable
  check-for-updates: 7
  report-class: GrafanaReporter::Asciidoctor::Report
  templates-folder: ./templates
  reports-folder: ./reports
  report-retention: 168
  webservice-port: 8815

default-document-attributes:
  imagesdir: ./images

Since, you can see, my host, I have mentioned my domain name instead of the ip and the port number. For the reports part on the Grafana, I created a link and added the URL: https://my-grafana.com/report/render?var-template=report.adoc. (report.adoc is the file name in my local.)

When I try to generate the reports, this is what I see in my next window:

Screenshot 2024-06-20 145325

Now, I'm wondering, why it'd say that? I have a target group and listeners configured correctly. Can you please help on resolving this? How would I go about adding my domain and use it for reporting instead of using the ip address and the port number?

divinity666 commented 1 week ago

Hi there. Looks like it tries to call /report/render... for getting the grafana panels. Can you show some parts of your template file? Did you try create a demo template with the wizard and call that with your web URL?

hoouinkyouma commented 1 week ago

No, I skipped the demo template, kind of gotten used to the adoc templates and created one for myself. My report.adoc file looks like this: :pdf-theme: /home/ubuntu/grafana-pro/reportgen/themes/custom-theme.yml :imagesdir: ./images

[.text-center] image::logo.png[300,200,float="right",align="center"]

[.text-center] = Monitoring System :grafana_default_dashboard: rYdddlPWkL1

grafana_panel_image:1[scale=45, render-height="1250",render-width="1750"] [cols="8*",options="header"] |=== | grafana_panel_image:7[scale=35,render-height="125",render-width="125"] | grafana_panel_image:8[scale=35,render-height="125",render-width="125"] | grafana_panel_image:9[scale=35,render-height="125",render-width="125"] | grafana_panel_image:10[scale=35,render-height="125",render-width="125"] | grafana_panel_image:11[scale=35,render-height="125",render-width="125"] | grafana_panel_image:12[scale=35,render-height="125",render-width="125"] | grafana_panel_image:13[scale=35,render-height="125",render-width="125"] | grafana_panel_image:14[scale=35,render-height="125",render-width="125"] |===

I'm also using a custom-theme. The readme file says, to add the "http://<>:<>/render?var-template=demo_report"

Let's say my grafana is on https://my-grafana.com, I've added a path to this domain for 8815 port (/reports) for report generation. So, my link looks like https://my-grafana.com/reports/render?var-template=report.adoc for report. Thanks a lot for helping out

divinity666 commented 1 week ago

Ah, now I see the issue: The webservice is expecting to be called on top level, like e.g. /render instead of /reports/render.

Do you have the possibility to rewrite the URL for the reporter? If so, you can try it out.

Apart from that: I think, I have an idea on how to allow sub-urls in a next release.

hoouinkyouma commented 1 week ago

I'll try this out and let you know, thanks a lot!