-
Patch request
-
Resolution: Fixed
-
Major
-
None
-
6.4.18rc1, 7.0.0, 7.2.0alpha1
-
All
Steps to reproduce:
- Add and configure new AWS Discovery Host for AWS Account with a bucket
- Link AWS by HTTP Template
- Configure Macros to connect to account
- Manually run the Discovery
- Wait for the Template to try and get get_metrics
Result:
See screenshot...
See log file...
zabbix_js -s aws.s3.get_metrics.js -i test/params.json -l 4 zabbix_js [799006]: DEBUG: In execute_script() zabbix_js [799006]: DEBUG: In zbx_es_init_env() zabbix_js [799006]: DEBUG: End of zbx_es_init_env():SUCCEED zabbix_js [799006]: DEBUG: In zbx_es_compile() zabbix_js [799006]: DEBUG: End of zbx_es_compile():SUCCEED zabbix_js [799006]: DEBUG: In zbx_es_execute() param: { "auth_type": "access_key", "AccessKeyId": "ACCESSKEY", "SecretAccessKey": "SECRETKEY", "region_match": "CHANGE_IF_NEEDED", "region_not_match": "CHANGE_IF_NEEDED", "region": "us-east-1", "bucket_name": "testbucket" } zabbix_js [799006]: DEBUG: [ AWS S3 ] Sending request: https://testbucket.s3.us-east-1.amazonaws.com/testbucket?location= zabbix_js [799006]: DEBUG: content_type 'application/xml' zabbix_js [799006]: DEBUG: [ AWS S3 ] Received response with status code 200: <?xml version="1.0" encoding="UTF-8"?> <LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">us-east-2</LocationConstraint> zabbix_js [799006]: DEBUG: [ AWS S3 ] Sending request: https://monitoring.us-east-2.amazonaws.com/ zabbix_js [799006]: DEBUG: content_type 'application/json' zabbix_js [799006]: DEBUG: [ AWS S3 ] Received response with status code 200: {"Messages":[],"MetricDataResults":[ {"Id":"m0","Label":"StandardStorage BucketSizeBytes","StatusCode":"Complete","Timestamps":[1.72096848E9],"Values":[111079.0]} ,{"Id":"m1","Label":"AllStorageTypes NumberOfObjects","StatusCode":"Complete","Timestamps":[1.72096848E9],"Values":[1.0]}]} zabbix_js [799006]: DEBUG: [ AWS S3 ] Sending request: https://testbucket.s3.us-east-2.amazonaws.com/?metrics= zabbix_js [799006]: DEBUG: content_type 'application/xml' zabbix_js [799006]: DEBUG: [ AWS S3 ] Received response with status code 403: <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>WG0MGY9RSA9RKY5R</RequestId><HostId>ZTu1TitX643rEu62IF6qY/N26YVs3PEKkOkGGN7QzgHd6XP8ta9uhvSTRrW4UZzARBLuNcuOhPdcFecKf+rWyA==</HostId></Error> zabbix_js [799006]: Warning: [ AWS S3 ] ERROR: Request failed with status code 403: <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>WG0MGY9RSA9RKY5R</RequestId><HostId>ZTu1TitX643rEu62IF6qY/N26YVs3PEKkOkGGN7QzgHd6XP8ta9uhvSTRrW4UZzARBLuNcuOhPdcFecKf+rWyA==</HostId></Error>. zabbix_js [799006]: DEBUG: zbx_es_execute() output:'{"error":"Request failed with status code 403: <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>WG0MGY9RSA9RKY5R</RequestId><HostId>ZTu1TitX643rEu62IF6qY/N26YVs3PEKkOkGGN7QzgHd6XP8ta9uhvSTRrW4UZzARBLuNcuOhPdcFecKf+rWyA==</HostId></Error>."}' zabbix_js [799006]: DEBUG: End of zbx_es_execute():SUCCEED allocated memory: 116815 max allocated or requested memory: 173708 max allowed memory: 536870912 zabbix_js [799006]: DEBUG: In zbx_es_destroy_env() zabbix_js [799006]: DEBUG: End of zbx_es_destroy_env():SUCCEED zabbix_js [799006]: DEBUG: End of execute_script():SUCCEED {"error":"Request failed with status code 403: <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>WG0MGY9RSA9RKY5R</RequestId><HostId>ZTu1TitX643rEu62IF6qY/N26YVs3PEKkOkGGN7QzgHd6XP8ta9uhvSTRrW4UZzARBLuNcuOhPdcFecKf+rWyA==</HostId></Error>."}
Expected:
See logfile
zabbix_js -s aws.s3.get_metrics.js -i test/params.json -l 4 zabbix_js [799233]: DEBUG: In execute_script() zabbix_js [799233]: DEBUG: In zbx_es_init_env() zabbix_js [799233]: DEBUG: End of zbx_es_init_env():SUCCEED zabbix_js [799233]: DEBUG: In zbx_es_compile() zabbix_js [799233]: DEBUG: End of zbx_es_compile():SUCCEED zabbix_js [799233]: DEBUG: In zbx_es_execute() param: { "auth_type": "access_key", "AccessKeyId": "ACCESSKEY", "SecretAccessKey": "SECRETKEY", "region_match": "CHANGE_IF_NEEDED", "region_not_match": "CHANGE_IF_NEEDED", "region": "us-east-1", "bucket_name": "testbucket" } zabbix_js [799233]: DEBUG: [ AWS S3 ] Sending request: https://testbucket.s3.us-east-1.amazonaws.com/testbucket?location= zabbix_js [799233]: DEBUG: content_type 'application/xml' zabbix_js [799233]: DEBUG: [ AWS S3 ] Received response with status code 200: <?xml version="1.0" encoding="UTF-8"?> <LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">us-east-2</LocationConstraint> zabbix_js [799233]: DEBUG: [ AWS S3 ] Sending request: https://monitoring.us-east-2.amazonaws.com/ zabbix_js [799233]: DEBUG: content_type 'application/json' zabbix_js [799233]: DEBUG: [ AWS S3 ] Received response with status code 200: {"Messages":[],"MetricDataResults":[ {"Id":"m0","Label":"StandardStorage BucketSizeBytes","StatusCode":"Complete","Timestamps":[1.7209686E9],"Values":[111079.0]} ,{"Id":"m1","Label":"AllStorageTypes NumberOfObjects","StatusCode":"Complete","Timestamps":[1.7209686E9],"Values":[1.0]}]} zabbix_js [799233]: DEBUG: [ AWS S3 ] Sending request: https://testbucket.s3.us-east-2.amazonaws.com/?metrics= zabbix_js [799233]: DEBUG: cannot get content type: No error zabbix_js [799233]: DEBUG: [ AWS S3 ] Received response with status code 200: <?xml version="1.0" encoding="UTF-8"?><ListMetricsConfigurationsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><IsTruncated>false</IsTruncated></ListMetricsConfigurationsResult> zabbix_js [799233]: DEBUG: zbx_es_execute() output:'{"metrics":[ {"Id":"m0","Label":"StandardStorage BucketSizeBytes","StatusCode":"Complete","Timestamps":[1720968600],"Values":[111079]} ,{"Id":"m1","Label":"AllStorageTypes NumberOfObjects","StatusCode":"Complete","Timestamps":[1720968600],"Values":[1]}]}' zabbix_js [799233]: DEBUG: End of zbx_es_execute():SUCCEED allocated memory: 116796 max allocated or requested memory: 173496 max allowed memory: 536870912 zabbix_js [799233]: DEBUG: In zbx_es_destroy_env() zabbix_js [799233]: DEBUG: End of zbx_es_destroy_env():SUCCEED zabbix_js [799233]: DEBUG: End of execute_script():SUCCEED {"metrics":[\{"Id":"m0","Label":"StandardStorage BucketSizeBytes","StatusCode":"Complete","Timestamps":[1720968600],"Values":[111079]} ,{"Id":"m1","Label":"AllStorageTypes NumberOfObjects","StatusCode":"Complete","Timestamps":[1720968600],"Values":[1]}]}
See attached patch file in pull request: Aws by http check s3 permissions by riaano · Pull Request #132 · zabbix/zabbix (github.com).
- depends on
-
ZBXNEXT-9341 Implement assume role authentication for monitoring AWS
- Closed