在 Amazon Elastic Container Service (ECS) 上安裝主機代理程式

若要使用 ECS 常駐程式排程,將主機代理程式安裝至在 Elastic Computing (EC2) 上執行的 Elastic Container Service (ECS) 叢集,請遵循步驟。

如需 AWS ECS 上的 Fargate ,請參閱 Fargate 監視 文件。

使用 EC2 使用者資料來部署主機代理程式

附註: 這是在 EC2 叢集上跨 ECS 部署主機代理程式的偏好機制。

啟動 Amazon ECS 儲存器實例 文件顯示如何在新的 EC2 實例上使用「使用者資料」,以在 EC2 叢集上為您的 ECS 提供動力。

Instana 的 監視 AWS EC2 實例 說明文件中說明的機制也適用於這個使用案例。

使用 ECS 作業定義來部署主機代理程式

必要欄位

若要讓 Instana 正確監視 Java ® 應用程式, 需要 下列設定:

{
    "ipcMode": "host",
    "pidMode": "host",
    "privileged": true,
    "networkMode": "host",
    ...
}

範例

請參閱下列 JSON 範例。 部署主機代理程式時,您可以修改 JSON 檔案以符合您的需求。

附註: 您需要修改的欄位會標示為 <required>。 您必須將 <required> 欄位設為字串。

{
    "ipcMode": "host",
    "executionRoleArn": null,
    "containerDefinitions": [
        {
            "dnsSearchDomains": null,
            "logConfiguration": {
                "logDriver": "json-file"
            },
            "entryPoint": null,
            "portMappings": [],
            "command": null,
            "linuxParameters": null,
            "environment": [
                {
                    "name": "INSTANA_AGENT_ENDPOINT",
                    "value": <required>
                },
                {
                    "name": "INSTANA_AGENT_ENDPOINT_PORT",
                    "value": <required>
                },
                {
                    "name": "INSTANA_AGENT_KEY",
                    "value": <required>
                }
            ],
            "ulimits": null,
            "dnsServers": null,
            "mountPoints": [
                {
                    "readOnly": false,
                    "containerPath": "/var/run",
                    "sourceVolume": "var_run"
                },
                {
                    "readOnly": false,
                    "containerPath": "/run",
                    "sourceVolume": "run"
                },
                {
                    "readOnly": false,
                    "containerPath": "/sys",
                    "sourceVolume": "sys"
                },
                {
                    "readOnly": false,
                    "containerPath": "/dev",
                    "sourceVolume": "dev"
                },
                {
                    "readOnly": false,
                    "containerPath": "/var/log",
                    "sourceVolume": "log"
                }
            ],
            "workingDirectory": null,
            "secrets": null,
            "dockerSecurityOptions": null,
            "memory": <required>,
            "volumesFrom": null,
            "image": <required: the image used to start your container. Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed.>,
            "disableNetworking": null,
            "interactive": null,
            "healthCheck": null,
            "essential": true,
            "links": null,
            "hostname": null,
            "extraHosts": null,
            "pseudoTerminal": null,
            "user": null,
            "readonlyRootFilesystem": null,
            "dockerLabels": null,
            "systemControls": null,
            "privileged": true,
            "name": <required: the name of a container. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.>,
            "repositoryCredentials": {
                "credentialsParameter": ""
            }
        }
    ],
    "placementConstraints": [],
    "memory": <required>,
    "taskRoleArn": "",
    "family": <required: specify a name for your task definition. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.>,
    "pidMode": "host",
    "requiresCompatibilities": [
        "EC2"
    ],
    "networkMode": "host",
    "cpu": "<Required>",
    "volumes": [
        {
            "name": "dev",
            "host": {
                "sourcePath": "/dev"
            },
            "dockerVolumeConfiguration": null
        },
        {
            "name": "sys",
            "host": {
                "sourcePath": "/sys"
            },
            "dockerVolumeConfiguration": null
        },
        {
            "name": "var_run",
            "host": {
                "sourcePath": "/var/run"
            },
            "dockerVolumeConfiguration": null
        },
        {
            "name": "run",
            "host": {
                "sourcePath": "/run"
            },
            "dockerVolumeConfiguration": null
        },
        {
            "name": "log",
            "host": {
                "sourcePath": "/var/log"
            },
            "dockerVolumeConfiguration": null
        }
    ]
}

檢查主機代理程式的狀態

安裝主機代理程式之後,您可以在 Instana 使用者介面或主機上檢查主機代理程式的狀態。 如需相關資訊,請參閱 檢查主機代理程式的狀態