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 = falseMetrics
- 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此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。