thingsboard / thingsboard-edge

Apache License 2.0
98 stars 74 forks source link

[Question] Generate Report node in rule chain refuses connection at Edge #59

Open akseerali opened 1 year ago

akseerali commented 1 year ago

Component

Description I am trying to generate reports on cloud and edge. On the cloud, the reports can be easily scheduled; however, on the edge I am getting "connection refused" error in the Generate Report node in rule chain. The edge also can't export the dashboard.

Please share any hints on how to clear this error. I have also tried to configure the edge reporting parameters in docker compose file but its not solving the problem.

image

image

Environment

volodymyr-babak commented 1 year ago

Hello @akseerali,

In order to generate reports on ThingsBoard Edge, there are a few critical steps that need to be carried out. Primarily, you'll need to initiate the web-report service and ensure that your Edge can access this service. Furthermore, the web-report service must be able to access the Edge in order to open dashboards, take 'screenshots' of these dashboards, and generate reports based on this data.

To aid in the configuration, I've attached a sample docker compose file. This example pertains to an Edge that is connected to thingsboard.cloud and has the capability to generate reports:

image

docker-compose.yml.txt

Please note that to ensure the web-report service can access the Edge container running inside Docker, it's necessary to access Edge using the IP address of your host machine:

image

One potential pitfall to be aware of is that if you open the Edge UI using localhost:8080, the web-report service will interpret the baseUrl as localhost and attempt to open the dashboard within its own Docker container. However, it needs to open the dashboard in the Edge container for the correct operation.

I hope this information aids in resolving your issue. Should you have further questions or encounter additional problems, please don't hesitate to reach out.

akseerali commented 4 months ago

Hi @volodymyr-babak

I have a query regarding the scheduled reporting feature at the edge.

Background: We are using a schedule to generate a dashboard report, which is then sent to a user via email. Please see the diagram below for the feature reporting implemented at the edge. image Figure: Overview of reporting feature implemented at the edge.

Issue: When we generate a dashboard report consisting of time series data using a scheduler, it generates the dashboard report with blank widgets that show time series data, such as a bar chart, line chart, or time series table. The entity table or the widgets with only the latest values are generated normally.

This issue is observed when the user does not monitor the edge. For example, if the user has not logged in to monitor the edge UI for a few days, the edge is unable to generate scheduled reports for the time series data. Please check the two figures below, which show an example of the normal dashboard view and the dashboard view generated from a scheduled report.

image Figure: Overview of a normal dashboard consisting of time series widget and entity table.

image Figure: Overview of a dashboard generated from scheduled report feature.

Question: Is it possible to solve this issue?

volodymyr-babak commented 4 months ago

Hi @akseerali,

please provide your Scheduler configuration.

Additionally, please check the same behavior on TB server, if possible. In this way we'll understand if the root cause is in the Edge or in TB Report generation in general.

akseerali commented 2 months ago

There was an issue with the rule chain configuration. Issue was cleared after following the correct steps. https://thingsboard.io/docs/pe/user-guide/reporting/

akseerali commented 1 month ago

Hi @volodymyr-babak

The issue is appearing again.

We have gone through some troubleshooting steps and presented some insights for better understanding.

Here are some detailed steps for the scheduler configuration and to reproduce this issue:

  1. Configuration of reporting schedule - part 1 image

  2. Configuration of reporting schedule - part 2 image

  3. Configuration of edge root rule chain - part 1 image

  4. Configuration of edge root rule chain - part 2 image

  5. Configuration of edge root rule chain - part 3 image