site1.erralert.com

← System & uptime

Memory + CPU snapshot powershell

Posts current free RAM (%) and a 1-second CPU sample. Run frequently (every minute) for 'find machines under sustained load' alerts.

Placeholders only. Before running, replace YOUR_URL with your capture endpoint's POST URL . (Open this page from your capture object to have these auto-filled.)
# mem-cpu.ps1 — memory + CPU sample.

$Url = "YOUR_URL/mem-cpu"
$Os  = Get-CimInstance Win32_OperatingSystem
$MemUsedPct = [math]::Round( (($Os.TotalVisibleMemorySize - $Os.FreePhysicalMemory) / $Os.TotalVisibleMemorySize) * 100, 1)
$Cpu = (Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 1 -MaxSamples 1).CounterSamples[0].CookedValue
$Body = (@{
  hostname        = $env:COMPUTERNAME
  mem_total_mb    = [math]::Round($Os.TotalVisibleMemorySize / 1024, 0)
  mem_free_mb     = [math]::Round($Os.FreePhysicalMemory / 1024, 0)
  mem_used_pct    = $MemUsedPct
  cpu_pct         = [math]::Round($Cpu, 1)
}) | ConvertTo-Json -Compress

Invoke-RestMethod -Uri $Url -Method Post -Body $Body `
  -ContentType "application/json" -TimeoutSec 15 | Out-Null

Recommended pairing

Add a capture.value check to this capture object.
json_path = mem_used_pct, op = >, threshold = 90 (alert when sustained high memory).

What is the filename?

mem-cpu.ps1 — this is the suggested name for the downloaded file. Rename freely if you prefer.