# Telegraf 主配置文件
# Nomad 集群硬盘监控配置

# 全局设置
[global_tags]
  nomad_cluster = "production"
  node_role = "{{ nomad_role | default('unknown') }}"
  hostname = "{{ inventory_hostname }}"

# Agent 配置
[agent]
  interval = "{{ collection_interval | default(30) }}s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "2s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  hostname = "{{ inventory_hostname }}"
  omit_hostname = false

# 输出配置 - InfluxDB 2.x
[[outputs.influxdb_v2]]
  urls = ["{{ influxdb_url }}"]
  token = "{{ influxdb_token }}"
  organization = "{{ influxdb_org | default('nomad') }}"
  bucket = "{{ influxdb_bucket | default('nomad_monitoring') }}"
  
  ## 连接配置
  timeout = "10s"
  max_retries = 3
  retry_timeout = "5s"
  
  ## 数据精度
  precision = "s"
  
  ## TLS 配置（如果需要）
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  # insecure_skip_verify = false

# 日志配置 - 禁用本地日志以节省硬盘空间
[log]
  ## 只输出错误日志到 syslog，不生成本地文件
  level = "ERROR"
  ## 禁用本地日志文件
  # file = "/var/log/telegraf/telegraf.log"
  ## 使用 syslog 替代本地文件
  logtarget = "syslog"
  ## 禁用日志轮转
  logrotate = false