LoginSignup
1
0

More than 3 years have passed since last update.

GCP Stackdriver Agent 起動が失敗するケース Marketplace 経由で作成したVMは注意

Last updated at Posted at 2019-05-25

@koshi_life です。

最近 Stackdriver Monitoring を使い始めました。

公式ガイドに従い、GCE VMインスタンスにAgent導入したが、メトリクスが送信できたインスタンス、されないインスタンスがあり、ハマったので備忘です。

事象

GCEのVMインスタンスに手順通り、Monitoring Agentをインストールしたが、メトリクスが送信されていないインスタンスがあった。

Monitoring Agent のログ

Agentのインストール時に関連ログは /var/log/syslog に吐かれると出力されたので確認した。1


May 24 06:04:07 {VM_NAME} systemd[1]: Starting LSB: start and stop Stackdriver Agent...
May 24 06:04:07 {VM_NAME} stackdriver-agent[26346]: mesg: ttyname failed: Inappropriate ioctl for device
May 24 06:04:07 {VM_NAME} stackdriver-agent[26346]: Starting Stackdriver metrics collection agent: stackdriver-agentDisabled via metadata ... (warning).
May 24 06:04:07 {VM_NAME} stackdriver-agent[26346]:  (warning).

Starting Stackdriver metrics collection agent: stackdriver-agentDisabled via metadata ... (warning).

この1行に注目すると、Agentサービスの起動に失敗していることが判明。

原因

エージェントのインストールのトラブルシューティングより

再起動に失敗し、ログ出力に「Disabled via metadata」と表示されている場合、Cloud Marketplace からのイメージを実行している可能性があります。Cloud Marketplace では Monitoring エージェントがデフォルトで無効になっています。

エージェントがメタデータによって無効化されている場合は、エージェントを再インストールしてください。

当該インスタンスは Cloud Marketplace を使って作成したインスタンスだったので、まさにこれだった。

対応

  • 当該インスタンスの詳細画面で Stackdriver Monitoring APIの権限設定を確認。無効になっていたので、書き込み権限を付与した。
    Screen Shot 2019-05-25 at 22.30.29.png
  • Stackdriver Agent を再インストール

これでAgentから各種メトリクスがStackdriverコンソールで確認できるようになり解決しました。

GCPはドキュメントが充実していますね。有り難いです。


  1. 2019/05/24にDebian系のディストリビューションにインストールした時の振る舞い。 

1
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
1
0