# Application Study Tool vm **Repository Path**: f5-dev-ops/application-study-tool-vm ## Basic Information - **Project Name**: Application Study Tool vm - **Description**: A vm image for Application Study Tool. AST(Application Study Tool)的虚拟机镜像。 - **Primary Language**: Shell - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2024-12-16 - **Last Updated**: 2025-04-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Application Study Tool VM User Guide #### 描述 Description A vm image for Application Study Tool. AST(Application Study Tool)的虚拟机镜像。 #### 安装 Installation 1. 获取虚拟机镜像ova文件。Acquire the ova image of the VM. 2. 将ova文件导入虚机或私有云平台。Import the ova into a hypervisor or private cloud. 3. 拉起虚拟机,登录用户名:ast, 密码:F5networks,修改相关配置。Spin up the VM and modify the relevant configuration. Username: ast, Password: F5networks. 4. 使用`docker-compose` 拉起演示环境。Spin up the demo environment with docker-compose. #### 安装指导 Instructions ##### 参考相关文档导入 VM ##### 拉起虚拟机后进行相关配置的修改 1. 检测相关所需容器镜像是否存在。 ```bash ast@astdemo:~$ ast@astdemo:~$ ast@astdemo:~/application-study-tool$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ghcr.io/f5devcentral/application-study-tool/otel_custom_collector v0.7.0 dc61867f7f68 8 weeks ago 114MB python 3.12.6-slim-bookworm 86b8b6de4ba2 3 months ago 124MB grafana/grafana 11.2.0 de903bc9ce7c 3 months ago 478MB prom/prometheus v2.54.1 4022a502929b 3 months ago 275MB ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ``` 正常情况下,虚机中应已存在上述4个容器镜像。 如镜像缺失,则通过下列命令导入相关容器镜像。 ```bash ast@astdemo:~$ ast@astdemo:~$ ls -l total 303136 drwxrwxr-x 9 ast ast 4096 Dec 16 05:52 application-study-tool -rw------- 1 ast ast 127056718 Dec 16 09:47 grafana1120.tar.gz -rw------- 1 ast ast 31343985 Dec 16 09:47 otel_collector.tar.gz -rw------- 1 ast ast 107056983 Dec 16 09:48 prometheus2541.tar.gz -rw------- 1 ast ast 44940989 Jan 21 08:33 python.tar.gz drwx------ 3 ast ast 4096 Dec 16 02:32 snap ast@astdemo:~$ ast@astdemo:~$ docker load -i python.tar.gz 8d853c8add5d: Loading layer [==================================================>] 77.83MB/77.83MB 462eacda1a69: Loading layer [==================================================>] 9.551MB/9.551MB 6102c39d73fe: Loading layer [==================================================>] 41.35MB/41.35MB e2bc26829d40: Loading layer [==================================================>] 5.12kB/5.12kB Loaded image: python:3.12.6-slim-bookworm ast@astdemo:~$ ast@astdemo:~$ ast@astdemo:~$ ast@astdemo:~$ docker load -i grafana1120.tar.gz d4fc045c9e3a: Loading layer [==================================================>] 7.667MB/7.667MB 89b7e78c1264: Loading layer [==================================================>] 2.56kB/2.56kB 63c0e4417684: Loading layer [==================================================>] 8.806MB/8.806MB de6ac4ba26dc: Loading layer [==================================================>] 9.713MB/9.713MB 6523361408ca: Loading layer [==================================================>] 190kB/190kB 11f6d7670b43: Loading layer [==================================================>] 104.4kB/104.4kB 6271cd8eca5a: Loading layer [==================================================>] 244.4MB/244.4MB 4beb5a56ae2e: Loading layer [==================================================>] 215.2MB/215.2MB 9c67d537403a: Loading layer [==================================================>] 37.89kB/37.89kB e7392c8d1dd0: Loading layer [==================================================>] 5.12kB/5.12kB Loaded image: grafana/grafana:11.2.0 ast@astdemo:~$ ast@astdemo:~$ ast@astdemo:~$ docker load -i otel_collector.tar.gz Loaded image: ghcr.io/f5devcentral/application-study-tool/otel_custom_collector:v0.7.0 ast@astdemo:~$ docker load -i prometheus2541.tar.gz 1e604deea57d: Loading layer [==================================================>] 1.458MB/1.458MB 6b83872188a9: Loading layer [==================================================>] 2.455MB/2.455MB 405a8b5041f1: Loading layer [==================================================>] 140.1MB/140.1MB 6dfd7aef3fcd: Loading layer [==================================================>] 131.8MB/131.8MB 8459ad25bfbd: Loading layer [==================================================>] 3.584kB/3.584kB 6cd41730d304: Loading layer [==================================================>] 13.82kB/13.82kB dc12aa49f027: Loading layer [==================================================>] 28.16kB/28.16kB f61f35ce8414: Loading layer [==================================================>] 13.31kB/13.31kB 89911f5a9a27: Loading layer [==================================================>] 5.632kB/5.632kB e3df5cefd22c: Loading layer [==================================================>] 139.8kB/139.8kB 64d73d1a1b52: Loading layer [==================================================>] 1.536kB/1.536kB b4d8bcc5b63b: Loading layer [==================================================>] 6.144kB/6.144kB Loaded image: prom/prometheus:v2.54.1 ast@astdemo:~$ ast@astdemo:~$ ast@astdemo:~$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ghcr.io/f5devcentral/application-study-tool/otel_custom_collector v0.7.0 dc61867f7f68 3 months ago 114MB python 3.12.6-slim-bookworm 86b8b6de4ba2 4 months ago 124MB grafana/grafana 11.2.0 de903bc9ce7c 4 months ago 478MB prom/prometheus v2.54.1 4022a502929b 4 months ago 275MB ast@astdemo:~$ ``` 2. 修改环境参数 查看 .env 文件中 Grafana 的默认用户名和密码信息,建议按需修改。 ```bash ast@astdemo:~$ cd application-study-tool/ ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ cat .env # Grafana Environment Variables # These should be updated to more secure values outside of testing environments. GF_SECURITY_ADMIN_USER=admin GF_SECURITY_ADMIN_PASSWORD=admin # Optional Parameters Required for metrics export to F5 DataFabric SENSOR_SECRET_TOKEN="YOUR_TOKEN" SENSOR_ID="YOUR_ID" ``` 查看默认的 BIGIP api 访问密码,建议按需修改: ```bash ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ cat .env.device-secrets # Names here are arbitrary, but must match values in big-ips.json. # Passwords can be referenced by many devices (you do not need a unique variable for each device). BIGIP_PASSWORD_1=admin BIGIP_PASSWORD_2=ANOTHER_SECRET_PASSWORD ast@astdemo:~/application-study-tool$ ``` 查看默认的 BIGIP 配置信息,例如默认用户名为 admin,建议按需修改。 ```bash ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ cat ./config/ast_defaults.yaml # These configs are applied to each entry in the bigip_receivers file # where they don't contain an equivalent / overriding entry. bigip_receiver_defaults: # The time to wait between metric collection runs collection_interval: 60s # The username to login to the device with username: admin # The password (not recommended) or a reference to an env variable (recommended, shown) # Below tells the collector to look for an environment variable named BIGIP_PASSWORD_1 password: "${env:BIGIP_PASSWORD_1}" # The timeout field can be used to adjust the amount of time the collector will wait for a response # to BigIP iControl Rest requests. Larger boxes with more complex config may require setting this value # higher. Set for individual devices in bigip_receivers.yaml timeout: 10s # The data_types that should be enabled or disabled. DNS and GTM users can enable those modules # by setting the below to true. These will apply to all devices and may be better specified on the # per-reciever settings file below. data_types: f5.dns: enabled: true f5.gtm: enabled: true # The TLS settings to use. Either a CA file must be specified or insecure_skip_verify # set to true (not recommended) tls: insecure_skip_verify: true ca_file: "" # Set to true to enable periodic metric export to F5 DataFabric. # Requires adding your Sensor ID and secret token to the container environment (see .env-example). # Contact your F5 sales rep to obtain the ID / secret token. f5_data_export: false # Most people should not need to modify settings below this line # The default local pipeline to use if one isn't specified in the per-device configs. pipeline_default: metrics/local # The default pipeline to use if metric export to F5 is enabled (if f5_data_export.sensor_id field above is set) f5_pipeline_default: metrics/f5-datafabric pipelines: # These pipeline configs are written to the OTEL config after having the configured receivers # added to the dictionary in accordance with the "pipeline_default" field above and "pipeline" # field on the per-receiver config file. Otel Collector documentation explains the syntax in more # detail. metrics/local: #receivers list are generated via the config helper script processors: [batch/local] exporters: [otlphttp/metrics-local, debug/bigip] # These pipeline configs are written to the OTEL config after having the configured receivers # added to the dictionary in accordance with the "f5_pipeline_default" field above and "f5_pipeline" # field on the per-receiver config file. Otel Collector documentation explains the syntax in more # detail. metrics/f5-datafabric: #receivers list are generated via the config helper script processors: [interval/f5-datafabric, attributes/f5-datafabric, batch/f5-datafabric] exporters: [otlp/f5-datafabric, debug/bigip] ast@astdemo:~/application-study-tool$ ``` 3. 修改监控的 BIG-IP 清单 示例中已经已经配置有2台 BIG-IP,建议按需修改或增减 endpoint url。 ```bash ast@astdemo:~/application-study-tool$ cat ./config/bigip_receivers.yaml # Your bigip targets # Values not explicitly configured here inherit values in # the ast_defaults.yaml bigip_receiver_defaults section. # Each entry must have a unique name, starting with bigip/ # (e.g. bigip/1, bigip/2) bigip/1: # Endpoint must be specified for each device # Set this to the management IP for the device. This must be # reachable from the Application Study Tool host. endpoint: https://192.168.211.69 ## Uncommenting any of the following lines will override the defaults in ## ast_defaults.yaml bigip_receiver_defaults section. # username: SOME_OVERRIDE_ACCOUNT_NAME # password: "${SOME_OTHER_ENV_VAR_WITH_ANOTHER_PASSWORD}" # collection_interval: 30s # timeout: 20s # data_types: # f5.dns: # enabled: false # f5.gtm: # enabled: false # tls: # insecure_skip_verify: true # ca_file: # bigip/2: # Endpoint must be specified for each device # Set this to the management IP for the device. This must be # reachable from the Application Study Tool host. endpoint: https://192.168.211.70 ## Uncommenting any of the following lines will override the defaults in ## ast_defaults.yaml bigip_receiver_defaults section. # username: SOME_OVERRIDE_ACCOUNT_NAME # password: "${SOME_OTHER_ENV_VAR_WITH_ANOTHER_PASSWORD}" # collection_interval: 30s # timeout: 20s # data_types: # f5.dns: # enabled: false # f5.gtm: # enabled: false # tls: # insecure_skip_verify: true # ca_file: ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ``` 4. 创建 OTEL 配置 完成 BIG-IP 清单更新后,运行下列命令创建 OTEL 配置文件: ```bash ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ docker run --rm -it -w /app -v ${PWD}:/app --entrypoint /app/src/bin/init_entrypoint.sh python:3.12.6-slim-bookworm --generate-config Unable to find image 'python:3.12.6-slim-bookworm' locally 3.12.6-slim-bookworm: Pulling from library/python 302e3ee49805: Pull complete 699edf835b1b: Pull complete 417a872b7725: Pull complete 9795987f6d21: Pull complete Digest: sha256:ad48727987b259854d52241fac3bc633574364867b8e20aec305e6e7f4028b26 Status: Downloaded newer image for python:3.12.6-slim-bookworm Collecting PyYAML==6.0.2 Downloading PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB) Downloading PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (767 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 767.5/767.5 kB 2.0 MB/s eta 0:00:00 Installing collected packages: PyYAML Successfully installed PyYAML-6.0.2 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning. [notice] A new release of pip is available: 24.2 -> 24.3.1 [notice] To update, run: pip install --upgrade pip 2024-12-16 05:55:38,008 - INFO - Generating configs from ./config/ast_defaults.yaml and ./config/bigip_receivers.yaml... 2024-12-16 05:55:38,008 - INFO - Loading AST Default Settings in ./config/ast_defaults.yaml... 2024-12-16 05:55:38,010 - INFO - Successfully loaded './config/ast_defaults.yaml'. 2024-12-16 05:55:38,011 - INFO - Loading Per-Receiver (BigIP) Settings in ./config/bigip_receivers.yaml... 2024-12-16 05:55:38,012 - INFO - Successfully loaded './config/bigip_receivers.yaml'. 2024-12-16 05:55:38,012 - INFO - Generating receiver configs... 2024-12-16 05:55:38,012 - INFO - Generating pipeline configs... 2024-12-16 05:55:38,012 - WARNING - The f5_data_export=true and f5_pipeline_default fields are required to export metrics periodically to F5. Contact your F5 Sales Rep to provision a Sensor ID and Access Token. 2024-12-16 05:55:38,012 - INFO - Built the following pipeline file: metrics/local: exporters: - otlphttp/metrics-local - debug/bigip processors: - batch/local receivers: - bigip/1 - bigip/2 2024-12-16 05:55:38,013 - INFO - Built the following receiver file: bigip/1: collection_interval: 60s data_types: f5.dns: enabled: true f5.gtm: enabled: true endpoint: https://192.168.211.69 password: ${env:BIGIP_PASSWORD_1} timeout: 10s tls: ca_file: '' insecure_skip_verify: true username: admin bigip/2: collection_interval: 60s data_types: f5.dns: enabled: true f5.gtm: enabled: true endpoint: https://192.168.211.70 password: ${env:BIGIP_PASSWORD_1} timeout: 10s tls: ca_file: '' insecure_skip_verify: true username: admin 2024-12-16 05:55:38,014 - INFO - Successfully wrote data to './services/otel_collector/pipelines.yaml'. 2024-12-16 05:55:38,015 - INFO - Successfully wrote data to './services/otel_collector/receivers.yaml'. ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ``` **注:已知问题,已修复。请使用最新版本的 ova 文件** 如果运行 python 创建 otel 配置失败,亦可直接修改上述两个配置文件(`./services/otel_collector/pipelines.yaml` 和 `./services/otel_collector/receivers.yaml`)中的 BIG-IP 地址,增减 BIG-IP endpoint 来实现 OTEL 配置的更新,同样可以顺利进行下一步操作。 5. 拉起容器镜像 完成上述操作后,即可使用 `docker-compose` 命令拉起演示环境。 ```bash ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ docker-compose up -d [+] Running 4/4 ✔ Network application-study-tool_7lc_network Created 0.1s ✔ Container application-study-tool-otel-collector-1 Started 0.0s ✔ Container grafana Started 0.1s ✔ Container prometheus Started 0.1s ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6f14f1e5fb7e grafana/grafana:11.2.0 "/run.sh" 8 seconds ago Up 8 seconds 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp grafana befe33f1c55e prom/prometheus:v2.54.1 "/bin/prometheus --c…" 8 seconds ago Up 8 seconds 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp prometheus 6aa2c0286c99 ghcr.io/f5devcentral/application-study-tool/otel_custom_collector:v0.7.0 "/otelcol-custom --c…" 8 seconds ago Up 8 seconds 4317/tcp, 55679-55680/tcp application-study-tool-otel-collector-1 ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ``` 上述3个容器正常启动后,即可访问 Grafana Dashboard。 6. 访问Grafana Dashboard 使用浏览器访问 AST 服务器IP地址的端口 3000 `http://ast-ip:3000` 即可打开 Grafana 的 Dashboard。 默认用户名为 admin 默认密码为 admin #### 关闭 AST 演示环境 演示结束后,可以通过下列命令关闭演示环境。 ```bash ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ docker-compose down [+] Running 4/4 ✔ Container prometheus Removed 0.3s ✔ Container grafana Removed 0.3s ✔ Container application-study-tool-otel-collector-1 Removed 0.1s ✔ Network application-study-tool_7lc_network Removed 0.2s ast@astdemo:~/application-study-tool$ ast@astdemo:~/application-study-tool$ ``` #### 问题反馈 如遇问题,请直接在 repo 上提交 issue。 谢谢!