Skip to content

Commit

Permalink
Add agenthealth translator (#927)
Browse files Browse the repository at this point in the history
  • Loading branch information
jefchien authored Oct 25, 2023
1 parent f338999 commit a6034e6
Show file tree
Hide file tree
Showing 53 changed files with 3,379 additions and 2,642 deletions.
5 changes: 4 additions & 1 deletion service/defaultcomponents/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/otlpreceiver"

"github.com/aws/amazon-cloudwatch-agent/extension/agenthealth"
"github.com/aws/amazon-cloudwatch-agent/plugins/outputs/cloudwatch"
"github.com/aws/amazon-cloudwatch-agent/plugins/processors/ec2tagger"
)
Expand Down Expand Up @@ -61,7 +62,9 @@ func Factories() (otelcol.Factories, error) {
return otelcol.Factories{}, err
}

if factories.Extensions, err = extension.MakeFactoryMap(); err != nil {
if factories.Extensions, err = extension.MakeFactoryMap(
agenthealth.NewFactory(),
); err != nil {
return otelcol.Factories{}, err
}

Expand Down
3 changes: 2 additions & 1 deletion service/defaultcomponents/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const (
receiversCount = 5
processorCount = 5
exportersCount = 5
extensionsCount = 0
extensionsCount = 1
)

func TestComponents(t *testing.T) {
Expand Down Expand Up @@ -45,4 +45,5 @@ func TestComponents(t *testing.T) {

extensions := factories.Extensions
assert.Len(t, extensions, extensionsCount)
assert.NotNil(t, extensions["agenthealth"])
}
206 changes: 107 additions & 99 deletions translator/tocwconfig/sampleConfig/advanced_config_darwin.yaml
Original file line number Diff line number Diff line change
@@ -1,104 +1,112 @@
connectors: {}
exporters:
awscloudwatch:
force_flush_interval: 1m0s
max_datums_per_call: 1000
max_values_per_datum: 150
namespace: CWAgent
region: us-west-2
region_type: "ACJ"
mode: "EC2"
resource_to_telemetry_conversion:
enabled: true
extensions: {}
awscloudwatch:
force_flush_interval: 1m0s
max_datums_per_call: 1000
max_values_per_datum: 150
middleware: agenthealth/metrics
mode: EC2
namespace: CWAgent
region: us-west-2
region_type: ACJ
resource_to_telemetry_conversion:
enabled: true
extensions:
agenthealth/metrics:
is_usage_data_enabled: true
stats:
operations:
- PutMetricData
processors:
cumulativetodelta/hostDeltaMetrics:
exclude:
match_type: strict
metrics:
- iops_in_progress
- diskio_iops_in_progress
regexp: null
include:
match_type: ""
metrics: []
regexp: null
initial_value: 0
max_staleness: 0s
ec2tagger:
ec2_instance_tag_keys:
- AutoScalingGroupName
ec2_metadata_tags:
- ImageId
- InstanceId
- InstanceType
refresh_interval_seconds: 0s
imds_retries: 1
cumulativetodelta/hostDeltaMetrics:
exclude:
match_type: strict
metrics:
- iops_in_progress
- diskio_iops_in_progress
regexp: null
include:
match_type: ""
metrics: []
regexp: null
initial_value: 0
max_staleness: 0s
ec2tagger:
ec2_instance_tag_keys:
- AutoScalingGroupName
ec2_metadata_tags:
- ImageId
- InstanceId
- InstanceType
imds_retries: 1
refresh_interval_seconds: 0s
receivers:
telegraf_cpu:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_disk:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_diskio:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_mem:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_netstat:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_swap:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_cpu:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_disk:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_diskio:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_mem:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_netstat:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
telegraf_swap:
collection_interval: 1m0s
initial_delay: 1s
timeout: 0s
service:
extensions: []
pipelines:
metrics/host:
exporters:
- awscloudwatch
processors:
- ec2tagger
receivers:
- telegraf_cpu
- telegraf_disk
- telegraf_mem
- telegraf_netstat
- telegraf_swap
metrics/hostDeltaMetrics:
exporters:
- awscloudwatch
processors:
- cumulativetodelta/hostDeltaMetrics
- ec2tagger
receivers:
- telegraf_diskio
telemetry:
logs:
development: false
disable_caller: false
disable_stacktrace: false
encoding: console
error_output_paths: []
initial_fields: {}
level: info
output_paths: [/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log]
sampling:
initial: 2
thereafter: 500
metrics:
address: ""
level: None
readers: []
resource: {}
traces:
processors: []
propagators: []
extensions:
- agenthealth/metrics
pipelines:
metrics/host:
exporters:
- awscloudwatch
processors:
- ec2tagger
receivers:
- telegraf_mem
- telegraf_netstat
- telegraf_swap
- telegraf_cpu
- telegraf_disk
metrics/hostDeltaMetrics:
exporters:
- awscloudwatch
processors:
- cumulativetodelta/hostDeltaMetrics
- ec2tagger
receivers:
- telegraf_diskio
telemetry:
logs:
development: false
disable_caller: false
disable_stacktrace: false
encoding: console
error_output_paths: []
initial_fields: {}
level: info
output_paths:
- /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log
sampling:
initial: 2
thereafter: 500
metrics:
address: ""
level: None
readers: []
resource: {}
traces:
processors: []
propagators: []
44 changes: 26 additions & 18 deletions translator/tocwconfig/sampleConfig/advanced_config_linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ exporters:
force_flush_interval: 1m0s
max_datums_per_call: 1000
max_values_per_datum: 150
middleware: agenthealth/metrics
mode: EC2
namespace: CWAgent
region: us-west-2
region_type: "ACJ"
mode: "EC2"
region_type: ACJ
resource_to_telemetry_conversion:
enabled: true
extensions: {}
extensions:
agenthealth/metrics:
is_usage_data_enabled: true
stats:
operations:
- PutMetricData
processors:
cumulativetodelta/hostDeltaMetrics:
exclude:
Expand All @@ -29,60 +35,61 @@ processors:
ec2_instance_tag_keys:
- AutoScalingGroupName
ec2_metadata_tags:
- ImageId
- InstanceId
- InstanceType
- ImageId
refresh_interval_seconds: 0s
imds_retries: 1
refresh_interval_seconds: 0s
receivers:
telegraf_cpu:
collection_interval: 1m0s
initial_delay: "1s"
initial_delay: 1s
timeout: 0s
telegraf_disk:
collection_interval: 1m0s
initial_delay: "1s"
initial_delay: 1s
timeout: 0s
telegraf_diskio:
collection_interval: 1m0s
initial_delay: "1s"
initial_delay: 1s
timeout: 0s
telegraf_ethtool:
collection_interval: 1m0s
initial_delay: "1s"
initial_delay: 1s
timeout: 0s
telegraf_mem:
collection_interval: 1m0s
initial_delay: "1s"
initial_delay: 1s
timeout: 0s
telegraf_netstat:
collection_interval: 1m0s
initial_delay: "1s"
initial_delay: 1s
timeout: 0s
telegraf_nvidia_smi:
collection_interval: 1m0s
initial_delay: "1s"
initial_delay: 1s
timeout: 0s
telegraf_swap:
collection_interval: 1m0s
initial_delay: "1s"
initial_delay: 1s
timeout: 0s
service:
extensions: []
extensions:
- agenthealth/metrics
pipelines:
metrics/host:
exporters:
- awscloudwatch
processors:
- ec2tagger
receivers:
- telegraf_cpu
- telegraf_disk
- telegraf_ethtool
- telegraf_mem
- telegraf_netstat
- telegraf_nvidia_smi
- telegraf_swap
- telegraf_ethtool
- telegraf_nvidia_smi
- telegraf_cpu
metrics/hostDeltaMetrics:
exporters:
- awscloudwatch
Expand All @@ -100,7 +107,8 @@ service:
error_output_paths: []
initial_fields: {}
level: info
output_paths: [/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log]
output_paths:
- /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log
sampling:
initial: 2
thereafter: 500
Expand Down
Loading

0 comments on commit a6034e6

Please sign in to comment.