Shared drives quota

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
RebeccaIlene
Posts: 164
Joined: Tue Apr 02, 2019 8:38 pm

Shared drives quota

Post by RebeccaIlene »

Hi Team,

We have a powershell script that we use to monitor quota on windows shares.

However, the script returns a Warning when no data is in the folder.

WARNING: 0.00 GB of 600.00 GB used, 0.00% used.

Can someone please help fix this?

Here is the command definition and have attached the script as well.

check_quota_Copies=check_quota.ps1 -Path "M:\Shares\Copies" -Warn 20 -Crit 10

Thank you,
Rebecca Murray
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Shared drives quota

Post by ssax »

You should be able to do this (adding .00 to both warn and crit):

check_quota.ps1 -Path "M:\Shares\Copies" -Warn 20.00 -Crit 10.00

Or change these lines:

Code: Select all

$percentUsed = "{0:n2}" -f ($quotaObject.Usage / $quotaObject.Size * 100)
$percentFree = "{0:n2}" -f (100 - $quotaObject.Usage / $quotaObject.Size * 100)
To these:

Code: Select all

$percentUsed = [int]($quotaObject.Usage / $quotaObject.Size * 100)
$percentFree = [int](100 - $quotaObject.Usage / $quotaObject.Size * 100)
Locked