Nginx Upstream Check 输入插件
此插件使用 上游检查模块从 Nginx Web 服务器收集指标。该模块定期向 Nginx 的上游服务器发送配置的请求,以确定它们的可用性。
引入于: Telegraf v1.10.0 标签: server, web 操作系统支持: all
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
# Read nginx_upstream_check module status information (https://github.com/yaoweibin/nginx_upstream_check_module)
[[inputs.nginx_upstream_check]]
## An URL where Nginx Upstream check module is enabled
## It should be set to return a JSON formatted response
url = "http://127.0.0.1/status?format=json"
## You can also point it at a unix socket too
# url = "http+unix:///var/run/nginx.sock:/status?format=json"
## HTTP method
# method = "GET"
## Optional HTTP headers
# headers = {"X-Special-Header" = "Special-Value"}
## Override HTTP "Host" header
# host_header = "check.example.com"
## Timeout for HTTP requests
timeout = "5s"
## Optional HTTP Basic Auth credentials
# username = "username"
# password = "pa$$word"
## 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
- Measurement
- fall (失败的服务器检查尝试次数,计数器)
- rise (成功的服务器检查尝试次数,计数器)
- status (报告服务器状态的字符串)
- status_code (服务器状态码。1 - up,2 - down,0 - other)
“status_code”字段最有可能最为有用,因为它允许您确定每台服务器的当前状态,并可能添加一些监控来监视它。InfluxDB 可以使用字符串值,“status”字段也可以替代使用,但对于大多数其他监控解决方案,整数代码将是合适的。
标签
- 所有测量值都有以下标签
- name (上游服务器的主机名或 IP)
- port (替代检查端口,如果使用默认端口则为 0)
- type (检查类型,http/tcp)
- upstream (Nginx 配置中 upstream 块的名称)
- url (telegraf 使用的状态 URL)
示例输出
运行时
./telegraf --config telegraf.conf --input-filter nginx_upstream_check --test它会生成
nginx_upstream_check,host=node1,name=192.168.0.1:8080,port=0,type=http,upstream=my_backends,url=http://127.0.0.1:80/status?format\=json fall=0i,rise=100i,status="up",status_code=1i 1529088524000000000
nginx_upstream_check,host=node2,name=192.168.0.2:8080,port=0,type=http,upstream=my_backends,url=http://127.0.0.1:80/status?format\=json fall=100i,rise=0i,status="down",status_code=2i 1529088524000000000此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。