Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set 'instances: lists' in aws_pricing.d/conf.yaml ? (integration-extras/aws_pricing) #832

Open
AhchimLee opened this issue Mar 26, 2021 · 4 comments

Comments

@AhchimLee
Copy link

AhchimLee commented Mar 26, 2021

Hi
I'm trying to set custom integration(aws_pricing) at an aws instance(linux).
The aws_pricing had installed successfully by follow shell command: sudo -u dd-agent -s /bin/bash -c 'datadog-agent integration install -t datadog-aws_pricing==1.0.0'
but errors occured in conf.d/aws_pricing.d/conf.yaml when restart datadog-agent.
conf.yaml:

init_config:

instances:
  - i-04fbxxxxxxxxxxxxx
  - i-0654xxxxxxxxxxxxx
  - i-0da4xxxxxxxxxxxxx

error message:

  Config Errors
  ==============
    aws_pricing
    -----------
      yaml: unmarshal errors:
  line 4: cannot unmarshal !!str `i-04fb0...` into integration.RawMap
  line 5: cannot unmarshal !!str `i-06540...` into integration.RawMap
  line 6: cannot unmarshal !!str `i-0da45...` into integration.RawMap

How to setup conf.yaml file?
thanks.

integration-extras/aws_pricing

@AhchimLee AhchimLee changed the title How to set instances: lists aws_pricing.d/conf.yaml ? How to set instances: lists aws_pricing.d/conf.yaml ? (integration-extras/aws_pricing) Mar 26, 2021
@AhchimLee AhchimLee changed the title How to set instances: lists aws_pricing.d/conf.yaml ? (integration-extras/aws_pricing) How to set 'instances: lists' in aws_pricing.d/conf.yaml ? (integration-extras/aws_pricing) Mar 26, 2021
@hithwen
Copy link
Contributor

hithwen commented Mar 26, 2021

Your conf.yaml file needs to follow this format https://github.com/DataDog/integrations-extras/blob/master/aws_pricing/datadog_checks/aws_pricing/data/conf.yaml.example

Instances does not refer to ec2 instances, it refers to agent check instances (as in OOP instance)

@AhchimLee
Copy link
Author

AhchimLee commented Mar 27, 2021

Your conf.yaml file needs to follow this format https://github.com/DataDog/integrations-extras/blob/master/aws_pricing/datadog_checks/aws_pricing/data/conf.yaml.example

Instances does not refer to ec2 instances, it refers to agent check instances (as in OOP instance)

You means create agent check instances configuration like below?
https://docs.datadoghq.com/developers/write_agent_check/?tab=agentv6v7

And I edited aws_pricing.d/conf.yaml :

init_config:
instances:
  - region_name: us-east-1

But it doesn't work. (occured AWS Credential issue) :

=========
Collector
=========

  Running Checks
  ==============

    aws_pricing (1.0.0)
    -------------------
      Instance ID: aws_pricing:698d047c39b859c1 [ERROR]
      Configuration Source: file:/etc/datadog-agent/conf.d/aws_pricing.d/conf.yaml
      Total Runs: 91
      Metric Samples: Last Run: 0, Total: 0
      Events: Last Run: 0, Total: 0
      Service Checks: Last Run: 0, Total: 0
      Average Execution Time : 8ms
      Last Execution Date : 2021-03-27 10:12:35.000000 UTC
      Last Successful Execution Date : Never
      Error: Unable to locate credentials
      Traceback (most recent call last):
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/base.py", line 901, in run
          self.check(instance)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/aws_pricing/aws_pricing.py", line 22, in check
          service_codes = get_aws_service_codes(pricing_client)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/aws_pricing/aws_pricing.py", line 70, in get_aws_service_codes
          response = pricing_client.describe_services(FormatVersion='aws_v1')
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/client.py", line 276, in _api_call
          return self._make_api_call(operation_name, kwargs)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/client.py", line 572, in _make_api_call
          http, parsed_response = self._make_request(
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/client.py", line 592, in _make_request
          return self._endpoint.make_request(operation_model, request_dict)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/endpoint.py", line 102, in make_request
          return self._send_request(request_dict, operation_model)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/endpoint.py", line 132, in _send_request
          request = self.create_request(request_dict, operation_model)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/endpoint.py", line 115, in create_request
          self._event_emitter.emit(event_name, request=request,
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/hooks.py", line 356, in emit
          return self._emitter.emit(aliased_event_name, **kwargs)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/hooks.py", line 228, in emit
          return self._emit(event_name, kwargs)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/hooks.py", line 211, in _emit
          response = handler(**kwargs)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/signers.py", line 90, in handler
          return self.sign(operation_name, request)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/signers.py", line 160, in sign
          auth.add_auth(request)
        File "/opt/datadog-agent/embedded/lib/python3.8/site-packages/botocore/auth.py", line 357, in add_auth
          raise NoCredentialsError
      botocore.exceptions.NoCredentialsError: Unable to locate credentials

I guess configure Agent checks could be update AWS Credentials, but how to use it?

Otherwise, do AWS credentials have to be set up inside the instance? (Access/Secret Key)

thanks, again.

@hithwen
Copy link
Contributor

hithwen commented Apr 5, 2021

Pinging @tsein-bc as the integration maintainer. @AhchimLee you can also find the maintainer's email on https://github.com/DataDog/integrations-extras/blob/master/.github/CODEOWNERS#L10

@ghost
Copy link

ghost commented May 20, 2021

Pudiste solucionarlo ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants