PowerShell heartbeat powershell
Posts an empty heartbeat every time it runs. Schedule via Task Scheduler (see Scheduled-task setup) every N minutes; pair with a capture.freshness check at max_silence = 2x the schedule interval.
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.)
# heartbeat.ps1 — minimal site1.erralert.com check-in.
# Schedule from Task Scheduler at whatever cadence you want monitored.
$Url = "YOUR_URL/heartbeat"
$Body = (@{
hostname = $env:COMPUTERNAME
ts = [DateTimeOffset]::UtcNow.ToString("o")
}) | ConvertTo-Json -Compress
try {
Invoke-RestMethod -Uri $Url -Method Post -Body $Body `
-ContentType "application/json" -TimeoutSec 15 | Out-Null
exit 0
} catch {
Write-Error $_
exit 1
}
Recommended pairing
Add a capture.freshness check to this capture object.
max_silence_seconds = your-schedule-interval x 2 (e.g. 600 for a 5-minute heartbeat).
What is the filename?
heartbeat.ps1 — this is the suggested name for the downloaded file. Rename freely if you prefer.
site1.erralert.com