divinity666 / ruby-grafana-reporter

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

Webpage does not work (connection error) #11

Closed BigMarioss closed 2 years ago

BigMarioss commented 2 years ago

Hi, I have a Grafana instance installed on Ubuntu Server 20.04 (machine IP: 172.16.2.200:3000). I installed ruby-grafana-reporter using the wizard config file but when I go to _http://172.16.2.200:8815/render?var-template=demo_report_ the browser says "Connection error". I checked also the firewall ports and the 3000 and 8815 ports are open.

And how can I create a PDF report for a specific dashboard?

Can you help me? Thank you.

This is the wizard configuration output:

Specify port on which reporter shall run [8815]: 8815
Specify grafana host [http://localhost:3000]: http://172.16.2.200:3000
Testing connection to 'http://172.16.2.200:3000' _without_ API key...I, [2021-09-14T14:59:57.648680 #174688]  INFO -- : Reporter is running with NON-Admin privileges on grafana.
done.
Access to grafana is permitted as NON-Admin.Specify path where templates shall be stored [./templates]:
Specify path where created reports shall be stored [./reports]:
Specify path where rendered images shall be stored (relative to templates folder) [./images]:
Specify report retention duration in hours [24]:
Configuration file successfully created.
Configuration file validated successfully.
Shall I create a demo report for your new configuration file? Please note that this report might contain confidential information, depending on the confidentiality of the information stored in your dashboard. [yN]: y
Demo template './templates/demo_report.adoc' does already exist. Do you want to overwrite it? [yN]: y
Overwriting existing DEMO template.
Evaluating dashboard 'xl28gl1Zz' for building a demo report...done - 11 examples to go
Evaluating dashboard 'feevvd' for building a demo report...done - 11 examples to go
Evaluating dashboard '244jusH8' for building a demo report...done - 11 examples to go
Evaluating dashboard '9oVzAxS7z' for building a demo report...done - 11 examples to go
Evaluating dashboard '41URQF7mz' for building a demo report...done - 11 examples to go
Evaluating dashboard 'jUisupg7z' for building a demo report...done - 11 examples to go
Evaluating dashboard '8NRz0xInz' for building a demo report...done - 11 examples to go
Evaluating dashboard '09AJbeh7m' for building a demo report...done - 11 examples to go
Evaluating dashboard 'Re28gl1Zz' for building a demo report...done - 11 examples to go
Evaluating dashboard 'Nnj6bn3' for building a demo report...done - 11 examples to go
Evaluating dashboard '07U4Xzg7z' for building a demo report...done - 11 examples to go
Evaluating dashboard 'y7kLiF7mr' for building a demo report...done - 11 examples to go
Evaluating dashboard '5fUgAxSnk' for building a demo report...done - 11 examples to go
For 11 reporter functionalities no appropriate examples could be found in the configured grafana instance.
DEMO template './templates/demo_report.adoc' successfully created.

Now everything is setup properly. Create your reports as required in the templates folder and run the reporter either standalone with e.g. the following command:

   /usr/bin/ruby2.7 /usr/local/bin/ruby-grafana-reporter -t demo_report -o demo_report.pdf

or run it as a service using the following command:

   /usr/bin/ruby2.7 /usr/local/bin/ruby-grafana-reporter

Open 'http://localhost:8815/render?var-template=demo_report' in a webbrowser to test your configuration.

This is the config file:

grafana:
  default:
    host: http://172.16.2.200:3000

grafana-reporter:
  report-class: GrafanaReporter::Asciidoctor::Report
  templates-folder: ./templates
  reports-folder: ./reports
  report-retention: 24
  webservice-port: 8815

default-document-attributes:
  imagesdir: ./images
divinity666 commented 2 years ago

Let's first make it run and then discuss the rest:

1) Please check what happens, when you try calling the reporter from command line as stated: ˋ/usr/bin/ruby2.7 /usr/local/bin/ruby-grafana-reporter -t demo_report -o demo_report.pdfˋ Maybe you can also add ˋ-d DEBUGˋ to get some more details.

2) It looks like the creation of the demo template somehow failed. Would you mind sharing the ˋdemo_report.adocˋ template here?

3) Creating a template for a specific dashboard currently means, that you have to define an own template for this dashboard for the desired content. Let's come back to that maybe later, if you still need some support.

BigMarioss commented 2 years ago

Sure. I enabled debug mode, here it is the output:

user@srv:/home# /usr/bin/ruby2.7 /usr/local/bin/ruby-grafana-reporter -t demo_report -o demo_report.pdf -d DEBUG
I, [2021-09-17T09:24:48.719014 #300689]  INFO -- : Report started at 2021-09-17 09:24:48 +0200
D, [2021-09-17T09:24:48.719190 #300689] DEBUG -- : Document attributes: {"convert-backend"=>"pdf", "imagesdir"=>"./images", "var-template"=>"demo_report"}
D, [2021-09-17T09:24:48.720104 #300689] DEBUG -- : Template ./templates/demo_report.adoc contains 0 calls of grafana reporter functions.
I, [2021-09-17T09:24:49.160126 #300689]  INFO -- : Report creation ended after 1 seconds with status 'finished'

And this is the "demo_report.adoc" file:

= Demo report

Created by `+ruby-grafana-reporter+` version 0.4.5

== Examples

=== AlertsTableIncludeProcessor

No example found for GrafanaReporter::Asciidoctor::AlertsTableIncludeProcessor in the dashboards.

=== AnnotationsTableIncludeProcessor

No example found for GrafanaReporter::Asciidoctor::AnnotationsTableIncludeProcessor in the dashboards.

=== PanelImageBlockMacro

No example found for GrafanaReporter::Asciidoctor::PanelImageBlockMacro in the dashboards.

=== PanelImageInlineMacro

No example found for GrafanaReporter::Asciidoctor::PanelImageInlineMacro in the dashboards.

=== PanelPropertyInlineMacro

No example found for GrafanaReporter::Asciidoctor::PanelPropertyInlineMacro in the dashboards.

=== PanelQueryTableIncludeProcessor

No example found for GrafanaReporter::Asciidoctor::PanelQueryTableIncludeProcessor in the dashboards.

=== PanelQueryValueInlineMacro

No example found for GrafanaReporter::Asciidoctor::PanelQueryValueInlineMacro in the dashboards.

=== SqlTableIncludeProcessor

No example found for GrafanaReporter::Asciidoctor::SqlTableIncludeProcessor in the dashboards.

=== SqlValueInlineMacro

No example found for GrafanaReporter::Asciidoctor::SqlValueInlineMacro in the dashboards.

=== ShowHelpIncludeProcessor

No example found for GrafanaReporter::Asciidoctor::ShowHelpIncludeProcessor in the dashboards.

=== ShowEnvironmentIncludeProcessor

No example found for GrafanaReporter::Asciidoctor::ShowEnvironmentIncludeProcessor in the dashboards.
divinity666 commented 2 years ago

Ok, here some observations:

1) The good thing is, that the reporter can properly create the report from command line. Anyway the webservice does not work, which might be either a network configuration issue, or something with the reporter. To make sure, that it's not the reporter, please try running the reporter again with -d DEBUG, but now as webservice, i.e. without the -t option and try calling again http://172.16.2.200:8815/render?var-template=demo_report Please post the reporter log output here.

2) Though the reporter recognized your grafana dashboards, it was unable to find panels for the demo report. This leaves me with some questions:

Best regards

divinity666 commented 2 years ago

Closing because of missing feedback. If you have any news, feel free to reopen