Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/config/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,10 +1022,10 @@ var SupportedServices = serviceConfigs{
Namespace: "AWS/IPAM",
Alias: "ipam",
ResourceFilters: []*string{
aws.String("ec2:ipam-pool"),
aws.String("ec2:ipam"),
},
DimensionRegexps: []*regexp.Regexp{
regexp.MustCompile(":ipam-pool/(?P<IpamPoolId>[^/]+)$"),
regexp.MustCompile(":ipam/(?P<IpamId>[^/]+)$"),
},
},
{
Expand Down
16 changes: 8 additions & 8 deletions pkg/job/maxdimassociator/associator_ipam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import (
"github.com/prometheus-community/yet-another-cloudwatch-exporter/pkg/model"
)

var ec2IpamPool = &model.TaggedResource{
ARN: "arn:aws:ec2::123456789012:ipam-pool/ipam-pool-1ff5e4e9ad2c28b7b",
var ec2Ipam = &model.TaggedResource{
ARN: "arn:aws:ec2::123456789012:ipam/ipam-1ff5e4e9ad2c28b7b",
Namespace: "AWS/IPAM",
}

var ipamResources = []*model.TaggedResource{
ec2IpamPool,
ec2Ipam,
}

func TestAssociatorIpam(t *testing.T) {
Expand All @@ -47,31 +47,31 @@ func TestAssociatorIpam(t *testing.T) {

testcases := []testCase{
{
name: "should match with IpamPoolId dimension",
name: "should match with IpamId dimension",
args: args{
dimensionRegexps: config.SupportedServices.GetService("AWS/IPAM").ToModelDimensionsRegexp(),
resources: ipamResources,
metric: &model.Metric{
MetricName: "VpcIPUsage",
Namespace: "AWS/IPAM",
Dimensions: []model.Dimension{
{Name: "IpamPoolId", Value: "ipam-pool-1ff5e4e9ad2c28b7b"},
{Name: "IpamId", Value: "ipam-1ff5e4e9ad2c28b7b"},
},
},
},
expectedSkip: false,
expectedResource: ec2IpamPool,
expectedResource: ec2Ipam,
},
{
name: "should skip with unmatched IpamPoolId dimension",
name: "should skip with unmatched IpamId dimension",
args: args{
dimensionRegexps: config.SupportedServices.GetService("AWS/IPAM").ToModelDimensionsRegexp(),
resources: ipamResources,
metric: &model.Metric{
MetricName: "VpcIPUsage",
Namespace: "AWS/IPAM",
Dimensions: []model.Dimension{
{Name: "IpamPoolId", Value: "ipam-pool-blahblah"},
{Name: "IpamId", Value: "ipam-blahblah"},
},
},
},
Expand Down