Best way to show Grafana in Dashboard?

Does anyone have some working code for the BuildTemplate node? I had a look at https://flows.nodered.org/flow/8e96b8630c4edc866aa0459354033c9b and can't figure it out; there's too much going on in that flow

While I have a working example, it won't help you unless your grafana is on a pi with a local address of yellow.local.

1 - did you import the flow?
2 - did you read the directions in the flow write up?
3 - did you make the changes to the grafana.ini?
4 - did you copy the shared link path and enter it in the BuildTemplate function node?

It took me under ten minutes to read the writeup, do what it told me and get it working. The only triky part was locating the grafana.ini file (on a pi it is at /etc/grafana/grafana.ini)

Yep, made the changes to Grafana.ini, imported the flow and replaced the link in BOTH BuildTemplate nodes. So you didn't change anything else in the flow? There are 4 unconnected nodes with URLs. Updating them to my URL also didn't do anything.

Another thing I'm not sure is where do you get the panel ID from in Grafana? If you look at the Share URL in the Grafana panel the last parameter is viewPanel=x so I assume x is the panel ID

If you look at the Share URL in the Grafana panel the last parameter is viewPanel=x so I assume x is the panel ID

If you look at the share URL in the Grafana panel there is a panelId parameter in the url.

My URL for some reason looks different. It has viewPanel but doesn't have panelId as per your example. I just recently installed Grafana so maybe this was changed.

Interestingly when I post the URL generated from the last node (e.g. Charttemperatuur) to a new browser it opens up the login page and when I enter the credentials the whole dashboard appars - as it can't find the panelId. When I change the parameter from panelId to viewPanel and paste the URL generated it pasts one single panel. So this is a required change for me. When I add a debug node to Charttemperatuur node the correct payload gets created (which I can successfully open in a browser after authentication).

However it still doesn't show the graph. Grafana.ini have been refreshed as per the instructions. Main question in my mind is how are the Grafana credentials passed to the browser.

If you changed the grafana.ini and added anonymous access enabled = true you shouldn't need to send credentials.

When you share a dashboard


you won't see a panelId

If you click on the 'share' under the panel title
Screen Shot 2020-06-04 at 4.57.53 AM

You will see the Embed option which shows the panelId

Yep, checked the Grafana log and it clearly indicated the Grafana.ini I have made the 2 updates to. Also have the correct panel IDs and looking at the debug node the flow seems to do what it's supposed to do and creates the correct payload.

So my bet is on the Grafana install. I'm running it on an AWS EC2 instance. It's working fine (as far as I can tell) as I can push data to it from various sources. Had a look at the Grafana log file and there don't seem to be any errors captured.

Would it be possible to send through your Grafana.ini (less the passwords of course) to see whether anything else in this config might be different

On the node-red dashboard, right click on your non-showing chart, inspect element, refresh, look for any errors in the tabs, not unlikely that you are not allowed to embed it due to aws.

Thanks for the tip. Found the error. I have Node-RED accessed via https but the app requested an insecure iFrame from Grafana as I haven't secured Grafana yet. Cool! At least I know where it break. Onto trying to figure out how to secure Grafana :slight_smile:

Are you running Grafana/Node-RED locally?

Finally managed to get this to work. The issue was Node-RED runs on https (IBM Cloud) and Grafana at the time wasn't secured yet (http) which stopped it from loading in Node-RED. Grafana is now secured and the iFrames load.

However I'd like to remove the navigation bar (marked red) from the iFrame but can't seem to find how to switch this off.

iFrame

Just add fullscreen & kiosk to the iframe url.
This is how I've structured my chart...

<iframe id="powerchart" style="width:100%; height:100%; overflow:hidden;  margin:auto; border:none;" src=https://mydash.co.uk:8443/d/faa7sa6da/realtime-power?orgId=1&amp;refresh=5s&amp;theme=dark&amp;from=now-1m&amp;to=now&amp;viewPanel=2&amp;fullscreen&amp;kiosk> </iframe>

chart

3 Likes

Thanks. Now it looks the part!

1 Like

You may be better off asking on a Grafana forum.

Sadly I think it’s almost never better asking in the Grafana forum, as it’s like talking to a wall :confused:

3 Likes

Ok. Will take that into account next time

That is true. I tried helping out there for a while but the quantity of requests for help is so great that I was soon overwhelmed and gave up. I believe the problem may be that the company that profits from commercial use of Grafana does not seem to be interested in supporting users, leaving it mostly to volunteers to respond on the forum. In fact even paying users don't seem to get good support, and the quality of documentation and online resources is mostly very poor. I believe this is false economy as the more people that use it privately the more likely it is that they will use it commercially. If the support is rubbish then they will think twice before paying for it. Unfortunately there does not seem to be a good alternative at the moment, so they can get away with poor support.

2 Likes