ihue ihue - 3 months ago 17
Python Question

ImportError: No module named datadog

I'm new to datadog. I followed this post, and replaced in my app/api keys.

I have :

nginx_dd.py


# Make sure you replace the API and/or APP key below
# with the ones for your account

from datadog import initialize, api
import time

options = {
'api_key': '***',
'app_key': '***'
}

initialize(**options)

now = int(time.time())
query = 'system.cpu.idle{*}by{host}'
print api.Metric.query(start=now - 3600, end=now, query=query)





When I run it
python nginx_dd.py
, I kept getting


ImportError: No module named datadog





Any hints / suggestions on this will be a huge helps !

Answer

Verify if the datadog package is installed in your environment.

You can do this with this command:

$ pip freeze | grep datadog

If it's not installed, you can install it with this command:

$ pip install datadog