Pular para o conteúdo principal
Copie e cole o prompt a seguir no Claude ou em um assistente de IA semelhante quando precisar criar um script que use o GoreloAction. Certifique-se de substituir [describe your monitoring need] pelos seus requisitos específicos.
  • Exemplo 1: “monitor disk space usage and alert when drives are below 10% free space.”
  • Exemplo 2: “rotates the local admin password daily and writes it to a custom field.”
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: Warning

Example: GoreloAction -Alert -Severity 1 -Name "Critical Error" -Description "Details here" -Suppress 24

2. 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.
Depois que o script for gerado, converse com o assistente de IA para garantir que ele atenda exatamente às suas necessidades. Teste o script no Gorelo e copie/cole quaisquer erros para o assistente de IA solucionar (lembre-se de alterar qualquer -Suppress para 0 durante os testes).