run-system-diagnostics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ACB System Diagnostics

ACB系统诊断

This skill checks if the user's system meets the minimum specifications for Anypoint Code Builder and applies necessary Windows optimizations.
本技能用于检查用户系统是否满足Anypoint Code Builder的最低规格要求,并应用必要的Windows优化措施。

Minimum Specifications

最低规格要求

  • CPU: 8 cores/8 vCPU
  • RAM: 32GB
  • Storage Type: NVMe SSD (PCIe 3.0+)
  • Free Disk Space: 50GB
  • Network Speed: 1Gbps
  • CPU:8核/8 vCPU
  • 内存(RAM):32GB
  • 存储类型:NVMe SSD(PCIe 3.0+)
  • 可用磁盘空间:50GB
  • 网络速度:1Gbps

Steps

步骤

Step 1: Detect Operating System

步骤1:检测操作系统

  • Identify if the user is on Windows, macOS, or Linux
  • 识别用户使用的是Windows、macOS还是Linux系统

Step 2: Gather System Information

步骤2:收集系统信息

  • CPU: Number of cores/vCPUs
  • RAM: Total memory in GB
  • Storage Type: Verify the storage uses NVMe standard (must be NVMe, not SATA SSD or HDD)
  • Free Disk Space: Available space in GB
  • Network Speed: Network interface speed
For Windows systems, use these PowerShell commands:
  • CPU & RAM Info:
    powershell.exe -Command "Get-ComputerInfo | Select-Object CsProcessors, CsTotalPhysicalMemory, OsArchitecture"
  • Logical Processors:
    powershell.exe -Command "(Get-WmiObject -Class Win32_Processor).NumberOfLogicalProcessors"
  • Storage Info:
    powershell.exe -Command "Get-PhysicalDisk | Select-Object MediaType, BusType, Size, FriendlyName"
  • Disk Space:
    powershell.exe -Command "Get-PSDrive C | Select-Object Used, Free"
  • Network Speed:
    powershell.exe -Command "Get-NetAdapter | Select-Object Name, Status, LinkSpeed"
For macOS systems, use these commands:
  • CPU Cores:
    sysctl -n hw.physicalcpu && sysctl -n hw.logicalcpu
    • Returns physical and logical cores (use logical for comparison)
  • RAM:
    sysctl -n hw.memsize
    • Returns bytes, divide by 1073741824 to get GB
  • Disk Space:
    df -h /
    • Shows total, used, and available disk space
  • Storage Type (NVMe):
    system_profiler SPNVMeDataType
    • Shows NVMe SSD details including model, capacity, and TRIM support
  • Network Hardware:
    networksetup -listallhardwareports
    • Lists all network interfaces
  • Wi-Fi Status:
    ifconfig en0 | grep 'status:' && networksetup -getinfo Wi-Fi
    • Shows if Wi-Fi is active and configuration details
  • Wi-Fi PHY Mode:
    system_profiler SPAirPortDataType | grep -A 10 "Current Network Information" | grep -E "Link Speed|PHY Mode"
    • Shows Wi-Fi standard (802.11ax = Wi-Fi 6, etc.)
  • CPU:核心数/vCPU数量
  • 内存(RAM):总内存(GB)
  • 存储类型:验证存储是否采用NVMe标准(必须为NVMe,而非SATA SSD或HDD)
  • 可用磁盘空间:可用空间(GB)
  • 网络速度:网络接口速度
Windows系统使用以下PowerShell命令:
  • CPU与内存信息
    powershell.exe -Command "Get-ComputerInfo | Select-Object CsProcessors, CsTotalPhysicalMemory, OsArchitecture"
  • 逻辑处理器数量
    powershell.exe -Command "(Get-WmiObject -Class Win32_Processor).NumberOfLogicalProcessors"
  • 存储信息
    powershell.exe -Command "Get-PhysicalDisk | Select-Object MediaType, BusType, Size, FriendlyName"
  • 磁盘空间
    powershell.exe -Command "Get-PSDrive C | Select-Object Used, Free"
  • 网络速度
    powershell.exe -Command "Get-NetAdapter | Select-Object Name, Status, LinkSpeed"
macOS系统使用以下命令:
  • CPU核心数
    sysctl -n hw.physicalcpu && sysctl -n hw.logicalcpu
    • 返回物理核心和逻辑核心数(使用逻辑核心数进行对比)
  • 内存(RAM)
    sysctl -n hw.memsize
    • 返回字节数,除以1073741824转换为GB
  • 磁盘空间
    df -h /
    • 显示总空间、已用空间和可用空间
  • 存储类型(NVMe)
    system_profiler SPNVMeDataType
    • 显示NVMe SSD详细信息,包括型号、容量和TRIM支持情况
  • 网络硬件
    networksetup -listallhardwareports
    • 列出所有网络接口
  • Wi-Fi状态
    ifconfig en0 | grep 'status:' && networksetup -getinfo Wi-Fi
    • 显示Wi-Fi是否激活及配置详情
  • Wi-Fi物理模式
    system_profiler SPAirPortDataType | grep -A 10 "Current Network Information" | grep -E "Link Speed|PHY Mode"
    • 显示Wi-Fi标准(如802.11ax = Wi-Fi 6等)

Step 3: Compare Against Minimum Specifications

步骤3:与最低规格要求对比

  • For each component, indicate if it meets (✓) or fails (✗) the minimum requirement
  • IMMEDIATELY after gathering system info, display a clear summary table showing:
    • Component
    • Current Value
    • Minimum Required
    • Status (Pass/Fail)
  • Do not wait until the end of the skill to show this table
  • 针对每个组件,标记是否符合(✓)或不符合(✗)最低要求
  • 收集系统信息后立即展示清晰的汇总表格,包含:
    • 组件
    • 当前值
    • 最低要求
    • 状态(通过/不通过)
  • 不要等到技能执行完毕才展示此表格

Step 4: Windows-Specific Optimizations

步骤4:Windows专属优化

(only if on Windows)
(仅适用于Windows系统)

A. IOPS Performance Test

A. IOPS性能测试

  • Locate DiskSpd executable:
    • Detect the processor architecture (amd64, arm64, or x86)
    • Use the appropriate diskspd.exe from the skill's assets folder (relative to the skill base directory):
      • For amd64:
        {skill_base_directory}/assets/DiskSpd/amd64/diskspd.exe
      • For arm64:
        {skill_base_directory}/assets/DiskSpd/arm64/diskspd.exe
      • For x86:
        {skill_base_directory}/assets/DiskSpd/x86/diskspd.exe
    • If the DiskSpd assets folder or the required diskspd.exe is missing, download and extract it:
      • Before downloading, inform the user in one concise sentence what is being downloaded and why, e.g. "Fetching Microsoft's DiskSpd utility from the official GitHub release to benchmark your disk's IOPS performance."
      • Download URL:
        https://github.com/microsoft/diskspd/releases/download/v2.2/DiskSpd.ZIP
      • Target location:
        {skill_base_directory}/assets/DiskSpd/
      • Use PowerShell to download and extract:
        powershell
        $target = "{skill_base_directory}/assets/DiskSpd"
        $zip = Join-Path $env:TEMP "DiskSpd.ZIP"
        New-Item -ItemType Directory -Force -Path $target | Out-Null
        Invoke-WebRequest -Uri "https://github.com/microsoft/diskspd/releases/download/v2.2/DiskSpd.ZIP" -OutFile $zip -UseBasicParsing
        Expand-Archive -Path $zip -DestinationPath $target -Force
        Remove-Item $zip -Force
      • After extraction, verify that
        diskspd.exe
        exists under the architecture-specific subfolder (
        amd64
        ,
        arm64
        , or
        x86
        )
      • If the download fails (no network, proxy issues, etc.), inform the user clearly, provide the download URL, and skip the IOPS test rather than failing the whole skill
  • Create Test File:
    • Command:
      diskspd.exe -c1G testfile.dat
    • This creates a 1GB test file required for IOPS testing
    • Note: DiskSpd requires a pre-existing file to test against
  • Run Random Read IOPS Test:
    • Command:
      diskspd.exe -b4K -d30 -o32 -t4 -r -w0 -Sh testfile.dat
    • This tests random read IOPS with 4KB blocks for 30 seconds
    • Requirement: ≥10,000 IOPS
  • Run Random Write IOPS Test:
    • Command:
      diskspd.exe -b4K -d30 -o32 -t4 -r -w100 -Sh testfile.dat
    • This tests random write IOPS with 4KB blocks for 30 seconds
    • Requirement: ≥8,000 IOPS
  • Parse and Display Results:
    • Extract the IOPS values from the DiskSpd output
    • Compare against minimum requirements:
      • Random Read: 10,000 IOPS minimum
      • Random Write: 8,000 IOPS minimum
    • IMMEDIATELY display a table with the read and write IOPS result and Pass/Fail status
    • If tests fail, provide guidance on storage improvements
  • Clean up:
    • Delete the testfile.dat after testing
  • 定位DiskSpd可执行文件:
    • 检测处理器架构(amd64、arm64或x86)
    • 使用技能资源文件夹中对应架构的diskspd.exe(相对于技能基础目录):
      • amd64架构:
        {skill_base_directory}/assets/DiskSpd/amd64/diskspd.exe
      • arm64架构:
        {skill_base_directory}/assets/DiskSpd/arm64/diskspd.exe
      • x86架构:
        {skill_base_directory}/assets/DiskSpd/x86/diskspd.exe
    • 若DiskSpd资源文件夹或所需diskspd.exe缺失,下载并解压:
      • 下载前,用简洁语句告知用户下载内容及原因,例如:"正在从官方GitHub发布版本获取Microsoft的DiskSpd工具,用于基准测试磁盘的IOPS性能。"
      • 下载链接:
        https://github.com/microsoft/diskspd/releases/download/v2.2/DiskSpd.ZIP
      • 目标路径:
        {skill_base_directory}/assets/DiskSpd/
      • 使用PowerShell下载并解压:
        powershell
        $target = "{skill_base_directory}/assets/DiskSpd"
        $zip = Join-Path $env:TEMP "DiskSpd.ZIP"
        New-Item -ItemType Directory -Force -Path $target | Out-Null
        Invoke-WebRequest -Uri "https://github.com/microsoft/diskspd/releases/download/v2.2/DiskSpd.ZIP" -OutFile $zip -UseBasicParsing
        Expand-Archive -Path $zip -DestinationPath $target -Force
        Remove-Item $zip -Force
      • 解压后,验证对应架构子文件夹(
        amd64
        arm64
        x86
        )下是否存在
        diskspd.exe
      • 若下载失败(无网络、代理问题等),清晰告知用户,提供下载链接,并跳过IOPS测试,而非终止整个技能
  • 创建测试文件:
    • 命令:
      diskspd.exe -c1G testfile.dat
    • 创建1GB测试文件,用于IOPS测试
    • 注意:DiskSpd需要预先存在的文件才能进行测试
  • 运行随机读取IOPS测试:
    • 命令:
      diskspd.exe -b4K -d30 -o32 -t4 -r -w0 -Sh testfile.dat
    • 测试4KB块大小的随机读取IOPS,持续30秒
    • 要求:≥10,000 IOPS
  • 运行随机写入IOPS测试:
    • 命令:
      diskspd.exe -b4K -d30 -o32 -t4 -r -w100 -Sh testfile.dat
    • 测试4KB块大小的随机写入IOPS,持续30秒
    • 要求:≥8,000 IOPS
  • 解析并展示结果:
    • 从DiskSpd输出中提取IOPS数值
    • 与最低要求对比:
      • 随机读取:最低10,000 IOPS
      • 随机写入:最低8,000 IOPS
    • 立即展示表格,包含读取和写入IOPS结果及通过/不通过状态
    • 若测试不通过,提供存储性能提升建议
  • 清理:
    • 测试完成后删除testfile.dat

B. Microsoft Defender Exclusions

B. Microsoft Defender排除项设置

  • First, check current exclusions:
    • Use PowerShell to check existing process exclusions:
      Get-MpPreference | Select-Object -ExpandProperty ExclusionProcess
    • Use PowerShell to check existing path exclusions:
      Get-MpPreference | Select-Object -ExpandProperty ExclusionPath
    • Detect the current user's username dynamically
    • Compare current exclusions against recommended exclusions:
      • Process exclusions:
        java.exe
        ,
        javaw.exe
        ,
        node.exe
        ,
        Code.exe
      • Path exclusions (use current username):
        • C:\Users\<USERNAME>\AnypointCodeBuilder
        • C:\Users\<USERNAME>\.vscode
        • C:\Users\<USERNAME>\.m2
        • C:\Users\<USERNAME>\AppData\Local\Temp
  • Determine what's missing:
    • Identify which processes are NOT already excluded
    • Identify which paths are NOT already excluded
    • If all exclusions already exist, inform the user and skip this step
  • Ask for user permission (only if exclusions are missing):
    • Show the user which specific files/paths are not yet excluded
    • Explain why these exclusions improve ACB performance (reduces scanning overhead)
    • Ask if the user wants to add the missing exclusions
    • Allow the user to decline
  • Apply exclusions (only if user agrees):
    • Run PowerShell commands to add missing exclusions:
      • Use
        Add-MpPreference -ExclusionProcess
        for executables
      • Use
        Add-MpPreference -ExclusionPath
        for directories
    • Handle admin privilege errors:
      • If commands fail due to insufficient privileges, catch the error
      • Inform the user they need administrator privileges
      • Provide the exact commands they should ask their admin to run
      • Do not show scary error messages, just explain clearly what's needed
  • 首先,检查当前排除项:
    • 使用PowerShell检查现有进程排除项:
      Get-MpPreference | Select-Object -ExpandProperty ExclusionProcess
    • 使用PowerShell检查现有路径排除项:
      Get-MpPreference | Select-Object -ExpandProperty ExclusionPath
    • 动态检测当前用户名
    • 将当前排除项与推荐排除项对比:
      • 进程排除项:
        java.exe
        javaw.exe
        node.exe
        Code.exe
      • 路径排除项(使用当前用户名):
        • C:\Users\<USERNAME>\AnypointCodeBuilder
        • C:\Users\<USERNAME>\.vscode
        • C:\Users\<USERNAME>\.m2
        • C:\Users\<USERNAME>\AppData\Local\Temp
  • 确定缺失的排除项:
    • 识别哪些进程尚未被排除
    • 识别哪些路径尚未被排除
    • 若所有排除项已存在,告知用户并跳过此步骤
  • 请求用户权限(仅当存在缺失排除项时):
    • 向用户展示具体哪些文件/路径尚未被排除
    • 解释这些排除项如何提升ACB性能(减少扫描开销)
    • 询问用户是否要添加缺失的排除项
    • 允许用户拒绝
  • 应用排除项(仅当用户同意时):
    • 运行PowerShell命令添加缺失的排除项:
      • 对可执行文件使用
        Add-MpPreference -ExclusionProcess
      • 对目录使用
        Add-MpPreference -ExclusionPath
    • 处理管理员权限错误:
      • 若因权限不足导致命令失败,捕获错误
      • 告知用户需要管理员权限
      • 提供管理员需要运行的具体命令
      • 不要显示吓人的错误信息,只需清晰解释所需操作

C. Power Plan Analysis

C. 电源计划分析

  • Check the current active power plan using:
    powershell.exe -Command "powercfg /getactivescheme"
  • Display the current power plan to the user
  • Analyze if the current power plan is sufficient for ACB:
    • High Performance: ✓ Optimal for ACB - no change needed
    • Balanced: ⚠ May impact ACB performance - recommend switching to High Performance
    • Power Saver: ✗ Not recommended for ACB - strongly recommend switching to High Performance
  • If the current plan is not High Performance:
    • Explain why High Performance is recommended for ACB
    • Ask the user if they want to switch to High Performance
    • Provide the command:
      powercfg /setactive SCHEME_MIN
      (requires admin)
    • Allow the user to skip this step if they choose
  • If the current plan is already High Performance, inform the user and skip this step
  • 使用以下命令检查当前激活的电源计划:
    powershell.exe -Command "powercfg /getactivescheme"
  • 向用户展示当前电源计划
  • 分析当前电源计划是否适合ACB:
    • 高性能:✓ 适合ACB - 无需更改
    • 平衡:⚠ 可能影响ACB性能 - 建议切换到高性能
    • 节能:✗ 不建议用于ACB - 强烈建议切换到高性能
  • 若当前计划不是高性能:
    • 解释为何高性能计划适合ACB
    • 询问用户是否要切换到高性能
    • 提供命令:
      powercfg /setactive SCHEME_MIN
      (需要管理员权限)
    • 允许用户选择跳过此步骤
  • 若当前计划已是高性能,告知用户并跳过此步骤

Step 5: Output Format

步骤5:输出格式

  • Present findings in a clear, formatted table
  • For Windows systems, provide clear status of optimization steps
  • For power plan: display current plan, provide analysis, and ask for user confirmation before making changes
  • If admin privileges are required, inform the user and provide the exact commands they need to run
  • If any specification is not met, highlight it clearly and suggest potential solutions
  • Respect user choices to skip optional optimization steps
  • 以清晰的格式化表格展示检测结果
  • 对于Windows系统,提供优化步骤的明确状态
  • 电源计划:展示当前计划,提供分析,并在更改前请求用户确认
  • 若需要管理员权限,告知用户并提供所需的具体命令
  • 若任何规格不满足,突出显示并建议潜在解决方案
  • 尊重用户跳过可选优化步骤的选择

Important Notes

重要说明

  • Windows optimizations require administrator privileges
  • Always verify system information before making changes
  • Provide clear feedback on what was checked and what actions were taken
  • For non-Windows systems (macOS, Linux), do NOT mention Windows-specific optimizations at all
  • Windows优化需要管理员权限
  • 进行更改前始终验证系统信息
  • 清晰反馈已检查内容及已执行操作
  • 对于非Windows系统(macOS、Linux),完全不要提及Windows专属优化