Closed bolausson closed 1 month ago
Thanks for using the reporter!
Your first steps look good.
1) The value you are seeing here, is the timestamp value, which is also part of the query result. You will see more details, if you apply the ˋgrafana_panel_query_tableˋ function. Most likely, you can get your desired value by adding a ˋfilter_columns="time"ˋ (whereas ˋtimeˋ must match the column name of the time column; sometimes also ˋtimestampˋ is used) option to the ˋgrafana_panel_query_valueˋ. 2) The values are identical, because they reflect the timestamp, and not the value. 3) I don't have an idea. Can you maybe share the SUM query?
Lastly: the image rendering should work, if you installed the image rendering plugin. For advice, you might use the ˋShareˋ button of a panel on your dashboard. This will most likely state, that no plugin is installed. After you installed it, it should be working as well with the reporter.
Ah, I just saw the query for the Sum and it is refering to the other two queries. I am afraid, this is not yet supported by the reporter - sorry.
Thanks a lot a) For this great tool! b) For the quick repsonse which pushed me in the right direction!
The grafana-image-renderer plugin was entirly my fault: a) I installed it as "root" and not as "grafana" so I had do fix the permissions b) I had to add "rendering_ignore_https_errors = true" under "[plugin.grafana-image-renderer]"
Based on your comments I was able to get a proper report. It was not very obvious that you have to "filter out" something if there is only one thing reported :)
Anyway I got a good template now:
$ cat templates/power_report_test.adoc
// https://docs.asciidoctor.org/asciidoc/latest/
= Lab energy report
[.text-center]
{localdatetime}
== Rack 01
[cols="h,1"]
|===
|PDU|kWh
|Left
|grafana_panel_query_value:1[dashboard="fdn1njnosc83ke",query="Rack01Left",select_value="last",from="now/M",to="now",instant="true",format="%.2f,%.2f",filter_columns="Time"]
|Right
|grafana_panel_query_value:1[dashboard="fdn1njnosc83ke",query="Rack01Right",select_value="last",from="now/M",to="now",instant="true",format="%.2f,%.2f",filter_columns="Time"]
|Left + Right
|grafana_panel_query_value:1[dashboard="fdn1njnosc83ke",query="Rack01Sum",select_value="last",from="now/M",to="now",instant="true",format="%.2f,%.2f",filter_columns="Time"]
|===
grafana_panel_image:1[dashboard="fdn1njnosc83ke",width="100%"]
grafana_panel_image:2[dashboard="fdn1njnosc83ke",width="100%"]
Or the sake of completeness, I attached the Grafana Dashboard and the two panels:
And as well the template and the resulting PDF power_report_test.adoc.txt power_report_test.pdf
And this is the resulting report (screenshot for the PDF):
I partially managed to get a report - lets ignore tha fact that the image renderer plugin is not working (for whatever reason).
I created a simple stat panel to test ruby-grafana-reporter. It shows the energy consumption for two PDUs (left and right). The power consumption is slightly different, but the report generated by ruby-grafana-reporter show the same value for both queries.
Essentially I have two questions:
Below are the screenshots of the dashboard and the panel:![PDU-Dashboard_edit](https://github.com/divinity666/ruby-grafana-reporter/assets/10600678/0eb1e2d6-4661-4170-a16e-6712f956c6eb)
This is a screenshot of the generated report:![view_report](https://github.com/divinity666/ruby-grafana-reporter/assets/10600678/f8fa6427-dc7d-4fe5-a0a2-06d7d6b64a0a)
This is the generated PDF: view_report.pdf
Application call
ruby-grafana-reporter -c grafana_reporter.config
Template file
grafana_panel_image:20[dashboard="ediskdcksqz28e",width="100%"]
== Left PDU grafana_panel_query_value:20[query="Left",dashboard="ediskdcksqz28e"]
== Right PDU grafana_panel_query_value:20[query="Right",dashboard="ediskdcksqz28e"]
== Sum grafana_panel_query_value:20[query="Sum",dashboard="ediskdcksqz28e"]
This configuration has been built with the configuration wizard.
grafana: default: host: https://172.16.0.102:3000 api_key: glsa_yyy_xxx
grafana-reporter: check-for-updates: 1 report-class: GrafanaReporter::Asciidoctor::Report templates-folder: ./templates reports-folder: ./reports report-retention: 24 webservice-port: 8815
default-document-attributes: imagesdir: ./images