Dogshell está obsoleto y ha sido reemplazado por Pup CLI, una CLI integral lista para agentes de IA para interactuar con las APIs de Datadog.

Puede usar la API de Datadog en la línea de comandos utilizando un envoltorio llamado Dogshell.

Instale Dogshell

Dogshell viene con la datadogpy biblioteca de Python oficialmente soportada, que a menudo se utiliza para enviar datos a Datadog con DogStatsD. Para instalar la biblioteca con PIP, ejecute el siguiente comando:

pip install datadog

Dependiendo de su entorno, es posible que tenga que agregar la biblioteca a su PATH. Consulte el datadogpy repositorio de GitHub para instrucciones de instalación alternativas.

Configure Dogshell

Dogshell utiliza un archivo de configuración llamado .dogrc para almacenar su clave de API, clave de aplicación y sitio de Datadog.

Para configurar Dogshell:

  1. Cree un .dogrc archivo en su directorio personal:

    touch ~/.dogrc

  2. Agregue el siguiente contenido al archivo, reemplazando MY_API_KEY y MY_APP_KEY con su clave de API y clave de aplicación respectivamente:

    [Connection]
    apikey = MY_API_KEY
    appkey = MY_APP_KEY
    api_host = 
    
    You can create multiple configuration files if you need to run commands against different environments. Use the --config flag to specify the path to an alternative configuration file.
  3. Test the dogshell command by posting a test metric:

    dog metric post test_metric 1

Dogshell commands

Use the -h flag for a full list of the available Dogshell commands:

dog -h

You can append the -h option to the following commands to get more information on specific Dogshell usage:

  • dog metric
  • dog event
  • dog service_check
  • dog monitor
  • dog downtime
  • dog timeboard
  • dog screenboard
  • dog dashboard
  • dog host
  • dog tag
  • dog search
  • dog comment

For additional information, see the Dogshell code.

Dogshell example

The following syntax posts a metric to your Datadog account:

dog metric post MY_METRIC_NAME METRIC_VALUE --tags "TAG_KEY_1:TAG_VALUE_1,TAG_KEY_2:TAG_VALUE_2"

For example, the following command sends a metric named test_dogshell_metric to your account with a value of 1.0 and the tags test:one and example:one:

dog metric post test_dogshell_metric 1.0 --tags "test:one,example:one"

After you run the command, search for test_dogshell_metric using the Metrics Explorer.

Observando test_dogshell_metric desde el Metrics Explorer