Skip to content

Commit

Permalink
Merge pull request #19 from mz-ko/master
Browse files Browse the repository at this point in the history
Add asset metrics(CloudFront, EC2, ELB, S3)
  • Loading branch information
mz-ko authored May 10, 2024
2 parents 05cdad0 + 974f890 commit 2cdf105
Show file tree
Hide file tree
Showing 22 changed files with 406 additions and 14 deletions.
28 changes: 28 additions & 0 deletions src/plugin/metrics/CloudFront/Distribution/distribution_count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
metric_id: metric-aws-cloudfront-distribution-count
name: Distribution Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.CloudFront.Distribution
query_options:
group_by:
- key: account
name: Account ID
search_key: account
- key: data.id
name: ID
search_key: data.id
- key: data.viewer_certificate.minimum_protocol_version
name: SSL version
search_key: data.viewer_certificate.minimum_protocol_version
- key: data.status
name: Distribution Status
search_key: data.status
- key: data.state_display
name: Status
search_key: data.state_display
fields:
value:
operator: count
unit: Count
namespace_id: ns-aws-cloudfront-distribution
version: '1.0'
7 changes: 7 additions & 0 deletions src/plugin/metrics/CloudFront/Distribution/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
namespace_id: ns-aws-cloudfront-distribution
name: CloudFront/Distribution
category: ASSET
provider: aws
icon: 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/aws/Amazon-CloudFront.svg'
version: '1.0'
29 changes: 29 additions & 0 deletions src/plugin/metrics/CloudFront/Distribution/object_count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
metric_id: metric-aws-cloudfront-distribution-origin-count
name: Origin Total Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.CloudFront.Distribution
query_options:
group_by:
- key: account
name: Account ID
search_key: account
- key: data.id
name: ID
search_key: data.id
- key: data.viewer_certificate.minimum_protocol_version
name: SSL version
search_key: data.viewer_certificate.minimum_protocol_version
- key: data.status
name: Distribution Status
search_key: data.status
- key: data.state_display
name: Status
search_key: data.state_display
fields:
value:
operator: sum
key: data.origins.quantity
unit: Count
namespace_id: ns-aws-cloudfront-distribution
version: '1.0'
22 changes: 22 additions & 0 deletions src/plugin/metrics/EC2/Ami/ami_count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
metric_id: metric-aws-ec2-ami-count
name: AMI Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.EC2.AMI
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: account
name: Account ID
search_key: account
fields:
value:
operator: count
unit: count
namespace_id: ns-aws-ec2-ami
version: '1.0'
7 changes: 7 additions & 0 deletions src/plugin/metrics/EC2/Ami/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
namespace_id: ns-aws-ec2-ami
name: EC2/AMI
category: ASSET
provider: aws
icon: 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/Amazon-AMI.svg'
version: '1.0'
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
metric_id: metric-aws-ec2-launch_template-count
name: AMI Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.EC2.LaunchTemplate
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: data.AvailabilityZones
name: Availability Zone
search_key: data.AvailabilityZones
- key: account
name: Account ID
search_key: account
fields:
value:
operator: count
unit: count
namespace_id: ns-aws-ec2-auto-scaling-group
version: '1.0'
7 changes: 7 additions & 0 deletions src/plugin/metrics/EC2/AutoScalingGroup/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
namespace_id: ns-aws-ec2-auto-scaling-group
name: EC2/AutoScalingGroup
category: ASSET
provider: aws
icon: 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/Amazon-EC2-Auto-Scaling.svg'
version: '1.0'
22 changes: 22 additions & 0 deletions src/plugin/metrics/EC2/LaunchTemplate/launch_template_count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
metric_id: metric-aws-ec2-launch-template-count
name: LaunchTemplate Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.EC2.LaunchTemplate
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: account
name: Account ID
search_key: account
fields:
value:
operator: count
unit: Count
namespace_id: ns-aws-ec2-launch-template
version: '1.0'
7 changes: 7 additions & 0 deletions src/plugin/metrics/EC2/LaunchTemplate/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
namespace_id: ns-aws-ec2-launch-template
name: EC2/LaunchTemplate
category: ASSET
provider: aws
icon: 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/Amazon-EC2-Auto-Scaling.svg'
version: '1.0'
2 changes: 1 addition & 1 deletion src/plugin/metrics/EC2/SecurityGroup/sg_count.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
metric_id: metric-aws-ec2-sg-count
name: Volume Count
name: Security Groups Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.EC2.SecurityGroup
query_options:
Expand Down
14 changes: 10 additions & 4 deletions src/plugin/metrics/EC2/SecurityGroup/vulnerability_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@ query_options:
- key: account
name: Account ID
search_key: account
- key: reference.resource_id
- key: data.GroupId
name: SG ID
search_key: reference.resource_id
search_key: data.GroupId
default: true
- key: reference.resource_id
- key: data.GroupName
name: SG Name
search_key: name
search_key: data.GroupName
default: true
fields:
value:
operator: count
filter:
- k: data.ip_permissions
v:
source_display: "0.0.0.0/0"
port_display: "22"
o: match
unit: Count
namespace_id: ns-aws-ec2-sg
version: '1.0'
35 changes: 35 additions & 0 deletions src/plugin/metrics/ELB/LoadBalancer/[포기] object_count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
metric_id: metric-aws-elb-loadbalancer-instance-count
name: Related Instance Total Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.ELB.LoadBalancer
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: data.availability_zones.zone_name
name: Availability Zone
search_key: data.availability_zones.zone_name
- key: account
name: Account ID
search_key: account
- key: data.state.code
name: State
search_key: data.state.code
- key: data.type
name: Type
search_key: data.type
- key: data.scheme
name: Scheme
search_key: data.scheme
fields:
value:
operator: sum
key: data.instances
unit: Count
namespace_id: ns-aws-cloudfront-distribution
version: '1.0'
34 changes: 34 additions & 0 deletions src/plugin/metrics/ELB/LoadBalancer/loadbalancer_count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
metric_id: metric-aws-elb-loadbalancer-count
name: LoadBalancer Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.ELB.LoadBalancer
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: data.availability_zones.zone_name
name: Availability Zone
search_key: data.availability_zones.zone_name
- key: account
name: Account ID
search_key: account
- key: data.state.code
name: State
search_key: data.state.code
- key: data.type
name: Type
search_key: data.type
- key: data.scheme
name: Scheme
search_key: data.scheme
fields:
value:
operator: count
unit: Count
namespace_id: ns-aws-elb-loadbalancer
version: '1.0'
7 changes: 7 additions & 0 deletions src/plugin/metrics/ELB/LoadBalancer/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
namespace_id: ns-aws-elb-loadbalancer
name: ELB/LoadBalancer
category: ASSET
provider: aws
icon: 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/aws/Elastic-Load-Balancing.svg'
version: '1.0'
42 changes: 42 additions & 0 deletions src/plugin/metrics/ELB/LoadBalancer/ssl_policy_count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
metric_id: metric-aws-elb-loadbalancer-ssl-policy-count
name: SSL Policy Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.ELB.LoadBalancer
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: data.availability_zones.zone_name
name: Availability Zone
search_key: data.availability_zones.zone_name
- key: account
name: Account ID
search_key: account
- key: data.state.code
name: State
search_key: data.state.code
- key: data.type
name: Type
search_key: data.type
- key: data.scheme
name: Scheme
search_key: data.scheme
- key: data.listeners.ssl_policy
name: Security Policy
search_key: data.listeners.ssl_policy
fields:
value:
operator: count
filter:
- k: data.listeners
v:
port: 443
o: match
unit: Count
namespace_id: ns-aws-elb-loadbalancer
version: '1.0'
7 changes: 7 additions & 0 deletions src/plugin/metrics/ELB/TargetGroup/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
namespace_id: ns-aws-elb-target-group
name: ELB/TargetGroup
category: ASSET
provider: aws
icon: 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/aws/Elastic-Load-Balancing.svg'
version: '1.0'
31 changes: 31 additions & 0 deletions src/plugin/metrics/ELB/TargetGroup/targetgroup_count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
metric_id: metric-aws-elb-target-group-count
name: Target Group Count
metric_type: GAUGE
resource_type: inventory.CloudService:aws.ELB.TargetGroup
query_options:
group_by:
- key: region_code
name: Region
search_key: region_code
reference:
resource_type: inventory.Region
reference_key: region_code
- key: account
name: Account ID
search_key: account
- key: data.port
name: Port
search_key: data.port
- key: data.protocol
name: Protocol
search_key: data.protocol
- key: data.target_type
name: Target Type
search_key: data.target_type
fields:
value:
operator: count
unit: Count
namespace_id: ns-aws-elb-target-group
version: '1.0'
Loading

0 comments on commit 2cdf105

Please sign in to comment.