Organization Management in Grafana
Introduction
Organizations in Grafana provide a powerful multi-tenancy feature that allows you to separate users, dashboards, data sources, and other resources into isolated environments. This isolation is essential in enterprise environments where different teams, departments, or even external clients need their own dedicated Grafana space without affecting others.
In this guide, you'll learn how to create and manage organizations, add users to organizations, switch between them, and understand key administrative tasks related to organization management in Grafana.
What are Organizations in Grafana?
An organization in Grafana is a tenant that provides a logical separation of resources. Each organization has:
- Its own users and teams
- Its own data sources
- Its own dashboards
- Its own alerts and notification channels
- Its own configuration settings
This multi-tenancy architecture allows a single Grafana instance to serve multiple departments, teams, or clients with complete isolation between their resources.
Creating and Managing Organizations
Creating a New Organization
You can create a new organization through the Grafana UI or using the HTTP API.
Using the Grafana UI
- Log in as a Grafana admin user
- Go to Configuration > Organizations
- Click the + New Organization button
- Enter a name for the organization
- Click Create
Using the API
You can also create an organization programmatically using the Grafana HTTP API:
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer your-api-key" \
http://your-grafana-instance/api/orgs \
-d '{"name":"New Organization Name"}'
The response will include the ID of the newly created organization:
{
"orgId": 3,
"message": "Organization created"
}
Viewing Organizations
To view all organizations in your Grafana instance:
- Log in as a Grafana admin user
- Go to Configuration > Organizations
You'll see a list of all organizations along with their IDs and names.
Updating an Organization
To update an organization's name:
Using the Grafana UI
- Log in as a Grafana admin user
- Go to Configuration > Organizations
- Click the organization you want to edit
- Update the name
- Click Update
Using the API
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer your-api-key" \
http://your-grafana-instance/api/orgs/3 \
-d '{"name":"Updated Organization Name"}'
Deleting an Organization
To delete an organization:
Using the Grafana UI
- Log in as a Grafana admin user
- Go to Configuration > Organizations
- Click the red X icon next to the organization you want to delete
- Confirm the deletion
Using the API
curl -X DELETE -H "Authorization: Bearer your-api-key" \
http://your-grafana-instance/api/orgs/3
User Management in Organizations
Adding Users to an Organization
You can add users to an organization with specific roles:
Using the Grafana UI
- Log in as a Grafana admin user
- Go to Configuration > Organizations
- Click on the organization you want to add users to
- Go to the Users tab
- Click Add User
- Enter the user's email or username
- Select a role (Admin, Editor, or Viewer)
- Click Add
Using the API
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer your-api-key" \
http://your-grafana-instance/api/orgs/3/users \
-d '{"loginOrEmail":"[email protected]","role":"Editor"}'
User Roles in Organizations
Grafana has three main user roles within organizations:
- Organization Admin: Can manage organization resources including users, teams, data sources, and dashboards
- Editor: Can create and edit dashboards and alerts but cannot manage organization resources
- Viewer: Can only view dashboards (read-only access)
Changing User Roles
To change a user's role within an organization:
- Log in as an organization admin
- Go to Configuration > Users
- Find the user in the list
- Change their role using the dropdown menu
- Click Update
Removing Users from an Organization
To remove a user from an organization:
- Log in as an organization admin
- Go to Configuration > Users
- Find the user in the list
- Click the red X icon to remove them
- Confirm the removal
Switching Between Organizations
Users can belong to multiple organizations and switch between them.
Switching Organizations in the UI
- Click on your profile icon in the bottom-left corner
- Select Switch organization
- Choose the organization you want to switch to
Using the API to Switch Organizations
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer your-api-key" \
http://your-grafana-instance/api/user/using/3
The response will confirm the switch:
{
"message": "Active organization changed"
}
Current Organization Settings
Each organization can have its own settings for preferences like home dashboard, theme, timezone, etc.
To access organization settings:
- Log in as an organization admin
- Go to Configuration > Preferences
- Adjust settings as needed
- Click Save
Common organization preferences include:
- Home Dashboard
- Default timezone
- UI Theme
- Week start day
Best Practices for Organization Management
When to Use Multiple Organizations
Consider using multiple organizations when:
- Strict Isolation is Required: Different departments need complete separation of dashboards and data sources
- Different Authentication Methods: Groups need different authentication providers
- Client Separation: You're providing Grafana as a service to different clients
When to Use Teams Instead
For less strict separation within the same organization, consider using teams:
- Shared Data Sources: When teams need to access the same data sources
- Collaborative Dashboards: When some dashboards should be shared across teams
- Simplified User Management: When users need to access resources across multiple groups
Organization Naming Conventions
Establish a clear naming convention for organizations:
[Environment]-[Department/Client]-[Purpose]
Examples:
prod-marketing-analytics
dev-engineering-monitoring
client-acmecorp-dashboards
Regular Organization Audits
Perform regular audits of your organizations:
- Review user access and roles
- Remove unused organizations
- Check for orphaned resources
- Ensure proper documentation of organization purposes
Troubleshooting Organization Issues
Common Issues and Solutions
Users Can't See Their Dashboards After Switching Organizations
Solution: Ensure the user is looking at the correct organization. Check they have proper permissions in that organization.
Organization Admin Cannot Create Data Source
Solution: Check if the Grafana instance has disabled data source creation at the server level. Check configuration files for restrictions.
Organization Deletion Fails
Solution: Ensure all dashboards, data sources, and users are removed from the organization first.
Practical Example: Setting Up Organizations for a Company
Let's walk through a practical example of setting up organizations for a medium-sized company with multiple departments.
Scenario
You need to set up Grafana for a company with three departments:
- IT Operations
- Development
- Marketing
Each department needs its own dashboards and data sources.
Step 1: Create Organizations
Create three organizations:
# Create IT Operations organization
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/orgs -d '{"name":"IT Operations"}'
# Create Development organization
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/orgs -d '{"name":"Development"}'
# Create Marketing organization
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/orgs -d '{"name":"Marketing"}'
Step 2: Add Users to Organizations
Add users to their respective organizations:
# Add users to IT Operations
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/orgs/1/users \
-d '{"loginOrEmail":"[email protected]","role":"Admin"}'
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/orgs/1/users \
-d '{"loginOrEmail":"[email protected]","role":"Editor"}'
# Add users to Development
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/orgs/2/users \
-d '{"loginOrEmail":"[email protected]","role":"Admin"}'
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/orgs/2/users \
-d '{"loginOrEmail":"[email protected]","role":"Editor"}'
# Add users to Marketing
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/orgs/3/users \
-d '{"loginOrEmail":"[email protected]","role":"Admin"}'
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/orgs/3/users \
-d '{"loginOrEmail":"[email protected]","role":"Editor"}'
Step 3: Configure Data Sources for Each Organization
Switch to each organization and configure appropriate data sources:
# Switch to IT Operations organization
curl -X POST -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/user/using/1
# Add Prometheus data source
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer admin-key" \
http://grafana.example.com/api/datasources \
-d '{
"name": "Production Prometheus",
"type": "prometheus",
"url": "http://prometheus.example.com",
"access": "proxy"
}'
Repeat for each organization with appropriate data sources.
Summary
Organization management in Grafana provides powerful multi-tenancy capabilities, allowing you to segregate users, dashboards, and data sources into isolated environments. This segregation is essential for enterprise environments with multiple teams or when offering Grafana as a service to multiple clients.
Key points to remember:
- Organizations provide complete isolation of resources
- Users can belong to multiple organizations with different roles
- Organization admins can manage users, data sources, and organization preferences
- Consider your organizational structure carefully when deciding between multiple organizations vs. teams
Additional Resources
- Grafana Official Documentation on Organizations
- Grafana HTTP API Documentation
- User Management Best Practices
Exercises
- Create a new organization in your Grafana instance and add yourself as an Admin.
- Create a second organization and add yourself as a Viewer. Practice switching between organizations.
- Use the API to add a new user to one of your organizations.
- Design an organization structure for a company with four departments, considering when to use separate organizations versus teams.
- Create a script that would automatically set up three organizations with specific users and roles.
If you spot any mistakes on this website, please let me know at [email protected]. I’d greatly appreciate your feedback! :)