Code: Select all
#Title:veeam_media_pool_quantity.ps1
#Description:This is a Nagios plug-in that will alert when the Free media
#pool starts getting low
#Author:Laz Ravelo
#Date:2018-01-12
#Version:1.0
#Usage:veeam_media_pool_quantity.ps1
#Notes:
#=================================================================================
# Adding required SnapIn
asnp VeeamPSSnapin
$ok = 10
$warn = 5
$mediapool = Get-VBRTapeMediaPool -Name "Free"
$quantity = $mediapool.Medium.Count
if ( $quantity -gt $ok )
{
Write-Host "OK! Free pool has acceptable number of tapes! Quantity: $quantity"
exit 0
}
if ( $quantity -lt $ok -and $quantity -gt $warn )
{
Write-Host "WARNING! Starting to run low on free tapes! Quantity: $quantity"
exit 1
}
if ( $quantity -lt $warn )
{
Write-Host "CRITICAL! Desperately low on free tapes! Quantity: $quantity"
exit 2
}
if ( $quantity -eq 0 )
{
Write-Host "CRITICAL! There are no free tapes left!"
exit 2
}