Dynamic dashboard with Zabbix datasource

Hello,

I started using Grafana two weeks ago and am currently working with Grafana 10.2.0 and Zabbix.

I have three dashboards, each containing five panels. All my panels are stored in the library and are links. Each dashboard works with two variables:

  • Group: which includes all groups filtered by /^"client_name".*/ (each dashboard is specific to a client).

  • Host: which is a classic variable

Currently, when adding a new client, I need to:

  1. Create a new user and set the appropriate permissions.
  2. Create a folder, set permission.
  3. Copy and paste the main dashboard.
  4. Adjust the two variable filters for the new client.

My boss wants me to automate this process to minimize manual intervention. Ideally, I would like to use a regular expression or another mechanism so that:

  • Once a client user is created and given access to the main folder, their username is automatically used as a filter in the variable.
  • The dashboard dynamically displays only their data without requiring manual modifications.
  • Deleting step 3, 4 and half of the 2nd.

This would allow us to have a single dashboard for all clients instead of one dashboard per client. That way, data is displayed dynamically based on the client’s name, so it’s easier to set up, and I only need to maintain one dashboard instead of multiple copies.

I would like to know if it is possible to do that.

Thank you for taking the time to read my message! :blush:

1 Like

that is a good boss. yes it can be done. what backend are you using for the dashboards, do all users share the same backend to query data from or they have their own backend?

user 1 , data source database mysql,
user 2, rest api

or is it
user 1, datasource: mysql01, database: foo
user 2, datasource: mysql01, database: bar

or it is
user 1, datasource: mysql01, database: foo
user 2, datasource: mysql02, database: foo

or it is
user 1, datasource: mysql01, database: foo, table: user1
user 2, datasource: mysql01, database: foo, table: user2

etc

please specify what the landscape looks like

1 Like

Hello @yosiasz,

Thank you for your help! Indeed, my dashboards share the same database and data source.

Just one more thing: I’ve been asked to scale this for hundreds of clients. Currently, I’m testing with just two, so I need a scalable solution.

Here’s the setup:

  • User 1 → Datasource: mysql01, Database: foo, Table: user1
  • User 2 → Datasource: mysql01, Database: foo, Table: user

Let me know if you need more information.

Thanks again for your answer!

not the best db design with user specific table names which most probably require you to do dynamic queries.

is this table design final?

Sorry, i m back ! so the design is not final, for me it was easier at the moment but i am open to other ideas.

For information i asked a trial for grafana enterprise to create multiple data sources with some restrictions added in data source configuration to have more options on security data source.

I am still looking a solution, just for information it is possible to use the reggex ${__user.login} that is dynamic based on the logged-in user in variables ?
I can see that is command is working in a text panel, we can see the name of logged-in user but impossible to work with in variables.
Thank’s you.