diff --git "a/sig/T-One/content/\347\224\250\346\210\267\346\214\207\345\215\227/\351\203\250\347\275\262\346\211\213\345\206\214/ToneAgent\346\211\213\345\212\250\351\203\250\347\275\262.md" "b/sig/T-One/content/\347\224\250\346\210\267\346\214\207\345\215\227/\351\203\250\347\275\262\346\211\213\345\206\214/ToneAgent\346\211\213\345\212\250\351\203\250\347\275\262.md" index 5a27fe210cd252f3bb81faf7fe15b90e21689d94..af3c2ff976b395dd065d3b5e6f935c67112ce9d2 100644 --- "a/sig/T-One/content/\347\224\250\346\210\267\346\214\207\345\215\227/\351\203\250\347\275\262\346\211\213\345\206\214/ToneAgent\346\211\213\345\212\250\351\203\250\347\275\262.md" +++ "b/sig/T-One/content/\347\224\250\346\210\267\346\214\207\345\215\227/\351\203\250\347\275\262\346\211\213\345\206\214/ToneAgent\346\211\213\345\212\250\351\203\250\347\275\262.md" @@ -1,50 +1,62 @@ # 部署说明 ```markdown -1. toneagent 支持不同os、不同arch,该文档以Linux、x86_64为例 -2. 该文档以2.0.6版本为例,版本及对应的链接见文末 +该文档以2.0.8版本为例,版本及对应的链接见文末 ``` # 部署步骤 -## 1.下载 -```shell -wget https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.6-1.an8.x86_64.rpm -``` -## 2.安装 +## 1.安装 ToneAgent 服务 +注意: +1.需要保证机器能连通`anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com` + +2.需要保证机器`yum`或`dpkg`命令可用 + +3.如果该机器之前安装过 toneagent ,需要先执行`rpm -e toneagent`卸载旧版本 ```shell -yum install -y toneagent-2.0.6-1.an8.x86_64.rpm +# linux:x86_64 +wget https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.8-1.x86_64.rpm +yum install -y toneagent-2.0.8-1.x86_64.rpm + +# linux:arm64 +wget https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.8-1.aarch64.rpm +yum install -y toneagent-2.0.8-1.aarch64.rpm + +# debian:x86_64 +wget https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.8-amd64.deb +dpkg -i toneagent-2.0.8-amd64.deb + +# debian:arm64 +wget https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.8-arm64.deb +dpkg -i toneagent-2.0.8-arm64.deb ``` -## 3.配置 -**配置说明**: +## 2.配置 ToneAgent 服务 +**2.1 配置说明**: ```markdown 1. tsn: agent机器的唯一识别码。在toneagent平台添加机器后自动生成 -2. mode: agent获取执行任务的模式。acitve为主动模式;passive为被动模式。(注意:不管是哪种模式,都要跟toneagent平台的设置一致) +2. mode: agent获取执行任务的模式。acitve为主动模式;passive为被动模式。(注意:需要跟toneagent平台的设置一致) 3. proxy: toneagent平台的域名地址。社区平台地址为:https://tone-agent.openanolis.cn ``` -**配置方式**: -```markdown +**2.2 配置方式**: + toneagent支持3种配置方式: -1. 更改配置文件 -2. 使用toneagent命令 -3. 使用toneagent配置页 -``` -**配置教程** -方式一:直接更改配置文件 +a. 更改配置文件 ```shell vim /etc/toneagent/conf/toneagent.yaml ``` - -方式二:使用toneagent命令 +b. 使用toneagent命令 ```shell toneagent -set-tsn=xxx toneagent -set-mode=active toneagent -set-proxy=https://proxy1.cn ``` -方式三:使用配置页面 +c. 使用toneagent配置页 ```shell -# 浏览器访问(server_ip 为 agent 部署机的ip地址): +# 注意: +# 1. 用浏览器访问 +# 2. ${server_ip} 是当前机器的公网 ip +# 3. 需要保证8479端口可访问 http://${server_ip}:8479 ``` **登录(密码可在`/etc/toneagent/conf/app.yaml`里配置)** @@ -55,12 +67,12 @@ http://${server_ip}:8479 ![](../assets/config.png) -## 4.重启服务 +## 3.重启服务 ```shell systemctl restart toneagent ``` -## 5.检查状态及心跳 +## 4.检查状态及心跳 ```shell systemctl status toneagent ``` @@ -87,13 +99,12 @@ systemctl status toneagent **版本** ```markdown 查看当前版本:toneagent -v -查看可用版本:toneagent -l ``` **升级** ```markdown 升级到最新版本:toneagent -upgrade=latest 升级到稳定版本:toneagent -upgrade=stable -升级到指定版本:toneagent -upgrade=2.0.x +升级到指定版本:toneagent -upgrade=2.0.8 ``` **配置** ```markdown @@ -105,13 +116,12 @@ systemctl status toneagent # 版本列表 | 版本 | OS | Arch | Link | |-------|--------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------| -| 2.0.8 | Linux | x86_64 | [toneagent-2.0.8-1.x86_64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-1.x86_64.rpm) | -| 2.0.8 | Linux | aarch64 | [toneagent-2.0.8-1.aarch64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-1.aarch64.rpm) | -| 2.0.8 | Linux | riscv64 | [toneagent-2.0.8-1.aarch64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-1.riscv64.rpm) | -| 2.0.8 | Ubuntu | x86_64 | [toneagent-2.0.8-amd64.deb](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-amd64.deb) | -| 2.0.8 | Ubuntu | aarch64 | [toneagent-2.0.8-arm64.deb](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-arm64.deb) | -| 2.0.7 | Linux | x86_64 | [toneagent-2.0.7-1.x86_64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-1.x86_64.rpm) | -| 2.0.7 | Linux | aarch64 | [toneagent-2.0.7-1.aarch64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-1.aarch64.rpm) | +| 2.0.8 | Linux | x86_64 | [toneagent-2.0.8-1.x86_64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-1.x86_64.rpm) | +| 2.0.8 | Linux | aarch64 | [toneagent-2.0.8-1.aarch64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.8-1.aarch64.rpm) | +| 2.0.8 | Ubuntu | x86_64 | [toneagent-2.0.8-amd64.deb](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.8-amd64.deb) | +| 2.0.8 | Ubuntu | aarch64 | [toneagent-2.0.8-arm64.deb](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.8-arm64.deb) | +| 2.0.7 | Linux | x86_64 | [toneagent-2.0.7-1.x86_64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-1.x86_64.rpm) | +| 2.0.7 | Linux | aarch64 | [toneagent-2.0.7-1.aarch64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-1.aarch64.rpm) | | 2.0.7 | Ubuntu | x86_64 | [toneagent-2.0.7-amd64.deb](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-amd64.deb) | | 2.0.7 | Ubuntu | aarch64 | [toneagent-2.0.7-arm64.deb](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.7-arm64.deb) | | 2.0.6 | Linux | x86_64 | [toneagent-2.0.6-1.an8.x86_64.rpm](https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/rpms/toneagent-2.0.6-1.an8.x86_64.rpm) | diff --git "a/sig/T-One/content/\347\224\250\346\210\267\346\214\207\345\215\227/\351\203\250\347\275\262\346\211\213\345\206\214/ToneAgent\350\207\252\345\212\250\345\214\226\351\203\250\347\275\262.md" "b/sig/T-One/content/\347\224\250\346\210\267\346\214\207\345\215\227/\351\203\250\347\275\262\346\211\213\345\206\214/ToneAgent\350\207\252\345\212\250\345\214\226\351\203\250\347\275\262.md" index 03b6b92229aa21660f030202ef671e830800b363..83b8ad654e4508176d20ff02fb27f266b3c7d000 100644 --- "a/sig/T-One/content/\347\224\250\346\210\267\346\214\207\345\215\227/\351\203\250\347\275\262\346\211\213\345\206\214/ToneAgent\350\207\252\345\212\250\345\214\226\351\203\250\347\275\262.md" +++ "b/sig/T-One/content/\347\224\250\346\210\267\346\214\207\345\215\227/\351\203\250\347\275\262\346\211\213\345\206\214/ToneAgent\350\207\252\345\212\250\345\214\226\351\203\250\347\275\262.md" @@ -1,127 +1,12 @@ -### 自动部署 +## 自动部署 +### Linux 机器自动部署 ToneAgent 在部署机上执行如下命令: ```shell wget https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/deploy/deploy_toneagent.sh && chmod +x deploy_toneagent.sh && ./deploy_toneagent.sh -``` - -### 脚本详情 -
- 点击展开/折叠脚本 +``` +### Debian/Ubuntu 机器自动部署 ToneAgent +在部署机上执行如下命令: ```shell -#!/bin/bash - -os=$(uname -s) -arch=$(uname -m) - -domain=https://tone-agent.openanolis.cn -config_file=/etc/toneagent/conf/toneagent.yaml - -install_utils() { - yum install -y jq >/dev/null -} - -uninstall_old_version(){ - rpm -e toneagent --noscripts -} - -color_echo() { - local message=$1 - echo -e "\033[0;32m${message}\033[0m" -} - -get_version_link() { - if [ "$version" = "latest" ]; then - is_new=1 - is_stable="" - version="" - elif [ "$version" = "stable" ]; then - is_new="" - is_stable=1 - version="" - else - is_new="" - is_stable="" - version=$version - fi - - # 调用API获取需要安装的版本 - api_url="$domain/v1/agent/version/manage?is_deleted=0&os=$os&arch=$arch&is_new=$is_new&is_stable=$is_stable&version=$version" - api_response=$(curl -s "$api_url") - if ! echo "$api_response" | jq -e . >/dev/null 2>&1; then - echo "获取版本失败:$api_response" - exit - fi - - array_length=$(echo "$api_response" | jq '.data | length') - # 判断数组长度是否为0 - if [ "$array_length" -eq 0 ]; then - echo "无可用版本,请检查指定版本是否正确" - exit - fi - - # 解析API响应,获取版本链接 - version_link=$(echo "$api_response" | jq -r '.data[0].link') - version=$(basename "$version_link") - - if [ $? -eq 0 ]; then - echo "The $version version is $version" - else - echo "Upgrade failed" - exit - fi - echo -e "\e[1;install toneagent(version:$version)\e[0m" -} - -install_agent() { - wget $version_link - yum install -y ./$version - if [ $? -eq 0 ]; then - echo "install toneagent success" - else - echo "install toneagent failed" - fi -} - -modify_config(){ - echo -e "tsn: $tsn\nmode: $mode\nproxy: $proxy" > $config_file - if [ $? -ne 0 ]; then - echo "[log]modify toneagent configuration failed..." - exit 1 - fi - systemctl restart toneagent -} - -############################################################################# -color_echo "请输入要部署的版本(如:2.0.6 ; 默认为:latest):" -read version -if [ -z "$version" ]; then - version=latest -fi - -color_echo "请输入机器的TSN(在ToneAgent平台添加机器后获取; 如需安装之后再修改直接回车):" -read tsn -if [ -z "$tsn" ]; then - tsn= -fi - -color_echo "请输入Agent Mode(默认为:active):" -read mode -if [ -z "$mode" ]; then - mode=active -fi - -color_echo "请输入ToneAgent Proxy地址(默认为:https://tone-agent.openanolis.cn):" -read proxy -if [ -z "$proxy" ]; then - proxy=https://tone-agent.openanolis.cn -fi - -uninstall_old_version -install_utils -get_version_link -install_agent -modify_config -toneagent -v -``` -
+wget https://anolis-service-pub.oss-cn-zhangjiakou.aliyuncs.com/biz-resource/tone/deploy/deploy_toneagent_debian.sh && chmod +x deploy_toneagent_debian.sh && ./deploy_toneagent_debian.sh +``` \ No newline at end of file