[root@ec2 telegraf]# telegraf --version Telegraf unknown (git: master eb41218f) [root@ec2 telegraf]# cat telegraf.conf # Telegraf Configuration # # Telegraf is entirely plugin driven. All metrics are gathered from the # declared inputs, and sent to the declared outputs. # # Plugins must be declared in here to be active. # To deactivate a plugin, comment out the name and any variables. # # Use 'telegraf -config telegraf.conf -test' to see what metrics a config # file would generate. # # Environment variables can be used anywhere in this config file, simply surround # them with ${}. For strings the variable must be within quotes (ie, "${STR_VAR}"), # for numbers and booleans they should be plain (ie, ${INT_VAR}, ${BOOL_VAR}) # Configuration for telegraf agent [agent] ## Default data collection interval for all inputs interval = "10s" ## Rounds collection interval to 'interval' ## ie, if interval="10s" then always collect on :00, :10, :20, etc. round_interval = true ## Telegraf will send metrics to outputs in batches of at most ## metric_batch_size metrics. ## This controls the size of writes that Telegraf sends to output plugins. metric_batch_size = 1000 ## Maximum number of unwritten metrics per output. Increasing this value ## allows for longer periods of output downtime without dropping metrics at the ## cost of higher maximum memory usage. metric_buffer_limit = 10000 ## Collection jitter is used to jitter the collection by a random amount. ## Each plugin will sleep for a random time within jitter before collecting. ## This can be used to avoid many plugins querying things like sysfs at the ## same time, which can have a measurable effect on the system. collection_jitter = "0s" ## Default flushing interval for all outputs. Maximum flush_interval will be ## flush_interval + flush_jitter flush_interval = "10s" ## Jitter the flush interval by a random amount. This is primarily to avoid ## large write spikes for users running a large number of telegraf instances. ## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s flush_jitter = "0s" ## By default or when set to "0s", precision will be set to the same ## timestamp order as the collection interval, with the maximum being 1s. ## ie, when interval = "10s", precision will be "1s" ## when interval = "250ms", precision will be "1ms" ## Precision will NOT be used for service inputs. It is up to each individual ## service input to set the timestamp at the appropriate precision. ## Valid time units are "ns", "us" (or "µs"), "ms", "s". precision = "" ## Log at debug level. # debug = false ## Log only error level messages. # quiet = false ## Log target controls the destination for logs and can be one of "file", ## "stderr" or, on Windows, "eventlog". When set to "file", the output file ## is determined by the "logfile" setting. # logtarget = "file" ## Name of the file to be logged to when using the "file" logtarget. If set to ## the empty string then logs are written to stderr. # logfile = "" ## The logfile will be rotated after the time interval specified. When set ## to 0 no time based rotation is performed. Logs are rotated only when ## written to, if there is no log activity rotation may be delayed. # logfile_rotation_interval = "0d" ## The logfile will be rotated when it becomes larger than the specified ## size. When set to 0 no size based rotation is performed. # logfile_rotation_max_size = "0MB" ## Maximum number of rotated archives to keep, any older logs are deleted. ## If set to -1, no archives are removed. # logfile_rotation_max_archives = 5 ## Pick a timezone to use when logging or type 'local' for local time. ## Example: America/Chicago # log_with_timezone = "" ## Override default hostname, if empty use os.Hostname() hostname = "" ## If set to true, do no set the "host" tag in the telegraf agent. omit_hostname = true ############################################################################### # OUTPUT PLUGINS # ############################################################################### ... ... ... ############################################################################### # INPUT PLUGINS # ############################################################################### # Pull Metric Statistics from Amazon CloudWatch [[inputs.cloudwatch]] ## Amazon Region region = "us-east-1" ## Amazon Credentials ## Credentials are loaded in the following order ## 1) Web identity provider credentials via STS if role_arn and web_identity_token_file are specified ## 2) Assumed credentials via STS if role_arn is specified ## 3) explicit credentials from 'access_key' and 'secret_key' ## 4) shared profile from 'profile' ## 5) environment variables ## 6) shared credentials file ## 7) EC2 Instance Profile access_key = "" secret_key = "" # token = "" # role_arn = "" # web_identity_token_file = "" # role_session_name = "" # profile = "" # shared_credential_file = "" ## Endpoint to make request against, the correct endpoint is automatically ## determined and this option should only be set if you wish to override the ## default. ## ex: endpoint_url = "http://localhost:8000" # endpoint_url = "" ## Set http_proxy (telegraf uses the system wide proxy settings if it's is not set) # http_proxy_url = "http://localhost:8888" # The minimum period for Cloudwatch metrics is 1 minute (60s). However not all # metrics are made available to the 1 minute period. Some are collected at # 3 minute, 5 minute, or larger intervals. See https://aws.amazon.com/cloudwatch/faqs/#monitoring. # Note that if a period is configured that is smaller than the minimum for a # particular metric, that metric will not be returned by the Cloudwatch API # and will not be collected by Telegraf. # ## Requested CloudWatch aggregation Period (required - must be a multiple of 60s) period = "5m" ## Collection Delay (required - must account for metrics availability via CloudWatch API) delay = "1m" ## Recommended: use metric 'interval' that is a multiple of 'period' to avoid ## gaps or overlap in pulled data interval = "1m" ## Recommended if "delay" and "period" are both within 3 hours of request time. Invalid values will be ignored. ## Recently Active feature will only poll for CloudWatch ListMetrics values that occurred within the last 3 Hours. ## If enabled, it will reduce total API usage of the CloudWatch ListMetrics API and require less memory to retain. ## Do not enable if "period" or "delay" is longer than 3 hours, as it will not return data more than 3 hours old. ## See https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html #recently_active = "PT3H" ## Configure the TTL for the internal cache of metrics. # cache_ttl = "1h" ## Metric Statistic Namespaces (required) namespaces = ["AWS/EC2","AWS/ELB"] # A single metric statistic namespace that will be appended to namespaces on startup # namespace = "AWS/ELB" ## Maximum requests per second. Note that the global default AWS rate limit is ## 50 reqs/sec, so if you define multiple namespaces, these should add up to a ## maximum of 50. ## See http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_limits.html # ratelimit = 25 ## Timeout for http requests made by the cloudwatch client. # timeout = "5s" ## Namespace-wide statistic filters. These allow fewer queries to be made to ## cloudwatch. # statistic_include = [ "average", "sum", "minimum", "maximum", sample_count" ] # statistic_exclude = [] ## Metrics to Pull ## Defaults to all Metrics in Namespace if nothing is provided ## Refreshes Namespace available metrics every 1h #[[inputs.cloudwatch.metrics]] # names = ["Latency", "RequestCount"] # # ## Statistic filters for Metric. These allow for retrieving specific # ## statistics for an individual metric. # # statistic_include = [ "average", "sum", "minimum", "maximum", sample_count" ] # # statistic_exclude = [] # # ## Dimension filters for Metric. All dimensions defined for the metric names # ## must be specified in order to retrieve the metric statistics. # ## 'value' has wildcard / 'glob' matching support such as 'p-*'. # [[inputs.cloudwatch.metrics.dimensions]] # name = "LoadBalancerName" # value = "p-example" [root@ec2 telegraf]# telegraf --config telegraf.conf --debug 2021-08-16T11:57:25Z I! Starting Telegraf 2021-08-16T11:57:25Z I! Loaded inputs: cloudwatch 2021-08-16T11:57:25Z I! Loaded aggregators: 2021-08-16T11:57:25Z I! Loaded processors: 2021-08-16T11:57:25Z I! Loaded outputs: http 2021-08-16T11:57:25Z I! Tags enabled: 2021-08-16T11:57:25Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"", Flush Interval:10s 2021-08-16T11:57:25Z D! [agent] Initializing plugins 2021-08-16T11:57:25Z D! [agent] Connecting outputs 2021-08-16T11:57:25Z D! [agent] Attempting connection to [outputs.http] 2021-08-16T11:57:25Z D! [agent] Successfully connected to outputs.http 2021-08-16T11:57:25Z D! [agent] Starting service inputs 2021-08-16T11:57:35Z D! [outputs.http] Buffer fullness: 0 / 10000 metrics 2021-08-16T11:57:45Z D! [outputs.http] Buffer fullness: 0 / 10000 metrics 2021-08-16T11:57:55Z D! [outputs.http] Buffer fullness: 0 / 10000 metrics 2021-08-16T11:58:00Z E! [inputs.cloudwatch] Error in plugin: InvalidParameterValue: Parameters do not match original request parameters status code: 400, request id: bedaf89b-57d9-465d-bd4c-4efb30146ff4 2021-08-16T11:58:05Z D! [outputs.http] Buffer fullness: 0 / 10000 metrics 2021-08-16T11:58:15Z D! [outputs.http] Buffer fullness: 0 / 10000 metrics 2021-08-16T11:58:25Z D! [outputs.http] Buffer fullness: 0 / 10000 metrics ^C2021-08-16T11:58:33Z D! [agent] Stopping service inputs 2021-08-16T11:58:33Z D! [agent] Input channel closed 2021-08-16T11:58:33Z I! [agent] Hang on, flushing any cached metrics before shutdown 2021-08-16T11:58:33Z D! [outputs.http] Buffer fullness: 0 / 10000 metrics 2021-08-16T11:58:33Z I! [agent] Stopping running outputs 2021-08-16T11:58:33Z D! [agent] Stopped Successfully