Skip to main content
View rawEdit

Grafana configuration

Configuration for Grafana dashboards and visualization.

Authentication

Default credentials

Default admin credentials for local installation:

Username: admin
Password: admin
warning

Change the default password immediately after first login.

Disable anonymous access

GF_AUTH_ANONYMOUS_ENABLED=false

LDAP/Active Directory

# grafana.ini
[auth.ldap]
enabled = true
config_file = /etc/grafana/ldap.toml

OAuth/OIDC

[auth.generic_oauth]
enabled = true
name = OAuth
client_id = your-client-id
client_secret = your-client-secret
scopes = openid profile email
auth_url = https://auth.example.com/authorize
token_url = https://auth.example.com/token
api_url = https://auth.example.com/userinfo

Data sources

VictoriaMetrics data source

Automatically configured during installation:

apiVersion: 1
datasources:
- name: VictoriaMetrics
type: prometheus
url: http://victoriametrics:8428
access: proxy
isDefault: true

Adding additional data sources

datasources:
- name: PostgreSQL
type: postgres
url: postgresql://host:5432/db
user: readonly_user
secureJsonData:
password: ${DB_PASSWORD} # Use environment variable

Dashboard provisioning

Auto-loading dashboards

PostgresAI dashboards are provisioned automatically:

apiVersion: 1
providers:
- name: postgres_ai
folder: postgres_ai
type: file
options:
path: /var/lib/grafana/dashboards/postgres_ai

Custom dashboard folder

GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/var/lib/grafana/dashboards/custom/home.json

Variables

Default variable values

Override dashboard variable defaults:

# In dashboard JSON
"templating": {
"list": [
{
"name": "cluster_name",
"current": {
"value": "production"
}
}
]
}

Variable refresh

Control when variables are refreshed:

SettingBehavior
On dashboard loadRefresh when dashboard opens
On time range changeRefresh when time picker changes
NeverManual refresh only

Panel customization

Time zone

# Use browser time zone
GF_DEFAULT_TIMEZONE=browser

# Use specific time zone
GF_DEFAULT_TIMEZONE=UTC

Theme

GF_DEFAULT_THEME=dark  # dark, light

Refresh interval

Default auto-refresh:

GF_DASHBOARDS_DEFAULT_INTERVAL=15s

Performance

Query caching

Enable query result caching:

[caching]
enabled = true
ttl = 60s

Max data points

Limit data points returned per query:

[server]
router_logging = false

Concurrent queries

[database]
max_open_conn = 100

Embedding

Allow embedding in iframes

[security]
allow_embedding = true

CORS settings

[security]
cookie_samesite = none
cookie_secure = true

Alerting

Enable Grafana alerting

[unified_alerting]
enabled = true

Disable classic alerting

[alerting]
enabled = false

See Alerting configuration for alert rules.

Plugins

Install plugins

# Via environment variable
GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-piechart-panel

# Via CLI
grafana-cli plugins install grafana-clock-panel

Required plugins

PostgresAI dashboards use these plugins:

PluginPurpose
Stat panelSingle value displays
Time seriesMetric charts
TableData grids
HeatmapWait event visualization

Resource limits

Memory

# docker-compose.yml
services:
grafana:
deploy:
resources:
limits:
memory: 512M

Concurrent users

[server]
concurrent_render_request_limit = 30

Backup and restore

Backup dashboards

# Export all dashboards
for uid in $(curl -s http://monitor:YOUR_PASSWORD@localhost:3000/api/search | jq -r '.[].uid'); do
curl -s "http://monitor:YOUR_PASSWORD@localhost:3000/api/dashboards/uid/$uid" > "dashboard-$uid.json"
done

Restore dashboards

for file in dashboard-*.json; do
curl -X POST -H "Content-Type: application/json" \
-d @"$file" \
http://monitor:YOUR_PASSWORD@localhost:3000/api/dashboards/db
done

Troubleshooting

Check data source connectivity

curl http://localhost:3000/api/datasources/proxy/1/api/v1/query?query=up

Debug panel queries

  1. Open panel edit mode
  2. Click "Query Inspector"
  3. Review raw query and response

Common issues

IssueCauseSolution
No dataData source misconfiguredCheck data source URL and credentials
Slow dashboardsToo many panelsReduce time range or panel count
Login loopCookie issuesClear cookies, check cookie_samesite