15 lines
		
	
	
		
			No EOL
		
	
	
		
			688 B
		
	
	
	
		
			PowerShell
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			No EOL
		
	
	
		
			688 B
		
	
	
	
		
			PowerShell
		
	
	
	
	
	
| $WARNING = 25
 | |
| $CRITICAL = 50
 | |
| $Interface = $(Get-Counter).CounterSamples.Path[0]
 | |
| $TransferRate = ((Get-Counter $Interface).countersamples | select -ExpandProperty CookedValue)*8
 | |
| $NetworkUtilisation = [math]::round($TransferRate/1000000000*100,2)
 | |
| if ($NetworkUtilisation -gt $CRITICAL){
 | |
| Write-Output "CRITICAL: $($NetworkUtilisation) % Network utilisation, $($TransferRate.ToString('N0')) b/s"   
 | |
| # exit 2
 | |
| }
 | |
| if ($NetworkUtilisation -gt $WARNING){
 | |
| Write-Output "WARNING: $($NetworkUtilisation) % Network utilisation, $($TransferRate.ToString('N0')) b/s"
 | |
| # exit 1
 | |
| }
 | |
| Write-Output "OK: $($NetworkUtilisation) % Network utilisation, $($TransferRate.ToString('N0')) b/s"   
 | |
| # exit 0 |