目录
输入和输出集成概述
此插件与 Apache HTTP 服务器的 mod_status 接口连接,以收集和报告服务器的性能指标。
InfluxDB 插件将指标写入 InfluxDB HTTP 服务,从而可以高效地存储和检索时序数据。
集成详情
Apache
Apache 插件使用 Apache HTTP 服务器的 mod_status 模块收集服务器性能信息。它依赖于 mod_status 功能,该功能必须在 Apache 配置中显式启用才能访问机器可读的状态页面。此插件允许用户获取多个与 Apache 运行性能相关的指标,包括工作进程状态、连接统计信息和服务器负载,从而有助于实时有效地监控和排除 Web 服务器性能故障。
InfluxDB
InfluxDB Telegraf 插件用于将指标发送到 InfluxDB HTTP API,从而方便以结构化方式存储和查询时序数据。此插件与 InfluxDB 无缝集成,提供基本功能,例如基于令牌的身份验证和对多个 InfluxDB 集群节点的支持,从而确保可靠且可扩展的数据摄取。通过其可配置性,用户可以指定组织、目标存储桶和 HTTP 特定设置等选项,从而灵活地定制数据的发送和存储方式。该插件还支持敏感数据的机密管理,从而增强了生产环境中的安全性。此插件在现代可观测性堆栈中尤其有利,在这些堆栈中,实时分析和时序数据存储至关重要。
配置
Apache
[[inputs.apache]]
## An array of URLs to gather from, must be directed at the machine
## readable version of the mod_status page including the auto query string.
## Default is "http://localhost/server-status?auto".
urls = ["http://localhost/server-status?auto"]
## Credentials for basic HTTP authentication.
# username = "myuser"
# password = "mypassword"
## Maximum time to receive response.
# 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
InfluxDB
[[outputs.influxdb]]
## The full HTTP or UDP URL for your InfluxDB instance.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
# urls = ["unix:///var/run/influxdb.sock"]
# urls = ["udp://127.0.0.1:8089"]
# urls = ["http://127.0.0.1:8086"]
## Local address to bind when connecting to the server
## If empty or not set, the local address is automatically chosen.
# local_address = ""
## The target database for metrics; will be created as needed.
## For UDP url endpoint database needs to be configured on server side.
# database = "telegraf"
## The value of this tag will be used to determine the database. If this
## tag is not set the 'database' option is used as the default.
# database_tag = ""
## If true, the 'database_tag' will not be included in the written metric.
# exclude_database_tag = false
## If true, no CREATE DATABASE queries will be sent. Set to true when using
## Telegraf with a user without permissions to create databases or when the
## database already exists.
# skip_database_creation = false
## Name of existing retention policy to write to. Empty string writes to
## the default retention policy. Only takes effect when using HTTP.
# retention_policy = ""
## The value of this tag will be used to determine the retention policy. If this
## tag is not set the 'retention_policy' option is used as the default.
# retention_policy_tag = ""
## If true, the 'retention_policy_tag' will not be included in the written metric.
# exclude_retention_policy_tag = false
## Write consistency (clusters only), can be: "any", "one", "quorum", "all".
## Only takes effect when using HTTP.
# write_consistency = "any"
## Timeout for HTTP messages.
# timeout = "5s"
## HTTP Basic Auth
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"
## HTTP User-Agent
# user_agent = "telegraf"
## UDP payload size is the maximum packet size to send.
# udp_payload = "512B"
## Optional TLS Config for use on HTTP connections.
# 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
## HTTP Proxy override, if unset values the standard proxy environment
## variables are consulted to determine which proxy, if any, should be used.
# http_proxy = "http://corporate.proxy:3128"
## Additional HTTP headers
# http_headers = {"X-Special-Header" = "Special-Value"}
## HTTP Content-Encoding for write request body, can be set to "gzip" to
## compress body or "identity" to apply no encoding.
# content_encoding = "gzip"
## When true, Telegraf will output unsigned integers as unsigned values,
## i.e.: "42u". You will need a version of InfluxDB supporting unsigned
## integer values. Enabling this option will result in field type errors if
## existing data has been written.
# influx_uint_support = false
## When true, Telegraf will omit the timestamp on data to allow InfluxDB
## to set the timestamp of the data during ingestion. This is generally NOT
## what you want as it can lead to data points captured at different times
## getting omitted due to similar data.
# influx_omit_timestamp = false
输入和输出集成示例
Apache
-
实时性能监控:使用 Apache 输入插件设置实时仪表板,显示 Apache 服务器的关键性能指标。通过可视化 BusyWorkers 和平均负载等指标,您可以快速识别性能瓶颈和服务器运行状况问题,从而帮助主动管理 Web 流量负载。
-
服务器问题自动警报:实施基于此插件收集的指标的警报,以便在性能下降时通知管理员。例如,如果
BusyWorkers
指标超过特定阈值,则可以触发自动警报,确保及时响应事件以维护正常运行时间和服务的可靠性。 -
历史性能分析:将 Apache 插件收集的数据与长期存储解决方案相结合,以跟踪一段时间内的性能趋势。这种累积的数据有助于了解使用模式、预测资源需求以及做出有关服务器扩展或优化的明智决策。
-
跨系统监控:使用 Telegraf 的功能将从 Apache 收集的指标与 Web 堆栈其他组件的指标集成,以将数据发送到集中式监控解决方案。这种整体视图可以简化不同技术之间的故障排除和协调,从而确保整个系统的最佳性能。
InfluxDB
-
实时系统监控:利用 InfluxDB 插件捕获和存储来自各种系统组件的指标,例如 CPU 使用率、内存消耗和磁盘 I/O。通过将这些指标推送到 InfluxDB 中,您可以创建一个实时仪表板,可视化实时系统性能。此设置不仅有助于识别性能瓶颈,还可以通过分析一段时间内的趋势来协助主动容量规划。
-
Web 应用程序的性能跟踪:自动收集和推送与 Web 应用程序性能相关的指标(例如请求持续时间、错误率和用户交互)到 InfluxDB。通过在监控堆栈中使用此插件,您可以使用存储的指标生成报告和分析,以帮助了解用户行为和应用程序效率,从而指导开发和优化工作。
-
物联网数据聚合:利用 InfluxDB Telegraf 插件从各种物联网设备收集传感器数据,并将其存储在集中式 InfluxDB 实例中。此用例使您能够分析一段时间内环境或机器数据的趋势和模式,从而促进更明智的决策和预测性维护策略。通过将物联网数据集成到 InfluxDB 中,组织可以利用历史数据分析的力量来推动创新和运营效率。
-
分析历史指标以进行预测:设置 InfluxDB 插件以将历史指标数据发送到 InfluxDB,并使用它来驱动预测模型。通过分析过去的性能指标,您可以创建预测未来趋势和需求的预测模型。此应用程序对于商业智能目的特别有用,可帮助组织根据历史使用模式为资源需求的波动做好准备。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。