Grafana - limit access to template variables for specific users & teams - Stack Overflow

I'm learning Grafana and want to use it for monitoring multiple servers within our anisation. I�

I'm learning Grafana and want to use it for monitoring multiple servers within our anisation. I've made a sample dashboard with template variable Host that allows for quick choice of the server I want to investigate. I've also made multiple users and teams within Grafana with different roles permissions (roughly) representing our anisation employees. The metrics are collected by Prometheus Node Exporter and scraped by Prometheus.

What I want to do is to somehow restrict access to the dashboard's variable Host, so that users could only select some servers they are allowed to monitor and not be able to watch the others.

What I've tried to do is adding a allowedUsers label in Prometheus for each scrape target (server to monitor) and set its value to the comma separated list of users allowed to view this server's metrics (e.g. "user1,user2,user32"). Then I've added additional label filter in Grafana's template variable Host, like this: allowedUsers=~".*${__user.login}.*". It works as I desired: current user could only select hosts for which his/her username is listed in the allowedUser label.

However, this approach doesn't seem adecvate to me. If I had lots of users and servers, then managing this long list of allowedUsers would be a nightmare. It might have been made better by specifying allowedTeams instead and provide Grafana team names, but Grafana doesn't have built-in variable similar to ${__user.login} for obtaining the name of the team the user belongs to.

The question is whether there's a proper solution to this problem instead of this questionable dirty hack? I know I can make a copy of the dashboard for each server I want to monitor and then set permissions for each, but it doesn't seem to be "clean" solution either.

P.S.: I'm aware of enterprise features like RBAC but they are unavailable to me since I'm using OSS version of Grafana.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742295624a4417056.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信