SNI Missing Warning when executing Python script with Datadog API [closed]

I'm a beginner and I'm totally stuck on this one. I tried many different solutions but haven't been able to find one that works yet, could you help me? :)

I created an Ubuntu 12.04 VM with Vagrant on VirtualBox and installed a Datadog agent on it. I then created a Datadog API script to create a timeboard with different graphs. I'm trying to execute the python script but I get a warning every time, and no results. As you can see here: I should be able to see the timeboard in my Datadog dashboard, but it doesn't appear.

Here is the script I created in /home/datadog :

#!/usr/bin/env python
from datadog import initialize, api
options = { 'api_key': 'MYAPIKEY', 'app_key': 'MYAPPKEY'
}
initialize(**options)
title = "Visualizing Data for Barbosa"
description = "Timeboard using Datadog's API"
graphs = [
{ "definition": { "events": [], "requests": [ {"q": "my_metric{host:precise64}"} ], "viz": "timeseries" }, "title": "My metric scoped over my host"
},
{ "definition": { "events": [], "requests": [ {"q": "anomalies(avg:mysql.performance.cpu_time{host:precise64}, 'robust', 2)"} ], "viz": "timeseries" }, "title": "Anomalies on MySQL for CPU time"
},
{ "definition": { "events": [], "requests": [ {"q": "avg:ùy_metric{host:precise64}.rollup(sum, 3600)"} ], "viz": "timeseries" }, "title": "Rollup for My metric over the past hour"
}]
read_only = True
api.Timeboard.create(title=title, description=description, graphs=graphs, read_only=read_only)

And when I execute the script using /home/datadog$ ./timeboard.py I am getting the following:

/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:339:
SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name
Indication) extension to TLS is not available on this platform. This may
cause the server to present an incorrect TLS certificate, which can cause
validation failures. You can upgrade to a newer version of Python to solve
this. For more information, see
usage.html#ssl-warnings.
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:137:
InsecurePlatformWarning: A true SSLContext object is not available. This
prevents urllib3 from configuring SSL appropriately and may cause certain
SSL connections to fail. You can upgrade to a newer version of Python to
solve this. For more information, see
InsecurePlatformWarning

I tried upgrading python but when executing the code with Python 3, it doesn't recognize the Datadog python package anymore () and I don't know how to move it from Python 2.7, or if deleting Python 2.7 will cause huge issues in my code/script. I'm a beginner so sorry if this is confusing!

I also tried following but unfortunately the import command doesn't work either, is there a specific software/package to install to make it work?

What am I doing wrong? Thanks!

0

1 Answer

The answer was to remove the warnings by adding import... directly in the python script, as explained in this answer on stackoverflow.com.

1

You Might Also Like