Grafana 配置文件详解

Grafana 配置文件详解

#################### Grafana Configuration Example ####################### Everything has defaults so you only need to uncomment things you want to# change

# possible values : production, development;app_mode = production

# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty;instance_name = ${HOSTNAME}

# force migration will run migrations that might cause dataloss;force_migration = false

#################################### Paths ####################################[paths]# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)# 所有临时存放的生成文件都在这个目录里(csv,png,storage )data = /var/lib/grafana

# Temporary files in `data` directory older than given duration will be removed# 临时文件存储时间,超过时间将被删除 ;temp_data_lifetime = 24h

# Directory where grafana can store logs# 日志存放的目录logs = /var/log/grafana

# Directory where grafana will automatically scan and look for plugins# 插件监视目录;plugins = /var/lib/grafana/plugins

# folder that contains provisioning config files that grafana will apply on startup and while running.# 启动和运行时加载的文件夹;provisioning = conf/provisioning#################################### Server ####################################[server]# Protocol (http, https, h2, socket)# grafana对外开放时使用的协议(建议使用http)protocol = http

# The ip address to bind to, empty will bind to all interfaces# 绑定的IP地址,没有特出的不要动;http_addr =

# The http port to use# http服务的端口号http_port = 3000

# The public facing domain name used to access grafana from a browser# 从浏览器里访问时的domaindomain = localhost

# Redirect to correct domain if host header does not match domain# Prevents DNS rebinding attacks# 强制dns绑定(还不知道怎么用)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 = %(protocol)s://%(domain)s:%(http_port)s/

# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.# 从子路径访问的请求是否有效,和上面的一起配置serve_from_sub_path = true

# Log web requests# 是否记录网络请求router_logging = false

# the path relative working path# 相对路径static_root_path = public

# enable gzip# 是否启用压缩传输(如果客户的网络不好或要求高速显示,这个应该打开);enable_gzip = false

# https certs & key file# https的证书和key;cert_file =;cert_key =

# Unix socket path# unix套接字;socket =

# CDN Url# CDN 加速的地址(所有的静态文件)cdn_url = http://192.168.1.122:1341

# Sets the maximum time using a duration format (5s/5m/5ms) before timing out read of an incoming request and closing idle connections.# `0` means there is no timeout for reading the request.# http超时自动断开(0 表示没有超时);read_timeout = 0

#################################### 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.# 可以通过指定类型、主机、名称、用户和密码来配置数据库连接# 作为单独的属性或使用 url 属性作为字符串。# Either "mysql", "postgres" or "sqlite3", it's your choicetype =mysqlhost = 192.168.1.122:3306name = grafanauser = omniq# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""# 如果密码中包含 # 或 ;你必须用三引号括起来。例如 """#password;"""password =radcom

# Use either URL or the previous fields to configure the database# Example: mysql://user:secret@host:port/database# 使用 URL 或前面的字段来配置数据库;url =mysql://user:omniq@192.168.1.122:3306/grafana

# For "postgres" only, either "disable", "require" or "verify-full"# 仅适用于“postgres”,“disable”、“require”或“verify-full”;ssl_mode = disable

# Database drivers may support different transaction isolation levels.# Currently, only "mysql" driver supports isolation levels.# If the value is empty - driver's default isolation level is applied.# 数据库驱动程序可能支持不同的事务隔离级别。# 目前,只有“mysql”驱动支持隔离级别。# 如果值为空 - 应用驱动程序的默认隔离级别。# For "mysql" use "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ" or "SERIALIZABLE".;isolation_level =

;ca_cert_path =;client_key_path =;client_cert_path =;server_cert_name =

# For "sqlite3" only, path relative to data_path setting# 仅适用于“sqlite3”,相对于 data_path 设置的路径;path = grafana.db

# Max idle conn setting default is 2# Max idle conn 设置默认为 2;max_idle_conn = 2

# Max conn setting default is 0 (mean not set)# max conn 设置默认为0(表示未设置);max_open_conn =

# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours)# Connection Max Lifetime 默认为 14400(表示 14400 秒或 4 小时);conn_max_lifetime = 14400

# Set to true to log the sql calls and execution times.# 设置为 true 以记录 sql 调用和执行时间。;log_queries =

# For "sqlite3" only. cache mode setting used for connecting to the database. (private, shared)# 仅适用于“sqlite3”。用于连接数据库的缓存模式设置。 (私人,共享);cache_mode = private

# For "mysql" only if lockingMigration feature toggle is set. How many seconds to wait before failing to lock the database for the migrations, default is 0.# 仅当设置了lockingMigration 功能切换时才适用于“mysql”。在为迁移锁定数据库失败之前等待多少秒,默认为 0。;locking_attempt_timeout_sec = 0################################### Data sources #########################[datasources]# Upper limit of data sources that Grafana will return. This limit is a temporary configuration and it will be deprecated when pagination will be introduced on the list data# Grafana 将返回的数据源的上限。 此限制是临时配置,当在列表数据上引入分页时将弃用;datasource_limit = 5000#################################### Cache server ############################## 使用catch加速的部分[remote_cache]# Either "redis", "memcached" or "database" default is "database";type = database

# cache connectionstring options# database: will use Grafana primary database.# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'.# memcache: 127.0.0.1:11211

# "redis", "memcached" 或 "database" 默认是 "database";type = database

# 缓存连接字符串选项# database: 将使用 Grafana 主数据库。# redis: 像 redis 服务器一样配置,例如 `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`。 只有 addr 是必需的。 ssl 可能是“真”、“假”或“不安全”。;connstr =#################################### Data proxy ###########################[dataproxy]

# This enables data proxy logging, default is false# 这会启用数据代理日志记录,默认为 false;logging = false

# How long the data proxy waits to read the headers of the response before timing out, default is 30 seconds.# This setting also applies to core backend HTTP data sources where query requests use an HTTP client with timeout set.# 数据代理在超时前等待读取响应头的时间,默认为 30 秒。# 此设置也适用于核心后端 HTTP 数据源,其中查询请求使用设置了超时的 HTTP 客户端。;timeout = 30

# How long the data proxy waits to establish a TCP connection before timing out, default is 10 seconds.# 数据代理在超时前等待建立 TCP 连接的时间,默认为 10 秒。;dialTimeout = 10

# How many seconds the data proxy waits before sending a keepalive probe request.# 数据代理在发送keepalive探测请求之前等待的秒数。;keep_alive_seconds = 30

# How many seconds the data proxy waits for a successful TLS Handshake before timing out.# 数据代理在超时之前等待成功的 TLS 握手的秒数。;tls_handshake_timeout_seconds = 10

# How many seconds the data proxy will wait for a server's first response headers after# fully writing the request headers if the request has an "Expect: 100-continue"# header. A value of 0 will result in the body being sent immediately, without# waiting for the server to approve.# 数据代理将在多少秒后等待服务器的第一个响应标头# 如果请求具有“期望:100-继续”,则完全写入请求标头# 标题。值为 0 将导致立即发送正文,没有# 等待服务器批准。;expect_continue_timeout_seconds = 1

# Optionally limits the total number of connections per host, including connections in the dialing,# active, and idle states. On limit violation, dials will block.# A value of zero (0) means no limit.# 可选地限制每台主机的连接总数,包括拨号连接,# 活动和空闲状态。违反限制时,拨号将阻塞。# 值为零 (0) 表示没有限制。;max_conns_per_host = 0

# The maximum number of idle connections that Grafana will keep alive.# Grafana 将保持活动的最大空闲连接数。;max_idle_connections = 100

# How many seconds the data proxy keeps an idle connection open before timing out.;idle_conn_timeout_seconds = 90

# If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false.# 如果启用且用户不是匿名的,数据代理将在请求中添加带有用户名的 X-Grafana-User 标头,默认为 false。;send_user_header = false

# Limit the amount of bytes that will be read/accepted from responses of outgoing HTTP requests.# 限制从传出 HTTP 请求的响应中读取/接受的字节数。;response_limit = 0

# Limits the number of rows that Grafana will process from SQL data sources.# 限制 Grafana 将从 SQL 数据源处理的行数。;row_limit = 1000000#################################### Analytics ####################################[analytics]# Server reporting, sends usage counters to stats.grafana.org every 24 hours.# No ip addresses are being tracked, only simple counters to track# running instances, dashboard and error counts. It is very helpful to us.# Change this option to false to disable reporting.# 服务器报告,每 24 小时向 stats.grafana.org 发送使用计数器。# 不跟踪 IP 地址,只跟踪简单的计数器# 运行实例、仪表板和错误计数。这对我们很有帮助。# 将此选项更改为 false 以禁用报告。;reporting_enabled = true

# The name of the distributor of the Grafana instance. Ex hosted-grafana, grafana-labs# Grafana 实例的分发服务器名称。前托管-grafana,grafana-labs;reporting_distributor = grafana-labs

# Set to false to disable all checks to https://grafana.com# for new versions of grafana. The check is used# in some UI views to notify that a grafana update exists.# This option does not cause any auto updates, nor send any information# only a GET request to https://raw.githubusercontent.com/grafana/grafana/main/latest.json to get the latest version.# 设置为 false 以禁用对 https://grafana.com 的所有检查# 用于新版本的 grafana。支票被使用# 在某些 UI 视图中通知存在 grafana 更新。# 此选项不会导致任何自动更新,也不会发送任何信息# 仅向 https://raw.githubusercontent.com/grafana/grafana/main/latest.json 发出 GET 请求以获取最新版本。;check_for_updates = true

# Set to false to disable all checks to https://grafana.com# for new versions of plugins. The check is used# in some UI views to notify that a plugin update exists.# This option does not cause any auto updates, nor send any information# only a GET request to https://grafana.com to get the latest versions.# 设置为 false 以禁用对 https://grafana.com 的所有检查# 用于新版本的插件。支票被使用# 在一些 UI 视图中通知插件更新存在。# 此选项不会导致任何自动更新,也不会发送任何信息# 仅向 https://grafana.com 发出 GET 请求以获取最新版本。;check_for_plugin_updates = true

# Google Analytics universal tracking code, only enabled if you specify an id here# Google Analytics 通用跟踪代码,仅在您在此处指定 id 时启用;google_analytics_ua_id =

# Google Tag Manager ID, only enabled if you specify an id here# Google Tag Manager ID,仅在您在此处指定 id 时启用;google_tag_manager_id =

# Rudderstack write key, enabled only if rudderstack_data_plane_url is also set

;rudderstack_write_key =

# Rudderstack data plane url, enabled only if rudderstack_write_key is also set# Rudderstack 写入密钥,仅当 rudderstack_data_plane_url 也设置时才启用;rudderstack_data_plane_url =

# Rudderstack SDK url, optional, only valid if rudderstack_write_key and rudderstack_data_plane_url is also set# Rudderstack SDK url,可选,仅在同时设置了 rudderstack_write_key 和 rudderstack_data_plane_url 时有效;rudderstack_sdk_url =

# Rudderstack Config url, optional, used by Rudderstack SDK to fetch source config# Rudderstack Config url,可选,由 Rudderstack SDK 用于获取源配置;rudderstack_config_url =

# Controls if the UI contains any links to user feedback forms# 控制 UI 是否包含任何指向用户反馈表单的链接;feedback_links_enabled = true#################################### Security ####################################[security]# disable creation of admin user on first start of grafana# 禁止在 grafana 首次启动时创建管理员用户;disable_initial_admin_creation = false

# default admin user, created on startup# 默认管理员用户,在启动时创建;admin_user = admin

# default admin password, can be changed before first start of grafana, or in profile settings# 默认管理员密码,可以在首次启动 grafana 之前更改,也可以在配置文件设置中更改;admin_password = admin

# used for signing# 用于签名;secret_key = SW2YcwTIb9zpOOhoPsMm

# current key provider used for envelope encryption, default to static value specified by secret_key# 当前用于信封加密的密钥提供程序,默认为 secret_key 指定的静态值;encryption_provider = secretKey.v1

# list of configured key providers, space separated (Enterprise only): e.g., awskms.v1 azurekv.v1# 配置的密钥提供者列表,空格分隔(仅限企业版):例如,awskms.v1 azurekv.v1;available_encryption_providers =

# disable gravatar profile images# 禁用 gravatar 头像;disable_gravatar = false

# data source proxy whitelist (ip_or_domain:port separated by spaces)# 数据源代理白名单(ip_or_domain:port,以空格分隔);data_source_proxy_whitelist =

# disable protection against brute force login attempts# 禁用对暴力登录尝试的保护;disable_brute_force_login_protection = false

# set to true if you host Grafana behind HTTPS. default is false.# 如果你在 HTTPS 后面托管 Grafana,则设置为 true。默认为假。;cookie_secure = false

# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled"# 设置 cookie SameSite 属性。;cookie_samesite = lax

# set to true if you want to allow browsers to render Grafana in a ,