SNI Missing Warning ao executar script Python com API Datadog [closed]

2

Sou um iniciante e estou totalmente preso a este. Eu tentei muitas soluções diferentes, mas não consegui encontrar uma que funcione ainda, você poderia me ajudar? :)

Eu criei uma VM Ubuntu 12.04 com o Vagrant no VirtualBox e instalei um agente Datadog nela. Eu então criei um script de API do Datadog para criar um timeboard com diferentes gráficos. Eu estou tentando executar o script python, mas recebo um aviso de cada vez e sem resultados. Como você pode ver aqui: link Eu deveria poder ver o timeboard no meu painel do Datadog, mas ele não aparece.

Aqui está o script que eu criei em / 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)

E quando eu executo o script usando /home/datadog$ ./timeboard.py estou recebendo o seguinte:

/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 https://urllib3.readthedocs.io/en/latest/advanced-
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 
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings.
InsecurePlatformWarning

Eu tentei atualizar o python, mas ao executar o código com o Python 3, ele não reconhece mais o pacote python do Datadog ( link ) e eu não sei como movê-lo do Python 2.7, ou se a exclusão do Python 2.7 causará grandes problemas no meu código / script. Eu sou um novato, desculpe se isso é confuso!

Eu também tentei seguir o link mas infelizmente o comando de importação não trabalho, existe algum software / pacote específico para instalar para que funcione?

O que estou fazendo de errado? Obrigado!

    
por Barbosa 01.03.2018 / 10:40

1 resposta

2

A resposta foi remover os avisos adicionando import ... diretamente no script python, conforme explicado em esta resposta em stackoverflow. com .

    
por Barbosa 01.03.2018 / 12:42