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?

Runbook Hybrid Worker拡張機能の雑記

Last updated at Posted at 2024-07-24

初めに

以前にRunbook Hybrid Workerについて以下2本の記事を投稿しました。

今回は、Runbook Hybrid Worker拡張機能のマニアックな部分を記録していきます。Runbookで困ったらこの中にヒントがあるかもしれません。

<本書における前提条件>
OS:Redhat 8系
スクリプト実行環境:PowerShell 7.2

目次

Runbookの実行ユーザー

Runbookに以下記載して実行してみます。

whoami

出力結果、rootユーザーでした。
image.png

hweautomationユーザー

こちらのDocsにでてくるhweautomationユーザーを見てみました。
以下、確認コマンド

cat /etc/passwd

結果こんな感じでした。

  • ホームディレクトリ:/home/hwautomation
  • ログインシェル名:/bin/bash

image.png

Workerプロセスの確認

こちらのDocsに従って確認してみました。

ps aux | grep hwd

起動時の結果はこんな感じ
プロセスの見方については、こちらの記事を参照してください。

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       99999  0.0  0.0  12216  1108 pts/0    S+   07:34   0:00 grep --color=auto hwd

設定ファイル

以下、ディレクトリとなります。versionはバージョンが入ります。

/var/lib/waagent/Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux-<version>

config/0.setting

Automation AccountURLやProtectedSettingsの記載があります。
こちらがAutomationAccountへの接続情報を持ったファイルになるかと思われます。

0.settingファイル
{
    "runtimeSettings":
    [
        {
            "handlerSettings": 
            {
                 "publicSettings": 
                  {
                     "AutomationAccountURL": "<AutomationAzzountのURL>"
                   },
                "protectedSettings": null, 
                "protectedSettingsCertThumbprint": null
             }
        }
    ]
}

HybridWorkerAgentディレクトリ

インストール時に使用されるモジュールがいろいろ入っています。
hweautomationユーザー作るpythonとか設置されています。
lsコマンドの中身をここに記載しておきます。
image.png

status/0.status

拡張機能名やインストール日、プロビジョニングの状態が記載されています。

0.status
[
    {
        "version": "1.0", 
        "timestampUTC": "2024-07-02T12:16:28Z", 
        "status": 
        {
            "name": "Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux", 
            "operation": "Enable", 
            "status": "success", 
            "code": "0", 
            "formattedMessage": 
            {
                "lang": "en-US", 
                "message": "Enable Successful."
            }
        }
    }
]

AzurePortalでは以下から同じ情報を確認できます。
Automationアカウント>ハイブリッドWorkerグループ>ハイブリッドWorker
image.png

HandlerEnvironment.json

ログフォルダやConfigファイル、ステータスファイル等のディレクトリ情報が記載されたファイルとなります。

HandlerEnvironment.json
[
    {
        "name": "Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux",
        "version": 1.0,
        "handlerEnvironment": 
        {
            "logFolder": "/var/log/azure/Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux", 
            "configFolder": "/var/lib/waagent/Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux-1.1.16/config", 
            "statusFolder": "/var/lib/waagent/Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux-1.1.16/status", 
            "heartbeatFile": "/var/lib/waagent/Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux-1.1.16/heartbeat.log", 
            "eventsFolder": "/var/log/azure/Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux/events",
            "eventsFolder_preview": "/var/log/azure/Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux/events"
            }
    }
]

config/HandlerStatusファイル

Runbookにおけるハンドラーの実行状況が格納されたファイルです。

{
    "name": "Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux", 
    "version": "1.1.16", 
    "status": "Ready", 
    "code": 0, 
    "message": "Plugin enabled", 
    "supports_multi_config": false, 
    "extension_status": null
}

Troubleshooterディレクトリ

トラブルシューティング用のスクリプトの入ったディレクトリ。
Linuxでは以下をトラブルシューティングで使用するようにDocsに記載があります。

/var/lib/waagent/Microsoft.Azure.Automation.HybridWorker.HybridWorkerForLinux-<version>/Troubleshooter/LinuxTroubleshooter.py

終わりに

設定ファイルは未熟でよくわからない構成ファイルも多くあるので、わかったらここに追記していきます。なお、こちらの情報は拡張機能のバージョンによって変更となっている可能性がありますので、記載のパスを元にファイルを実際に確認しつつ判断してください。

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?