Dogshell は非推奨となり、Pup CLI に置き換えられました。これは、Datadog API と対話するための包括的な、AI-エージェント対応の CLI です。

コマンドライン ラッパーである Dogshell を使用すると、Datadog API をコマンドラインから操作できます。

Dogshell をインストール

Dogshell には、公式にサポートされている datadogpy Python ライブラリ が付属しており、DogStatsD を使って Datadog API にデータを送信する際によく利用されます。ライブラリを PIP でインストールするには、次のコマンドを実行してください:

pip install datadog

環境によっては、ライブラリを PATH に追加する必要がある場合があります。代替のインストール手順については、datadogpy GitHub repo を参照してください。

Dogshell の設定

Dogshell は、API キー、アプリケーションキー、Datadog サイトを保存するために .dogrc という構成ファイルを使用します。

Dogshell を設定する手順:

  1. ホームディレクトリに .dogrc ファイルを作成してください:

    touch ~/.dogrc

  2. ファイルに以下の内容を追加し、MY_API_KEYMY_APP_KEY をそれぞれの API キーとアプリケーションキーに置き換えてください:

    [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.

Metrics Explorer から test_dogshell_metric を観察する