Local check for Quota usage on Windows servers (Checkmk Agent 1.5.x)

You local check a little bit shorter and better readable :slight_smile:

# Quota Output as Local Check for CMK
$Quotas = @(Get-FsrmQuota | Select-Object Path, Size, Usage)

foreach ($Quota in $Quotas) {
    $Size = ($Quota.Size / 1gb)
    $Usage = [math]::Round($Quota.Usage / 1gb, 1)
    $Path = ($Quota.Path)
    $Percent = ($Usage / $Size * 100)
    Write-Host("P Disk_Quota_" + $Path + " Usage=" + "{0:N0}" -f $Percent + ";85;95|Size=" + "{0:N0}" -f $Size + " The quota usage in percent and GB size")
} 

The Status is dynamically calculated by CMK itself. You don’t need to invest to much time for if-then-else statements anymore.

1 Like