目录
输入和输出集成概述
此插件将从 Amazon CloudWatch 中拉取指标统计信息,从而简化监控和分析 AWS 资源的过程。
此输出插件提供了一种可靠而高效的机制,用于将 Telegraf 收集的指标直接路由到 TimescaleDB 中。通过利用 PostgreSQL 的强大生态系统以及 TimescaleDB 的时序优化,它支持高性能数据摄取和高级查询功能。
集成详情
Amazon CloudWatch
Amazon CloudWatch 插件允许用户从 Amazon 的 CloudWatch 服务中拉取详细的指标统计信息。作为一种监控解决方案,CloudWatch 使用户能够跟踪与 AWS 资源和应用程序相关的各种指标,从而改进运营和性能洞察。该插件使用结构化的身份验证方法,通过结合 STS(安全令牌服务)、共享凭证、环境变量和 EC2 实例配置文件来优先考虑安全性和灵活性,从而确保对 AWS 资源的强大访问控制。主要功能包括定义特定指标命名空间、指标聚合周期以及可选地包含链接帐户以进行跨帐户监控的功能。此插件的一个重要方面是它能够处理稀疏和密集指标格式,从而允许根据用户偏好使用不同的输出结构。因此,它通过直接从 CloudWatch 提供全面、及时的数据,支持云监控和分析中的多种用例。
TimescaleDB
TimescaleDB 是一个开源时序数据库,作为 PostgreSQL 的扩展而构建,旨在高效处理大规模、面向时间的数据。TimescaleDB 于 2017 年推出,是为了响应对强大、可扩展解决方案的需求日益增长而出现的,该解决方案可以管理海量数据,同时保持高插入率和复杂查询。通过利用 PostgreSQL 熟悉的 SQL 接口并通过专门的时序功能对其进行增强,TimescaleDB 迅速在希望将时序功能集成到现有关系数据库中的开发人员中流行起来。它的混合方法使用户可以受益于 PostgreSQL 的灵活性、可靠性和生态系统,同时为时序数据提供优化的性能。
该数据库在需要快速摄取数据点并结合对历史时期进行复杂分析查询的环境中尤其有效。TimescaleDB 具有许多创新功能,例如将数据透明地分区为可管理块的超表和内置的连续聚合。这些功能可以显着提高查询速度和资源效率。
配置
Amazon CloudWatch
[[inputs.cloudwatch]]
region = "us-east-1"
# access_key = ""
# secret_key = ""
# token = ""
# role_arn = ""
# web_identity_token_file = ""
# role_session_name = ""
# profile = ""
# shared_credential_file = ""
# include_linked_accounts = false
# endpoint_url = ""
# use_system_proxy = false
# http_proxy_url = "http://localhost:8888"
period = "5m"
delay = "5m"
interval = "5m"
#recently_active = "PT3H"
# cache_ttl = "1h"
namespaces = ["AWS/ELB"]
# metric_format = "sparse"
# ratelimit = 25
# timeout = "5s"
# batch_size = 500
# statistic_include = ["average", "sum", "minimum", "maximum", sample_count]
# statistic_exclude = []
# [[inputs.cloudwatch.metrics]]
# names = ["Latency", "RequestCount"]
# [[inputs.cloudwatch.metrics.dimensions]]
# name = "LoadBalancerName"
# value = "p-example"
TimescaleDB
# Publishes metrics to a TimescaleDB database
[[outputs.postgresql]]
## Specify connection address via the standard libpq connection string:
## host=... user=... password=... sslmode=... dbname=...
## Or a URL:
## postgres://[user[:password]]@localhost[/dbname]?sslmode=[disable|verify-ca|verify-full]
## See https://postgresql.ac.cn/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
##
## All connection parameters are optional. Environment vars are also supported.
## e.g. PGPASSWORD, PGHOST, PGUSER, PGDATABASE
## All supported vars can be found here:
## https://postgresql.ac.cn/docs/current/libpq-envars.html
##
## Non-standard parameters:
## pool_max_conns (default: 1) - Maximum size of connection pool for parallel (per-batch per-table) inserts.
## pool_min_conns (default: 0) - Minimum size of connection pool.
## pool_max_conn_lifetime (default: 0s) - Maximum connection age before closing.
## pool_max_conn_idle_time (default: 0s) - Maximum idle time of a connection before closing.
## pool_health_check_period (default: 0s) - Duration between health checks on idle connections.
# connection = ""
## Postgres schema to use.
# schema = "public"
## Store tags as foreign keys in the metrics table. Default is false.
# tags_as_foreign_keys = false
## Suffix to append to table name (measurement name) for the foreign tag table.
# tag_table_suffix = "_tag"
## Deny inserting metrics if the foreign tag can't be inserted.
# foreign_tag_constraint = false
## Store all tags as a JSONB object in a single 'tags' column.
# tags_as_jsonb = false
## Store all fields as a JSONB object in a single 'fields' column.
# fields_as_jsonb = false
## Name of the timestamp column
## NOTE: Some tools (e.g. Grafana) require the default name so be careful!
# timestamp_column_name = "time"
## Type of the timestamp column
## Currently, "timestamp without time zone" and "timestamp with time zone"
## are supported
# timestamp_column_type = "timestamp without time zone"
## Templated statements to execute when creating a new table.
# create_templates = [
# '''CREATE TABLE {{ .table }} ({{ .columns }})''',
# ]
## Templated statements to execute when adding columns to a table.
## Set to an empty list to disable. Points containing tags for which there is
## no column will be skipped. Points containing fields for which there is no
## column will have the field omitted.
# add_column_templates = [
# '''ALTER TABLE {{ .table }} ADD COLUMN IF NOT EXISTS {{ .columns|join ", ADD COLUMN IF NOT EXISTS " }}''',
# ]
## Templated statements to execute when creating a new tag table.
# tag_table_create_templates = [
# '''CREATE TABLE {{ .table }} ({{ .columns }}, PRIMARY KEY (tag_id))''',
# ]
## Templated statements to execute when adding columns to a tag table.
## Set to an empty list to disable. Points containing tags for which there is
## no column will be skipped.
# tag_table_add_column_templates = [
# '''ALTER TABLE {{ .table }} ADD COLUMN IF NOT EXISTS {{ .columns|join ", ADD COLUMN IF NOT EXISTS " }}''',
# ]
## The postgres data type to use for storing unsigned 64-bit integer values
## (Postgres does not have a native unsigned 64-bit integer type).
## The value can be one of:
## numeric - Uses the PostgreSQL "numeric" data type.
## uint8 - Requires pguint extension (https://github.com/petere/pguint)
# uint64_type = "numeric"
## When using pool_max_conns > 1, and a temporary error occurs, the query is
## retried with an incremental backoff. This controls the maximum duration.
# retry_max_backoff = "15s"
## Approximate number of tag IDs to store in in-memory cache (when using
## tags_as_foreign_keys). This is an optimization to skip inserting known
## tag IDs. Each entry consumes approximately 34 bytes of memory.
# tag_cache_size = 100000
## Cut column names at the given length to not exceed PostgreSQL's
## 'identifier length' limit (default: no limit)
## (see https://postgresql.ac.cn/docs/current/limits.html)
## Be careful to not create duplicate column names!
# column_name_length_limit = 0
## Enable & set the log level for the Postgres driver.
# log_level = "warn" # trace, debug, info, warn, error, none
输入和输出集成示例
Amazon CloudWatch
-
跨账户监控:通过启用
include_linked_accounts
选项,利用此插件监控跨多个 AWS 账户的资源。这种情况允许管理多个 AWS 账户的公司将指标聚合到中央监控仪表板中,从而提供所有指标的统一视图,同时通过适当的角色管理确保安全的数据访问和合规性。 -
动态警报系统:将此插件与警报工具集成,以创建一个自动化系统,该系统根据 CloudWatch 指标的已定义阈值触发警报。例如,如果延迟指标超过指定限制,则可以将警报发送给相关团队,从而能够主动响应性能问题并减少停机时间。
-
成本管理仪表板:使用从插件收集的指标来构建成本管理仪表板,该仪表板可视化 AWS 服务随时间推移的使用情况指标。通过将这些指标与计费数据相关联,组织可以识别高成本服务,并采取明智的措施来优化其资源使用和支出。
-
应用程序的性能基准测试:利用从 AWS 上运行的应用程序收集的指标来执行性能基准测试。例如,通过跟踪 ELB 的延迟和请求计数指标,开发人员可以评估应用程序更改对其性能的影响,从而为优化做出数据驱动的决策。
TimescaleDB
-
实时 IoT 数据摄取:使用此插件实时收集和存储来自数千个 IoT 设备的传感器数据。此设置有助于立即分析,帮助组织监控运营效率并快速响应不断变化的条件。
-
云应用程序性能监控:利用此插件将分布式云应用程序的详细性能指标馈送到 TimescaleDB 中。此集成支持实时仪表板和警报,使团队能够快速识别和缓解性能瓶颈。
-
历史数据分析和报告:实施一个系统,将长期指标存储在 TimescaleDB 中以进行全面的历史分析。这种方法允许企业执行趋势分析、生成详细报告并根据存档的时序数据做出数据驱动的决策。
-
自适应警报和异常检测:将此插件与自动化异常检测工作流程集成。通过将指标持续流式传输到 TimescaleDB,机器学习模型可以分析数据模式并在发生异常时触发警报,从而提高系统可靠性和主动维护。
反馈
感谢您成为我们社区的一份子!如果您有任何一般性反馈或在这些页面上发现任何错误,我们欢迎并鼓励您提供意见。请在 InfluxDB 社区 Slack 中提交您的反馈。