文档文档

Nginx 虚拟主机流量输入插件

此插件使用 外部虚拟主机流量状态模块Nginx Web 服务器收集指标。该模块提供对虚拟主机状态信息的访问,其中包含服务器、上游和缓存的当前状态,类似于 Nginx Plus 的实时活动监控。有关模块配置的详细信息,请参阅模块文档

引入于: Telegraf v1.9.0 标签: server, web 操作系统支持: all

全局配置选项

插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md

配置

# Read Nginx virtual host traffic status module information (nginx-module-vts)
[[inputs.nginx_vts]]
  ## An array of ngx_http_status_module or status URI to gather stats.
  urls = ["https:///status", "http+unix:///var/run/nginx.sock:/status"]

  ## HTTP response timeout (default: 5s)
  response_timeout = "5s"

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

Metrics

  • nginx_vts_connections
    • active
    • reading
    • writing
    • waiting
    • accepted
    • handled
    • requests
  • nginx_vts_server, nginx_vts_filter
    • requests
    • request_time
    • in_bytes
    • out_bytes
    • response_1xx_count
    • response_2xx_count
    • response_3xx_count
    • response_4xx_count
    • response_5xx_count
    • cache_miss
    • cache_bypass
    • cache_expired
    • cache_stale
    • cache_updating
    • cache_revalidated
    • cache_hit
    • cache_scarce
  • nginx_vts_upstream
    • requests
    • request_time
    • response_time
    • in_bytes
    • out_bytes
    • response_1xx_count
    • response_2xx_count
    • response_3xx_count
    • response_4xx_count
    • response_5xx_count
    • weight
    • max_fails
    • fail_timeout
    • backup
    • down
  • nginx_vts_cache
    • max_bytes
    • used_bytes
    • in_bytes
    • out_bytes
    • miss
    • bypass
    • expired
    • stale
    • updating
    • revalidated
    • hit
    • scarce

标签

  • nginx_vts_connections
    • source
    • port
  • nginx_vts_server
    • source
    • port
    • zone
  • nginx_vts_filter
    • source
    • port
    • filter_name
    • filter_key
  • nginx_vts_upstream
    • source
    • port
    • upstream
    • upstream_address
  • nginx_vts_cache
    • source
    • port
    • zone

示例输出

使用此配置

[[inputs.nginx_vts]]
  ## An array of Nginx status URIs to gather stats.
  urls = ["https:///status"]

运行时

./telegraf -config telegraf.conf -input-filter nginx_vts -test

它会生成

nginx_vts_connections,source=localhost,port=80,host=localhost waiting=30i,accepted=295333i,handled=295333i,requests=6833487i,active=33i,reading=0i,writing=3i 1518341521000000000
nginx_vts_server,zone=example.com,port=80,host=localhost,source=localhost cache_hit=158915i,in_bytes=1935528964i,out_bytes=6531366419i,response_2xx_count=809994i,response_4xx_count=16664i,cache_bypass=0i,cache_stale=0i,cache_revalidated=0i,requests=2187977i,response_1xx_count=0i,response_3xx_count=1360390i,cache_miss=2249i,cache_updating=0i,cache_scarce=0i,request_time=13i,response_5xx_count=929i,cache_expired=0i 1518341521000000000
nginx_vts_server,host=localhost,source=localhost,port=80,zone=* requests=6775284i,in_bytes=5003242389i,out_bytes=36858233827i,cache_expired=318881i,cache_updating=0i,request_time=51i,response_1xx_count=0i,response_2xx_count=4385916i,response_4xx_count=83680i,response_5xx_count=1186i,cache_bypass=0i,cache_revalidated=0i,cache_hit=1972222i,cache_scarce=0i,response_3xx_count=2304502i,cache_miss=408251i,cache_stale=0i 1518341521000000000
nginx_vts_filter,filter_key=FI,filter_name=country,port=80,host=localhost,source=localhost request_time=0i,in_bytes=139701i,response_3xx_count=0i,out_bytes=2644495i,response_1xx_count=0i,cache_expired=0i,cache_scarce=0i,requests=179i,cache_miss=0i,cache_bypass=0i,cache_stale=0i,cache_updating=0i,cache_revalidated=0i,cache_hit=0i,response_2xx_count=177i,response_4xx_count=2i,response_5xx_count=0i 1518341521000000000
nginx_vts_upstream,port=80,host=localhost,upstream=backend_cluster,upstream_address=127.0.0.1:6000,source=localhost fail_timeout=10i,backup=false,request_time=31i,response_5xx_count=1081i,response_2xx_count=1877498i,max_fails=1i,in_bytes=2763336289i,out_bytes=19470265071i,weight=1i,down=false,response_time=31i,response_1xx_count=0i,response_4xx_count=76125i,requests=3379232i,response_3xx_count=1424528i 1518341521000000000
nginx_vts_cache,source=localhost,port=80,host=localhost,zone=example stale=0i,used_bytes=64334336i,miss=394573i,bypass=0i,expired=318788i,updating=0i,revalidated=0i,hit=689883i,scarce=0i,max_bytes=9223372036854775296i,in_bytes=1111161581i,out_bytes=19175548290i 1518341521000000000

此页面是否有帮助?

感谢您的反馈!


InfluxDB 3.8 新特性

InfluxDB 3.8 和 InfluxDB 3 Explorer 1.6 的主要增强功能。

查看博客文章

InfluxDB 3.8 现已适用于 Core 和 Enterprise 版本,同时发布了 InfluxDB 3 Explorer UI 的 1.6 版本。本次发布着重于操作成熟度,以及如何更轻松地部署、管理和可靠地运行 InfluxDB。

更多信息,请查看

InfluxDB Docker 的 latest 标签将指向 InfluxDB 3 Core

在 **2026 年 2 月 3 日**,InfluxDB Docker 镜像的 latest 标签将指向 InfluxDB 3 Core。为避免意外升级,请在您的 Docker 部署中使用特定的版本标签。

如果使用 Docker 来安装和运行 InfluxDB,latest 标签将指向 InfluxDB 3 Core。为避免意外升级,请在您的 Docker 部署中使用特定的版本标签。例如,如果使用 Docker 运行 InfluxDB v2,请将 latest 版本标签替换为 Docker pull 命令中的特定版本标签 — 例如

docker pull influxdb:2