Collect number of available IPs per aws subnet and Send collected metrics to Pushgateway
- Support helm chart install
collect ips from all subnet if user not setfilter.tags
- Support Multi VPC?
- Configure AWS credentials more safely
- Implement api call throttling to avoid rate limit error
- Clone git
git clone https://github.com/GeunjeLEE/aws-subnet-available-ip-collector.git
- Move to directory
cd aws-subnet-avilable-ip-collector
- Config collector
vim kubernetes/configmap.yaml
configure | description | default | etc |
---|---|---|---|
credentials.aws_access_key_id | aws_access_key_id | - | Need AmazonVPCReadOnlyAccess policy Need to encrypt with base64 |
credentials.aws_secret_access_key | aws_secret_access_key | - | Need AmazonVPCReadOnlyAccess policy Need to encrypt with base64 |
credentials.aws_region_name | AWS Region | ap-northeast-2 | |
push_gateway_endpoint | Endpoint of prometheus-pushgateway | localhost:0901 | - |
filters.vpc_id | vpc_id of collecting target subnet |
- | |
filters.tags | tag to subnet filtering | - |
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-subnet-available-ip-collector-conf
data:
config.yaml: |
credentials:
aws_access_key_id: base64(<AWS_ACCESS_KEY_ID>
aws_secret_access_key: base64(<AWS_SECRET_ACCESS_KEY>)
#aws_region_name: <AWS_REGION_NAME> # default is ap-northeast-2
push_gateway_endpoint: localhost:9091
filters:
vpc_id: <vpc_id>
tags:
key: value
- Deploy kubernetes manifests
kubectl apply -f kubernetes/configmap.yaml
kubectl apply -f kubernetes/deployment.yaml
Create panel and just Set the metric name to available_ip_count
kubectl delete -f kubernetes/configmap.yaml
kubectl delete -f kubernetes/deployment.yaml