0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Datadogことはじめ

Last updated at Posted at 2025-10-30

サインアップ

サインアップして Email Verification Code でアクティベーションしたら、どうやらpingを打って確認してくれみたいな感じになる。わかりにくいが Copy アイコンを押すと API Key 付きでコマンドをコピーできる
image.png

Datadogインストール

さすがにVPS契約とか設定は省略する。稼働中の自サーバーがあることが前提だ

ubuntu@ik1-336-28225:~$ DD_API_KEY={YOUR_API_KEY} \
DD_SITE="ap1.datadoghq.com" \
DD_REMOTE_UPDATES=true \
DD_ENV=dev \
bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"



  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 78836  100 78836    0     0   325k      0 --:--:-- --:--:-- --:--:--  326k

* Datadog Agent 7 install script v1.41.1                                                            

[sudo] ubuntu のパスワード: 
/usr/bin/systemctl

* Installing curl gnupg                                                                             

取得:1 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
ヒット:2 http://archive.ubuntu.com/ubuntu noble InRelease
取得:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
取得:4 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [1,270 kB]
取得:5 http://archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
取得:6 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [1,570 kB]
取得:7 http://security.ubuntu.com/ubuntu noble-security/main amd64 Components [21.6 kB]
取得:8 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages [906 kB]
取得:9 http://security.ubuntu.com/ubuntu noble-security/universe Translation-en [203 kB]
取得:10 http://archive.ubuntu.com/ubuntu noble-updates/main Translation-en [297 kB]
取得:11 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Components [175 kB]
取得:12 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Components [378 kB]
取得:13 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Components [52.3 kB]
取得:14 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Components [212 B]
取得:15 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Components [212 B]
取得:16 http://archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages [2,217 kB]
取得:17 http://archive.ubuntu.com/ubuntu noble-updates/restricted Translation-en [502 kB]
取得:18 http://archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Components [212 B]
取得:19 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Components [940 B]
取得:20 http://archive.ubuntu.com/ubuntu noble-backports/main amd64 Components [7,148 B]
取得:21 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 Components [11.0 kB]
取得:22 http://archive.ubuntu.com/ubuntu noble-backports/restricted amd64 Components [212 B]
取得:23 http://archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 Components [212 B]
7,990 kB を 5秒 で取得しました (1,723 kB/s)
パッケージリストを読み込んでいます...
パッケージリストを読み込んでいます...
依存関係ツリーを作成しています...
状態情報を読み取っています...
curl はすでに最新バージョン (8.5.0-2ubuntu10.6) です。
curl は手動でインストールしたと設定されました。
gnupg はすでに最新バージョン (2.4.4-2ubuntu17.3) です。
gnupg は手動でインストールしたと設定されました。
アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 159 個。

* Installing APT package sources for Datadog                                                        

gpg: ディレクトリ'/root/.gnupg'が作成されました
gpg: /root/.gnupg/trustdb.gpg: 信用データベースができました
gpg: 鍵E6266D4AC0962C7D: 公開鍵"Datadog, Inc. APT key (2023-04-20) (APT key) <package+aptkey@datadoghq.com>"をインポートしました
gpg: 処理数の合計: 1
gpg:               インポート: 1
gpg: 鍵0D826EB906462314: 公開鍵"Datadog, Inc. APT key (2024-05-15) (APT key) <package+aptkey@datadoghq.com>"をインポートしました
gpg: 処理数の合計: 1
gpg:               インポート: 1
gpg: 鍵E6266D4AC0962C7D:"Datadog, Inc. APT key (2023-04-20) (APT key) <package+aptkey@datadoghq.com>"変更なし
gpg: 処理数の合計: 1
gpg:              変更なし: 1
gpg: 鍵32637D44F14F620E: 公開鍵"Datadog, Inc. Master key (2020-09-08) <package+masterkey@datadoghq.com>"をインポートしました
gpg: 処理数の合計: 1
gpg:               インポート: 1
gpg: 鍵D3A80E30382E94DE: 公開鍵"Datadog, Inc <package@datadoghq.com>"をインポートしました
gpg: 処理数の合計: 1
gpg:               インポート: 1
無視:1 https://apt.datadoghq.com stable InRelease
取得:2 https://apt.datadoghq.com stable Release [26.0 kB]
取得:3 https://apt.datadoghq.com stable Release.gpg [801 B]
取得:4 https://apt.datadoghq.com stable/7 all Packages [1,184 B]
取得:5 https://apt.datadoghq.com stable/7 amd64 Packages [115 kB]
143 kB を 1秒 で取得しました (274 kB/s)
パッケージリストを読み込んでいます...
  Installing package(s): datadog-agent datadog-signing-keys

パッケージリストを読み込んでいます...
依存関係ツリーを作成しています...
状態情報を読み取っています...
以下のパッケージが新たにインストールされます:
  datadog-agent datadog-signing-keys
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 159 個。
163 MB のアーカイブを取得する必要があります。
この操作後に追加で 720 MB のディスク容量が消費されます。
取得:1 https://apt.datadoghq.com stable/7 amd64 datadog-agent amd64 1:7.71.2-1 [163 MB]
取得:2 https://apt.datadoghq.com stable/7 amd64 datadog-signing-keys all 1:1.4.0-1 [23.7 kB]
163 MB を 14秒 で取得しました (11.5 MB/s)
以前に未選択のパッケージ datadog-agent を選択しています。
(データベースを読み込んでいます ... 現在 128866 個のファイルとディレクトリがインストールされています。)
.../datadog-agent_1%3a7.71.2-1_amd64.deb を展開する準備をしています ...
datadog-agent (1:7.71.2-1) を展開しています...
以前に未選択のパッケージ datadog-signing-keys を選択しています。
.../datadog-signing-keys_1%3a1.4.0-1_all.deb を展開する準備をしています ...
datadog-signing-keys (1:1.4.0-1) を展開しています...
datadog-agent (1:7.71.2-1) を設定しています ...
Creating file: '/opt/datadog-agent/.post_python_installed_packages.txt'
File '/opt/datadog-agent/.diff_python_installed_packages.txt' not found.
datadog-signing-keys (1:1.4.0-1) を設定しています ...

Pending kernel upgrade!
Running kernel version:
  6.8.0-57-generic
Diagnostics:
  The currently running kernel version is not the expected kernel version 6.8.0-86-generic.

Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting.

Restarting services...

Service restarts being deferred:
 /etc/needrestart/restart.d/dbus.service
 systemctl restart getty@tty1.service
 systemctl restart serial-getty@ttyS0.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
W: --force-yes は時代遅れです、代わりに --allow で始まるオプションのいずれかを使用します。

* Adding your API key to the Datadog Agent configuration: /etc/datadog-agent/datadog.yaml           
* Setting SITE in the Datadog Agent configuration: /etc/datadog-agent/datadog.yaml                  
* Adding your DD_ENV to the Datadog Agent configuration: /etc/datadog-agent/datadog.yaml            
* Setting Datadog Agent configuration to use Remote Updates: /etc/datadog-agent/datadog.yaml        

/usr/bin/systemctl
* Starting the Datadog Agent...

  Your Datadog Agent is running and functioning properly.
  It will continue to run in the background and submit metrics to Datadog.                          
  If you ever want to stop the Datadog Agent, run:                                                  
      sudo systemctl stop datadog-agent
  And to run it again run:
      sudo systemctl start datadog-agent

ubuntu@ik1-336-28225:~$ 

終わったようだ
image.png

ひとまずはここまで。あぁー、サーバーにインストールしていろいろ値が取れるなら「アプリケーションがどんな値を送るべきか」を考えるよりあきらかに楽だ。
image.png

サンプル指標のダッシュボードを組み立てる

つぎはなにかの指標をダッシュボードで見たい
image.png

image.png

image.png

image.png

ひとまず「時系列」を選択して、指標はデフォルト system.cpu.user で save

  • Timeseries
  • system.cpu.user
    image.png

Synthetic Test を作る

つぎは HTTP テスト(200確認) だ。Syntheticモニタリングと呼称しているようだ。

image.png

  1. Digital Experience → New Test → API Test → Start from scratch
  2. 設定項目:
    • Request Type: HTTP
    • Define Request: https://www.henojiya.net/ を入力したあと Send して PASSED を確認
    • Name: Henojiya Health Check など
    • Assertions: Status Codeis 200
  3. Locations: Datadog の複数のロケーションからヘルスチェックが可能
    • → ひとまずは Tokyo(AWS) でOK
  4. Save Test

定期的にヘルスチェックしてくれるようになったが、あくまで仕組みを作っただけだ。つぎはダッシュボードから見られるようにする
image.png

HTTPテスト のダッシュボードを組み立てる

ダッシュボードリストのサンプルをcloneするとヘルスチェックをダッシュボードにのせたものが見れる!というのはなんとなくわかったものの、なぜかやり方がわからなくて数時間溶けた
image.png

  • Dashboards - Dashboard List
    image.png

  • New Dashboard
    image.png

  • New Dashboard
    image.png

  • ここかぁーい!これ見つけるの手間取ったな...つまるところ Jira でいう「マクロ」なのね。コンポジットというかkitなわけだ
    image.png
    image.png

あらかじめ指標を作っておくとすでに反映されている(60 runsのところ)
image.png
image.png

ひとまずここまででいいや:joy:

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?