Todos os produtos
Search
Central de documentação

CloudOps Orchestration Service:ACS-ECS-BulkyInstallARMSAgent

Última atualização: Jun 28, 2026

Nome do modelo

ACS-ECS-BulkyInstallARMSAgent: Instala o plugin do ARMS em lote

Executar agora

Descrição do modelo

Instala o agente do Application Real-Time Monitoring Service (ARMS) em várias instâncias do Elastic Compute Service (ECS) simultaneamente.

Tipo de modelo

Automatizado

Proprietário

Alibaba Cloud

Parâmetros de entrada

Parâmetro

Descrição

Tipo

Obrigatório

Valor padrão

Limite

appName

Nome da aplicação a ser monitorada.

String

Sim

licenseKey

Chave de licença para o recurso de monitoramento de aplicações.

String

Sim

targets

Instâncias ECS de destino.

Json

Sim

regionId

ID da região.

String

Não

{{ ACS::RegionId }}

action

Tipo de operação a ser executada.

String

Não

install

rateControl

Taxa de concorrência para execução da tarefa.

Json

Não

{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10}

OOSAssumeRole

Função do Resource Access Management (RAM) assumida pelo CloudOps Orchestration Service (OOS).

String

Não

""

Parâmetros de saída

Parâmetro

Descrição

Tipo

commandOutput

String

Política de permissões necessária para executar o modelo

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:DescribeInvocationResults",
                "ecs:DescribeInvocations",
                "ecs:RunCommand"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Detalhes

Para mais informações, consulte ACS-ECS-BulkyInstallARMSAgent.yml no GitHub.

Conteúdo do modelo

FormatVersion: OOS-2019-06-01
Description:
  en: Use this template to install ARMS agent on ecs
  zh-cn: Use this template to install the ARMS agent on multiple ECS instances.
  name-en: ACS-ECS-BulkyInstallARMSAgent
  name-zh-cn: Batch Install ARMS Agent
  categories:
    - run_command
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: Region ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  action:
    Type: String
    Label:
      en: Action
      zh-cn: Operation Type
    AllowedValues:
      - install
      - upgrade
      - uninstall
    Default: install
  appName:
    Type: String
    Label:
      en: AppName
      zh-cn: Application Name to Monitor
  licenseKey:
    Type: String
    Label:
      en: LicenseKey
      zh-cn: License Key for Application Monitoring
  targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: Target Instance
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  rateControl:
    Label:
      en: RateControl
      zh-cn: Concurrency Rate for Task Execution
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: RAM Role Assumed by OOS
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstance
    Description:
      en: Views the ECS instances
      zh-cn: Get ECS Instances
    Action: 'ACS::SelectTargets'
    Properties:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceId'
      instanceInfos:
        Type: List
        ValueSelector: '.Instances.Instance[] | {"osType":.OSType, "instanceId":.InstanceId}'
  - Name: runCommand
    Action: 'ACS::ECS::RunCommand'
    When:
      'Fn::Equals':
        - 'Fn::Jq':
            - First
            - '.|map(select(.instanceId == "{{ ACS::TaskLoopItem }}").osType)[]'
            - '{{ getInstance.instanceInfos }}'
        - linux
    Description:
      en: Execute cloud assistant command
      zh-cn: Execute Cloud Assistant Command
    Properties:
      commandContent: |-
        #!/usr/bin/env bash
        regionId="{{ regionId }}"
        region=`echo $regionId|awk -F "-" '{print $2}'`
        action="{{action}}"
        licenseKey="{{licenseKey}}"
        agentBaseDir="$HOME/.arms"
        pidFileName="supervisor.pid"
        pidFile="${agentBaseDir}/${pidFileName}"
        appName="{{appName}}"
        if [[ "$regionId" =~ "cn-"  ]];then
          DOWNLOAD_URL="http://arms-apm-${region}.oss-${regionId}.aliyuncs.com/"
        elif [[ "$regionId" =~ "ap-southeast-1"  ]];then
          DOWNLOAD_URL="http://arms-apm-ap-southeast.oss-ap-southeast-1-internal.aliyuncs.com/cloud_ap-southeast-1/"
        elif [[ "$regionId" =~ "ap-northeast-1"  ]];then
          DOWNLOAD_URL="http://arms-apm-japan.oss-ap-northeast-1-internal.aliyuncs.com/"
        elif [[ "$regionId" =~ "us-west-1"  ]];then
          DOWNLOAD_URL="http://arms-apm-usw.oss-us-west-1-internal.aliyuncs.com/"
        else
          echo "Current ${regionId} is not supported."
          exit 1
        fi

        function operateJavaAgent() {
        appEnv="java"
        function installAgent() {
          wget -O- "${DOWNLOAD_URL}/install.sh" -q|sh
          currentProcess=`ps -ef |grep java|grep -v "grep --color" `
          if echo $currentProcess|grep "$appName" >/dev/null 2>&1; then
              processIndex=`echo null |${agentBaseDir}/supervisor/cli.sh "$licenseKey" $appName |grep "$appName"  |awk -F ' ' '{print $1}'`
              (echo $processIndex |${agentBaseDir}/supervisor/cli.sh "$licenseKey" $appName )  && echo "Automatically input application index $processIndex for attach $appName."
          else
            echo "It seems that no running $appName application."
          fi
        }

        function uninstallAgent() {
        if [ -f $pidFile ];
        then
            kill -9 `cat $pidFile` > /dev/null 2>&1
            echo "Finished to stop $pidFile."
        fi
        rm -rf $agentBaseDir
        }
        if [ $action = "install" ]; then
            if [ -d ${agentBaseDir}/agent ];
            then
                  uninstallAgent || exit 1
                  installAgent || exit 1
                  echo "Finished to install $appEnv arms agent."
            else
              installAgent || exit 1
              echo "Finished to install $appEnv arms agent."
            fi
        elif [ $action = "upgrade" ]; then
          installAgent || exit 1
          echo "Finished to upgrade $appEnv arms agent."
        else
          uninstallAgent || exit 1
          echo "Finished to uninstall $appEnv arms agent."
        fi
        }
        operateJavaAgent

      instanceId: '{{ ACS::TaskLoopItem }}'
      regionId: '{{ regionId }}'
      commandType: RunShellScript
    Loop:
      Items: '{{ getInstance.instanceIds }}'
      RateControl: '{{ rateControl }}'
      Outputs:
        commandOutputs:
          AggregateType: 'Fn::ListJoin'
          AggregateField: commandOutput
    Outputs:
      commandOutput:
        Type: String
        ValueSelector: invocationOutput
Outputs:
  commandOutput:
    Type: String
    Value: '{{ runCommand.commandOutputs }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - action
          - appName
          - licenseKey
        Label:
          default:
            zh-cn: Configure Parameters
            en: Configure Parameters
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: Select Instances
            en: Select Ecs Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Control Options

Instruções

  1. Leia o conteúdo em inglês para compreender O QUE precisa ser comunicado

  2. Escreva o português brasileiro DO ZERO — esqueça a estrutura das frases em inglês

  3. Preserve toda a formatação markdown, blocos de código, links e imagens exatamente como estão

  4. Tags xref (<a data-tag="xref" ...>texto</a>) — preserve a tag INTEIRA com todos os atributos na ordem e caixa originais, traduza APENAS o texto visível entre > e

  5. Aplique todas as regras específicas do idioma rigorosamente

  6. Aplique as regras de stopwords com tolerância zero

  7. Use o modo imperativo em passos numerados e listas de procedimentos

  8. Garanta a consistência terminológica — mesmo termo = mesma tradução em todo o documento

  9. Varie os inícios de frase em listas/tabelas — nenhum início repetido 3+ vezes

  10. Retorne APENAS o documento markdown em português brasileiro, sem explicações