目录
输入和输出集成概述
Docker 输入插件允许您使用 Docker Engine API 从 Docker 容器中收集指标,从而增强容器化应用程序的可见性和监控。
此插件允许使用 Metrics API 将指标发送到 New Relic Insights,从而实现对应用程序性能的有效监控和分析。
集成详情
Docker
Telegraf 的 Docker 输入插件从 Docker Engine API 收集有价值的指标,从而深入了解正在运行的容器。此插件利用官方 Docker 客户端与 Engine API 交互,允许用户监控各种容器状态、资源分配和性能指标。凭借按名称和状态过滤容器的选项,以及可自定义的标签,此插件支持在各种环境中灵活监控容器化应用程序,无论是在本地系统上还是在 Kubernetes 等编排平台内。此外,它通过要求访问 Docker 守护程序的权限来解决安全问题,并强调在容器化环境中部署时的正确配置。
New Relic
此插件使用 Metrics API 将指标写入 New Relic Insights,Metrics API 提供了一种将时间序列数据发送到 New Relic 平台的强大机制。用户必须首先获取 Insights API 密钥才能验证和授权其数据提交。该插件旨在促进与 New Relic 的监控和分析功能轻松集成,支持各种指标类型并允许高效的数据处理。核心功能包括为指标添加前缀以更好地识别、API 请求的可自定义超时以及对代理设置的支持以增强连接性。用户必须根据自己的要求配置这些选项,从而实现数据无缝流入 New Relic,以进行全面的实时分析和洞察。
配置
Docker
[[inputs.docker]]
## Docker Endpoint
## To use TCP, set endpoint = "tcp://[ip]:[port]"
## To use environment variables (ie, docker-machine), set endpoint = "ENV"
endpoint = "unix:///var/run/docker.sock"
## Set to true to collect Swarm metrics(desired_replicas, running_replicas)
## Note: configure this in one of the manager nodes in a Swarm cluster.
## configuring in multiple Swarm managers results in duplication of metrics.
gather_services = false
## Only collect metrics for these containers. Values will be appended to
## container_name_include.
## Deprecated (1.4.0), use container_name_include
container_names = []
## Set the source tag for the metrics to the container ID hostname, eg first 12 chars
source_tag = false
## Containers to include and exclude. Collect all if empty. Globs accepted.
container_name_include = []
container_name_exclude = []
## Container states to include and exclude. Globs accepted.
## When empty only containers in the "running" state will be captured.
# container_state_include = []
# container_state_exclude = []
## Objects to include for disk usage query
## Allowed values are "container", "image", "volume"
## When empty disk usage is excluded
storage_objects = []
## Timeout for docker list, info, and stats commands
timeout = "5s"
## Whether to report for each container per-device blkio (8:0, 8:1...),
## network (eth0, eth1, ...) and cpu (cpu0, cpu1, ...) stats or not.
## Usage of this setting is discouraged since it will be deprecated in favor of 'perdevice_include'.
## Default value is 'true' for backwards compatibility, please set it to 'false' so that 'perdevice_include' setting
## is honored.
perdevice = true
## Specifies for which classes a per-device metric should be issued
## Possible values are 'cpu' (cpu0, cpu1, ...), 'blkio' (8:0, 8:1, ...) and 'network' (eth0, eth1, ...)
## Please note that this setting has no effect if 'perdevice' is set to 'true'
# perdevice_include = ["cpu"]
## Whether to report for each container total blkio and network stats or not.
## Usage of this setting is discouraged since it will be deprecated in favor of 'total_include'.
## Default value is 'false' for backwards compatibility, please set it to 'true' so that 'total_include' setting
## is honored.
total = false
## Specifies for which classes a total metric should be issued. Total is an aggregated of the 'perdevice' values.
## Possible values are 'cpu', 'blkio' and 'network'
## Total 'cpu' is reported directly by Docker daemon, and 'network' and 'blkio' totals are aggregated by this plugin.
## Please note that this setting has no effect if 'total' is set to 'false'
# total_include = ["cpu", "blkio", "network"]
## docker labels to include and exclude as tags. Globs accepted.
## Note that an empty array for both will include all labels as tags
docker_label_include = []
docker_label_exclude = []
## Which environment variables should we use as a tag
tag_env = ["JAVA_HOME", "HEAP_SIZE"]
## 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
New Relic
[[outputs.newrelic]]
## The 'insights_key' parameter requires a NR license key.
## New Relic recommends you create one
## with a convenient name such as TELEGRAF_INSERT_KEY.
## reference: https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#ingest-license-key
# insights_key = "New Relic License Key Here"
## Prefix to add to add to metric name for easy identification.
## This is very useful if your metric names are ambiguous.
# metric_prefix = ""
## Timeout for writes to the New Relic API.
# timeout = "15s"
## HTTP Proxy override. If unset use values from the standard
## proxy environment variables to determine proxy, if any.
# http_proxy = "http://corporate.proxy:3128"
## Metric URL override to enable geographic location endpoints.
# If not set use values from the standard
# metric_url = "https://metric-api.newrelic.com/metric/v1"
输入和输出集成示例
Docker
-
监控容器化应用程序的性能:使用 Docker 输入插件来跟踪在 Docker 容器中运行的应用程序的 CPU、内存、磁盘 I/O 和网络活动。通过收集这些指标,DevOps 团队可以主动管理资源分配、排除性能瓶颈并确保跨不同环境的最佳应用程序性能。
-
与 Kubernetes 集成:利用此插件从 Kubernetes 编排的 Docker 容器中收集指标。通过过滤掉不必要的 Kubernetes 标签并专注于关键指标,团队可以简化其监控解决方案并创建仪表板,从而深入了解 Kubernetes 集群中运行的微服务的整体健康状况。
-
容量规划和资源优化:使用 Docker 输入插件收集的指标来执行 Docker 部署的容量规划。分析使用模式有助于识别未充分利用的资源和过度配置的容器,从而根据实际使用趋势指导扩展或缩减的决策。
-
容器异常的自动警报:根据通过 Docker 插件收集的指标设置警报规则,以通知团队资源使用或服务中断的异常峰值。这种主动监控方法有助于维护服务可靠性并优化容器化应用程序的性能。
New Relic
-
应用程序性能监控:使用 New Relic Telegraf 插件将 Web 服务的应用程序性能指标发送到 New Relic Insights。通过集成此插件,开发人员可以收集响应时间、错误率和吞吐量等数据,使团队能够实时监控应用程序健康状况并在问题影响用户之前快速解决。此设置有助于主动管理应用程序性能和用户体验。
-
基础设施指标聚合:利用此插件聚合和发送来自各种服务器的系统级指标(CPU 使用率、内存消耗等)到 New Relic。这有助于系统管理员保持对基础设施性能的全面了解,从而促进容量规划和识别潜在瓶颈。通过在 New Relic 中集中指标,团队可以可视化随时间变化的趋势,并就资源分配做出明智的决策。
-
多租户应用程序的动态指标命名:使用 metric_prefix 选项实现动态前缀,以区分多租户应用程序中的不同租户。通过配置插件以在指标名称中包含每个租户的唯一标识符,团队可以分析每个租户的使用模式和性能指标。这提供了对租户行为的宝贵见解,支持定制优化并提高不同客户群的服务质量。
-
实时异常检测:将 New Relic 插件与警报机制结合使用,以根据异常指标模式触发通知。通过发送请求计数和响应时间等指标,团队可以在 New Relic 中设置阈值,当阈值被突破时,将自动提醒责任方。这种用户驱动的方法支持对潜在问题做出立即响应,防止问题升级为更大的事件。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提出意见。请在 InfluxDB 社区 Slack 中提交您的反馈。