← Status reporting (self-severity)
PowerShell — report any severity powershell
Single PowerShell script that takes the severity as a parameter, so you can call it from a wrapper that decides ok/warn/crit based on your own logic. Usage: .\status.ps1 -Severity ok .\status.ps1 -Severity warn -Summary 'Disk 92% full' .\status.ps1 -Severity crit -Summary 'Backup script failed'
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.)
# status.ps1 — POST a self-reported severity to site1.erralert.com.
#
# Usage:
# .\status.ps1 -Severity ok
# .\status.ps1 -Severity warn -Summary "disk getting full"
# .\status.ps1 -Severity crit -Summary "service down"
# .\status.ps1 -Severity error -Summary "couldn't even probe"
param(
[Parameter(Mandatory=$true)]
[ValidateSet('ok','warn','crit','error')]
[string]$Severity,
[string]$Summary = ''
)
$Url = "YOUR_URL/$Severity"
$Body = @{ hostname = $env:COMPUTERNAME }
if ($Summary) { $Body['summary'] = $Summary }
$Json = $Body | ConvertTo-Json -Compress
try {
Invoke-RestMethod -Uri $Url -Method Post -Body $Json `
-ContentType "application/json" -TimeoutSec 15 | Out-Null
exit 0
} catch {
Write-Error $_
exit 1
}
Recommended pairing
Add a capture.severity check to this capture object.
capture.severity with max_age_seconds set to roughly twice your normal cadence so a missed run shows as error.
What is the filename?
status.ps1 — this is the suggested name for the downloaded file. Rename freely if you prefer.
site1.erralert.com