复制为 Claude 或其他 AI 助手准备的现成提示,用于生成使用 GoreloAction 处理告警和自定义资产字段的 PowerShell 脚本。
当你需要创建使用 GoreloAction 的脚本时,将以下提示复制并粘贴到 Claude 或类似的 AI 助手中。请务必将 [describe your monitoring need] 替换为你的具体需求。
示例 1:“监控磁盘空间使用情况,当驱动器空闲空间低于 10% 时发出告警。”
示例 2:“每天轮换本地管理员密码并将其写入自定义字段。”
I need to create a simple PowerShell script that integrates with Gorelo RMM using GoreloAction. The script should [describe your monitoring need].GoreloAction supports the following functions:1. Generate Alerts:GoreloAction -Alert -Severity <Int> -Name <String> -Description <String> -Suppress <Int>Severity levels:- 1: Critical- 2: Error- 3: WarningExample: GoreloAction -Alert -Severity 1 -Name "Critical Error" -Description "Details here" -Suppress 242. Write to Custom Fields:GoreloAction -SetCustomField -Name <String> -Value <String>Example: GoreloAction -SetCustomField -Name 'asset.lastCheckTime' -Value "2025-03-09 10:30"3. Read from Custom Fields:Custom fields can be read using the $gorelo: prefix:- Client-level: $gorelo:client.fieldName- Asset-level: $gorelo:asset.fieldName- File access: $gorelo:file.fileName (Gorelo will automatically download any referenced files before running the script)Example: if($gorelo:client.customToken){ # Use the token for actions $token = $gorelo:client.customToken}Example with file:if($gorelo:file.Installer){ # Run the installer that was uploaded to Gorelo Files Start-Process -FilePath $gorelo:file.Installer -ArgumentList "/quiet" -Wait}Please include proper error handling, clear comments, and appropriate alert severity based on the issue detected. Also, please advise on any custom fields or files that need to be created/uploaded in Gorelo before running this script.
生成脚本后,与 AI 助手来回对话,确保它完全满足你的需求。在 Gorelo 中测试脚本,并将任何错误复制/粘贴到 AI 助手以进行故障排除(在测试期间务必将所有 -Suppress 更改为 0)。
此页面对您有帮助吗?
⌘I
Assistant
Responses are generated using AI and may contain mistakes.