Grafana Configuration 参数详解(1)
---恢复内容开始---
Granfana Configuration 配置文件grafana.ini包含很多选项,可对其进行调整,调整后重启grafana服务方可生效。
Paths配置段
#################################### Paths #################################### [paths] # Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) ;data = /var/lib/grafana # 默认存放数据位置 # Temporary files in `data` directory older than given duration will be removed ;temp_data_lifetime = 24h
# 删除 'data'目录给定时间前的临时文件,使用0则不删除临时文件,时间格式h,m。如168h,30m,10h30m
# Directory where grafana can store logs ;logs = /var/log/grafana # grafana存储日志的目录 # Directory where grafana will automatically scan and look for plugins ;plugins = /var/lib/grafana/plugins # grafana存放插件的目录 # folder that contains provisioning config files that grafana will apply on startup and while running. ;provisioning = conf/provisioning
Server配置段
#################################### Server ####################################
[server]
# Protocol (http, https, socket)
;protocol = http
# The ip address to bind to, empty will bind to all interfaces
;http_addr = # 绑定ip地址,空及绑定所有ip地址
# The http port to use
;http_port = 3000 # 使用端口,若要调整为使用80端口,需要执行如下命令:$ sudo setcap 'cap_net_bind_service=+ep' /usr/sbin/grafana-server
或是可以使用nginx或是apache所做前端服务器,将请求代理给grafana。
# The public facing domain name used to access grafana from a browser
;domain = localhost
# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
;enforce_domain = false
# The full public facing url you use in browser, used for redirects and emails
# If you use reverse proxy and sub path specify full url (with sub path)
;root_url = http://localhost:3000
# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
;serve_from_sub_path = false
# Log web requests
;router_logging = false
# the path relative working path
;static_root_path = public
# enable gzip
;enable_gzip = false
# https certs & key file
;cert_file =
;cert_key =
# Unix socket path
;socket =
Database配置段
#################################### Database #################################### [database] # You can configure the database connection by specifying type, host, name, user and password # as separate properties or as on string using the url properties. # Either "mysql", "postgres" or "sqlite3", it's your choice ;type = sqlite3 # 默认使用sqlite3作为grafana数据存储 ;host = 127.0.0.1:3306 ;name = grafana ;user = root # If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" ;password = #如果密码包含#或;需要使用三引号括起来如"""#password;"""
# Use either URL or the previous fields to configure the database # Example: mysql://user:secret@host:port/database ;url = # For "postgres" only, either "disable", "require" or "verify-full" ;ssl_mode = disable # For "sqlite3" only, path relative to data_path setting ;path = grafana.db # Max idle conn setting default is 2 ;max_idle_conn = 2 # Max conn setting default is 0 (mean not set) ;max_open_conn = # Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours) ;conn_max_lifetime = 14400 # Set to true to log the sql calls and execution times. ;log_queries = # For "sqlite3" only. cache mode setting used for connecting to the database. (private, shared) ;cache_mode = private
不积跬步,无以至千里;不积小流,无以成江海。