paulc1111 paulc1111 -4 years ago 230
Node.js Question

Access to Grafana page directly from local login page

I'm trying to access Grafana metrics dashboard without using supported login form from Grafana. I just want users to go directly with authenticated Grafana page..

I have built login form(passport-local strategy) by using express in Node.js with connecting mongoDB to manage users, and try to connect to Grafana directly with session that I used but didn't work well.

Is there any ways to do this..?

I found one blog from raintank but I don't understand what he says because I'm new to server and all that stuff..

I just set it like below for now.

app.get('/grafana', isLoggedIn, function(req, res){
console.log('Accessing to grafana');

localhost:8080 is my Grafana page, and it still wants users to login again.

Hope my explanation is clear..

Thank you.

Answer Source

The code which you have posted above only redirects the user to the local running graphana server and will not login the user automatically as redirect() just redirect from current url to another url, just like browsing to another url from a webpage.

You will have to use this document for reference to create a API-token key and make a API call to grahana local server instance running.

And if you are planning to embed the graphana dashboard I would suggest using an iframe and you will have to give option for user to login again .

All this said I would strongly suggest against all this ,as this is not secure at all. Please have a read through this issue


It is worth taking look at this document

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download