divinity666 / ruby-grafana-reporter

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

GrafanaReporterError: Configuration error: Given report template './templates/demo_report' is not a valid template #46

Closed manatwork81 closed 1 month ago

manatwork81 commented 5 months ago

Hi!

Can anyone say me how to create a template? Is there any configuration failure?

Greets

divinity666 commented 5 months ago

Could it be, that your file is missing the extenstion .adoc? If that does not help: How does your config-file look like? How do you call the reporter?

manatwork81 commented 5 months ago

I have reinstalled demo_report.adoc is now here. I have to make an an own template? my Dashboard is named Test, how can i display this on an pdf?

any example or documentation available?

THX

divinity666 commented 5 months ago

The demo_report.adoc should show you, how the template is built. You have to use the dashboard id instead of the dashboard name - look in the readme and the demo report for reference.

manatwork81 commented 5 months ago

Like this?

include::grafana_dashboard[2cd3533-8a09-4b30-b95ea712c80d7288 ]

sorry, i cant find the logic in adoc, can u tell me an example vor this Dashboard ID?

THX

divinity666 commented 5 months ago

Well yes, that could be the ID. Anyway, the call grafana_dashboard does not exist. Please look in the demo_report or the function documentation here: https://github.com/divinity666/ruby-grafana-reporter/blob/master/FUNCTION_CALLS.md

manatwork81 commented 5 months ago

grafana Thank u for the link (its not klickable ;) ) i insert this line in the demo report

include::grafana_panel_image:f2cd3533-8a09-4b30-b95ea712c80d728

There is only a text on PDF ??? i dont understand the syntax for displaying my Dashboard, Sorry

THX

EDIT: i Try to explain:

I have an Dashboard with 4 Graphs, i want to bring this on an PDF. / i have an Second Dashboard with 3 Graphs i want to bring in on an other or an the Same site. Is panel Image the right choice?

EDIT2: When i klick at the Link:

Content-Length: 111 GrafanaReporterError: Request 'GET /grafana_panel_property HTTP/1.1' calls an unknown path for this webservice.

divinity666 commented 5 months ago

I fixed the link, thanks for the hint.

1) Not working function call:

Your line in the report is obviously wrong. Please look in the demo report. It shows the proper syntax and gives examples based on your dashboards. The documentation also properly shows on how to use it:

grafana_panel_image:<panel_id>[options]

There is no include in front of the line. Additionally, you placed the dashboard ID, where the panel ID should be. And finally, you did not use the options in the brackets, to specify the dashboard id.

Please be so kind and make yourself familiar with the demo report, which is created for your individual dashboards during the wizard setup.

2) Is panel image the right choice:

It depends. If your report should contain an image of your grafana image, then this is the correct call. If you want to get data as a table or so, other calls have to be used

3) Error of the get request appears because of the wrong usage of the grafana panel image, stated in question 1)

manatwork81 commented 4 months ago

I have a logoutput, maybe there is an other problem

/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/asciidoctor/processor_mixin.rb:39: warning: deprecated Object#=~ is called on Integer; it always returns nil
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/asciidoctor/processor_mixin.rb:40: warning: deprecated Object#=~ is called on Integer; it always returns nil
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/asciidoctor/processor_mixin.rb:41: warning: deprecated Object#=~ is called on Integer; it always returns nil

/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/asciidoctor/processor_mixin.rb:39: warning: deprecated Object#=~ is called on Integer; it always returns nil
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/asciidoctor/processor_mixin.rb:40: warning: deprecated Object#=~ is called on Integer; it always returns nil
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/asciidoctor/processor_mixin.rb:41: warning: deprecated Object#=~ is called on Integer; it always returns nil

/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/asciidoctor/processor_mixin.rb:39: warning: deprecated Object#=~ is called on Integer; it always returns nil
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/asciidoctor/processor_mixin.rb:40: warning: deprecated Object#=~ is called on Integer; it always returns nil
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/asciidoctor/processor_mixin.rb:41: warning: deprecated Object#=~ is called on Integer; it always returns nil
F, [2024-02-21T20:32:31.292570 #641151] FATAL -- : Broken pipe
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:86:in `write'
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:86:in `block in accept_requests_loop'
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:62:in `loop'
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:62:in `accept_requests_loop'
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:30:in `run'
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/application.rb:154:in `run'
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/application.rb:120:in `configure_and_run'
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/bin/ruby-grafana-reporter:5:in `<top (required)>'
/usr/local/bin/ruby-grafana-reporter:23:in `load'
/usr/local/bin/ruby-grafana-reporter:23:in `<main>'
Traceback (most recent call last):
        9: from /usr/local/bin/ruby-grafana-reporter:23:in `<main>'
        8: from /usr/local/bin/ruby-grafana-reporter:23:in `load'
        7: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/bin/ruby-grafana-reporter:5:in `<top (required)>'
        6: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/application.rb:120:in `configure_and_run'
        5: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/application.rb:154:in `run'
        4: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:30:in `run'
        3: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:62:in `accept_requests_loop'
        2: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:62:in `loop'
        1: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:86:in `block in accept_requests_loop'
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:86:in `write': Broken pipe (Errno::EPIPE)
        10: from /usr/local/bin/ruby-grafana-reporter:23:in `<main>'
         9: from /usr/local/bin/ruby-grafana-reporter:23:in `load'
         8: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/bin/ruby-grafana-reporter:5:in `<top (required)>'
         7: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/application.rb:120:in `configure_and_run'
         6: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/application.rb:154:in `run'
         5: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:30:in `run'
         4: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:62:in `accept_requests_loop'
         3: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:62:in `loop'
         2: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:87:in `block in accept_requests_loop'
         1: from /var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:95:in `rescue in block in accept_requests_loop'
/var/lib/gems/2.7.0/gems/ruby-grafana-reporter-0.6.3/lib/grafana_reporter/application/webservice.rb:95:in `write': Broken pipe (Errno::EPIPE)
server@server:~$

I use MYSQL, thx 4 Help

manatwork81 commented 4 months ago

When i add the line, i will get a pdf like : grafana3

divinity666 commented 4 months ago

Looks like you are providing a UID with < brackets to the call, which will not work.

I guess, you will either have to look into the demo report and try your changes based on that, to better understand the functionality of the tool.

If you want my support, you have to provide a fuller set of information:

Otherwise, I am afraid for not being able to help you further.

manatwork81 commented 4 months ago

Hi, sorry, a lot of work.

i hope this files are okay json.txt template.txt

divinity666 commented 3 months ago

It's strange, that the demo report does not find any examples in your setup for panel images or queries. I don't have a good explanation for that right now, but I hope we get closer to it.

Try the following instead in your template file:

grafana_panel_image:2[dashboard="f2cd3533-8a09-4b30-b95e-a712c80d7288"]

or

|===
include::grafana_panel_query_table:2[query="A",include_headline="true",dashboard="f2cd3533-8a09-4b30-b95e-a712c80d7288"]
|===
manatwork81 commented 3 months ago

api1 api2

Okay, i have tried, he told me i should install grafana-imager, after that my install was crashed.

Now i have installed a new Machine.

I installed Grafana, and made an Api Key.

Machine has 192.168.6.60 as IP, Grafana ans Grafaner Report is on the same machine. I get the error cant connect. is there some step i didnt know?

EDIT curl http://admin:pass****@localhost:3000/api/org <-- Works

I have seen in an other Post API Key looks like kasdfjasklfjaseixcnnie9wqweiqwdeoskcma0da0ie0wiaosca

mine sa-reporter-xxx.....

i geht now this error. server@server:~$ ruby-grafana-reporter GrafanaReporterError: Configuration error: Configuration file does not match schema definition. Expected 'api_key' to match pattern '/^(?:[\w]+[=]*)?$/', but was 'sa-reporter-ea398154-60d0-43f5-98d6-axxxxxxxxxx'.

Edit2 Anonym Api Auth <-- works now installed the image renderer.

get following Error

GrafanaError: The specified panel '2' from dashboard 'f2cd3533-8a09-4b30-b95e-a712c80d7288' could not be rendered to an image. Check if rendering is possible manually by selecting "Share" and then "Direct link rendered image" from a panel's options menu. (Grafana::ImageCouldNotBeRenderedError)

and the second syntax about 900 Pages values and timestamps

manatwork81 commented 3 months ago

Good News. i Installed those Packages:

sudo apt install ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils

and the grafana image renderer, now i have my first image. This infos wasn´t in Tutorial.

Last open Problem is the API Key .

Thanks

divinity666 commented 3 months ago

Thanks for your feedback! I will extend the README to include further instructions to make it easier for new users in future.

Regarding the API Key: I read that since Grafana 8 API Keys are deprecated and potentially removed in Grafana 9. Currently, the reporter only supports API Keys. So, if you still have the option to create API Keys, you could do that.

PS: Sorry for the 900 pages waste :-)

I will check, if I can support the new approach with service accounts in a next release. As of today, this is not supported.

divinity666 commented 3 months ago

I now read through Grafana documentation and it looks like service account tokens are 1:1 replacements for API keys in previous Grafana versions.

I guess the issue here is, that you try to provide the name of the service token to the ruby-grafana-reporter. Instead you have to provide the token. This token usually will be shown only once, when you create that token.

Please try again and let me know the result.

divinity666 commented 1 month ago

I did not receive any feedback here and I just recently provided an animation in the readme, which shows how to configure this. That is, why I will close this issue.