nerdswords / yet-another-cloudwatch-exporter

Prometheus exporter for AWS CloudWatch - Discovers services through AWS tags, gets CloudWatch metrics data and provides them as Prometheus metrics with AWS tags as labels
Apache License 2.0
967 stars 331 forks source link

available az for cn-northwest-1 #501

Open wl-sre opened 2 years ago

wl-sre commented 2 years ago

Is there an existing issue for this?

Current Behavior


2021/12/17 09:26:39 DEBUG: Response sts/GetCallerIdentity Details: ---[ RESPONSE ]-------------------------------------- HTTP/1.1 403 Content-Length: 305 Content-Type: text/xml Date: Fri, 17 Dec 2021 09:26:38 GMT X-Amzn-Requestid: 48993052-8b1d-4eb9-8222-3b3d36414ff4


2021/12/17 09:26:39

Sender InvalidClientTokenId The security token included in the request is invalid 48993052-8b1d-4eb9-8222-3b3d36414ff4

{"level":"info","msg":"Couldn't get account Id for role : InvalidClientTokenId: The security token included in the request is invalid\n\tstatus code: 403, request id: 48993052-8b1d-4eb9-8222-3b3d36414ff4\n","time":"2021-12-17T09:26:39Z"} {"level":"debug","msg":"Metrics scraped.","time":"2021-12-17T09:26:39Z"} {"level":"debug","msg":"Scraping every 300 seconds","time":"2021-12-17T09:26:39Z"}

Expected Behavior

I specified the region to 'cn-northwest-1' in china , does it support the az in china ? thanks

Steps To Reproduce

docker run -e regions='cn-northwest-1' -e aws_access_key_id='111111111111111' -e aws_secret_access_key='2222222222222' -itd -v $PWD/config.yml:/tmp/config.yml -p 5000:5000 --name yace ghcr.io/nerdswords/yet-another-cloudwatch-exporter:v0.33.0-alpha "--config.file=/tmp/config.yml" "--debug"

Anything else?

No response

thomaspeitz commented 2 years ago

This looks like a problem with CREDS.

Still a problem?

Can you try to give the docker container AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env vars?

wang415 commented 1 year ago

{"level":"info","msg":"Parse config..","time":"2022-11-09T03:23:18Z"} {"level":"info","msg":"Startup completed","time":"2022-11-09T03:23:18Z"} {"level":"debug","msg":"Starting scraping async","time":"2022-11-09T03:23:18Z"} {"level":"debug","msg":"Scrape initially first time","time":"2022-11-09T03:23:18Z"} 2022/11/09 03:23:18 DEBUG: Request sts/GetCallerIdentity Details: ---[ REQUEST POST-SIGN ]----------------------------- POST / HTTP/1.1 Host: sts.amazonaws.com User-Agent: aws-sdk-go/1.44.127 (go1.18.8; linux; amd64) Content-Length: 43 Authorization: AWS4-HMAC-SHA256 Credential=AKIAXHMHPBOVUM4ZBZFQ/20221109/us-east-1/sts/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=2d1f52df7ae202a9b86366ef7596e44c0ca6349721768317c211c713c4cefa0b Content-Type: application/x-www-form-urlencoded; charset=utf-8 X-Amz-Date: 20221109T032318Z Accept-Encoding: gzip

Action=GetCallerIdentity&Version=2011-06-15

2022/11/09 03:23:20 DEBUG: Response sts/GetCallerIdentity Details: ---[ RESPONSE ]-------------------------------------- HTTP/1.1 403 Forbidden Content-Length: 306 Content-Type: text/xml Date: Wed, 09 Nov 2022 03:23:20 GMT X-Amzn-Requestid: 54dfff07-13de-4df7-8142-db74e68ae2d8


2022/11/09 03:23:20

Sender InvalidClientTokenId The security token included in the request is invalid. 54dfff07-13de-4df7-8142-db74e68ae2d8

{"arn":"","error":"InvalidClientTokenId: The security token included in the request is invalid.\n\tstatus code: 403, request id: 54dfff07-13de-4df7-8142-db74e68ae2d8","job_type":"s3","level":"error","msg":"Couldn't get account Id","region":"cn-northwest-1","time":"2022-11-09T03:23:20Z"} {"level":"debug","msg":"Metrics scraped.","time":"2022-11-09T03:23:20Z"} {"level":"debug","msg":"Scraping every 300 seconds","time":"2022-11-09T03:23:20Z"}

wang415 commented 1 year ago

admin@admindeMacBook-Pro ~ % docker exec -it ffbfb71cb399b1bbf3b07d103c8e77d75eb 3f1bae9f58cf77ae0c570118a55e7 /bin/sh ~ $ ~ $ ~ $ ls ~ $ env HOSTNAME=ffbfb71cb399 SHLVL=1 HOME=/exporter regions=cn-northwest-1 TERM=xterm PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin AWS_ACCESS_KEY_ID=AKIAXXX AWS_SECRET_ACCESS_KEY=kcHNXXXX PWD=/exporter ~ $

wang415 commented 1 year ago

Same problem