-
Notifications
You must be signed in to change notification settings - Fork 180
/
collectd.go
42 lines (36 loc) · 1.39 KB
/
collectd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT
package collectd
import (
"github.com/aws/amazon-cloudwatch-agent/tool/data"
"github.com/aws/amazon-cloudwatch-agent/tool/data/config/metric/collectd"
"github.com/aws/amazon-cloudwatch-agent/tool/processors"
"github.com/aws/amazon-cloudwatch-agent/tool/processors/defaultConfig"
"github.com/aws/amazon-cloudwatch-agent/tool/processors/migration"
"github.com/aws/amazon-cloudwatch-agent/tool/runtime"
"github.com/aws/amazon-cloudwatch-agent/tool/util"
)
var Processor processors.Processor = &processor{}
type processor struct{}
func (p *processor) Process(ctx *runtime.Context, config *data.Config) {
if ctx.OsParameter == util.OsTypeWindows {
return
}
yes := util.Yes("Do you want to monitor metrics from CollectD? WARNING: CollectD must be installed or the Agent will fail to start")
if yes {
collection := config.MetricsConf().Collection()
collection.CollectD = new(collectd.CollectD)
if collection.StatsD != nil {
collection.CollectD.MetricsAggregationInterval = collection.StatsD.MetricsAggregationInterval
} else {
collection.CollectD.MetricsAggregationInterval = 60
}
}
}
func (p *processor) NextProcessor(ctx *runtime.Context, config *data.Config) interface{} {
if ctx.OsParameter == util.OsTypeWindows {
return migration.Processor
} else {
return defaultConfig.Processor
}
}