cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 7

Alert for Storage % under specific size.

Jump to solution

Hi Guys, i am sure you see this question alot, but i was unable to find a specific answer to what it is i am trying to do.

I have been able to put together an alert that shows % of disk space remaining etc , but we have a few Virtuals with quite large drives ( some 1 - 4 tb in size )  if i do an alert based on pure percentage it alerts on these drives because yes technically they may have 10% left, but that 10% could be 500gb, which is not a concern.

Is there a way to calculate the alert to alert if at under a specific size and a percentage together?

I was able to do it in a widget with this :

vm.vol.freeSpace:[0 TO 5368709120] AND vm.vol.freeSpacePercentage:[0 TO 10]

but i cannot seem to find how to add it to the alert.

I am using this currently :

if(/virtualMachine[./name="xxxx"]/diskVolume[./mountPoint="E:\"])

then 100

if(/virtualMachine[./name="xxxx"]/diskVolume[./mountPoint="E:\"])

then 100

if(/virtualMachine[./name="xxxx"]/diskVolume[./mountPoint="E:\"])

then 100

else /virtualMachine/diskVolume/freeSpacePercentage

also can you combine an alert to include both % and FreeSpace remaining in the email ?   i tried to combine :

string-join(for $fullVolume in

/virtualMachine/diskVolume[freeSpacePercentage<=10] return

concat($fullVolume/mountPoint, " (" ,

$fullVolume/freeSpacePercentage, "%)"),",")

string-join(for $fullVolume in /virtualMachine/diskVolume[freeSpacePercentage<=10] return concat($fullVolume/mountPoint, ' (' , floor($fullVolume/freeSpace div 1024 div 1024 div 1024), 'GB)'), ', ')

in the notification value, but no such luck

Thanks

0 Kudos
1 Solution
Level 12

Hi, I'm not sure if Lukas answered your question. If I'm right, you want to handle the alert for small disks by freeSpacePercentage and big disks by freeSpace. If this is the case, see my steps below. If not, please describe your problem in detail. Thanks.

1) the easiest solution would be creation of two separate alerts, one for small disk volumes, the other for big disk volumes. See examples below:

Small disks (free space less than 10% for disks <= 1TB):

Scope: vm.powerstate:* vm.vol.freeSpacePercentage:[0 TO 10]

Base Alert On Find: min(/virtualMachine/diskVolume[capacity < 1*1024*1024*1024*1024]/freeSpacePercentage)

Triggers On: Range Less than 11

Notification (rounded to hundredths): string-join(for $fullVolume in /virtualMachine/diskVolume[freeSpacePercentage<11] return concat($fullVolume/mountPoint, ' (' , $fullVolume/freeSpacePercentage, '%, ', round($fullVolume/freeSpace div (1024*1024*1024) * 100) div 100 ,' GB)'), ', ')

VMAN_alert_small_disks.png

Big disks (free space less than 200 GB for disks > 1TB):

Scope (1TB = 1099511627776; 200GB = 214748364800): vm.powerstate:* vm.vol.capacity:[1099511627776 TO *] vm.vol.freeSpace:[0 TO 214748364800]

Base Alert On Find: min(/virtualMachine/diskVolume[capacity > 1*1024*1024*1024*1024]/freeSpace)

Triggers On: Range Less than 214748364800

Notification (rounded to hundredths): string-join(for $fullVolume in /virtualMachine/diskVolume[capacity>1*1024*1024*1024*1024][freeSpace<200*1024*1024*1024] return concat($fullVolume/mountPoint, ' (' , round($fullVolume/freeSpace div (1024*1024*1024) * 100) div 100, ' GB out of ', round($fullVolume/capacity div (1024*1024*1024*1024) * 100) div 100 ,' TB)'), ', ')

VMAN_alert_big_disks.png

2) if you want to merge both conditions in one alert, you could do it this way (I don't recommend this option; evaluation of complex xPath queries may last quite long, especially when there are thousands of VMs):

Scope: vm.powerstate:*

Base Alert On Find:

if(min(/virtualMachine/diskVolume[capacity > 1*1024*1024*1024*1024]/freeSpace) < 214748364800)

then 1

else

if(min(/virtualMachine/diskVolume[capacity < 1*1024*1024*1024*1024]/freeSpacePercentage) < 11)

then 1

else 0

Triggers On: Greater than 0

Notification: the xPath would be too complex but I would use something similar to the notification of small disks

VMAN_alert_all_disks.png

Does it help?

Milan

View solution in original post

0 Kudos
3 Replies
Level 7

Thanks to both of you for the info.  I will test these out with my management and see if they are happy with the results!.

Scott.

0 Kudos
Level 12

Hi, I'm not sure if Lukas answered your question. If I'm right, you want to handle the alert for small disks by freeSpacePercentage and big disks by freeSpace. If this is the case, see my steps below. If not, please describe your problem in detail. Thanks.

1) the easiest solution would be creation of two separate alerts, one for small disk volumes, the other for big disk volumes. See examples below:

Small disks (free space less than 10% for disks <= 1TB):

Scope: vm.powerstate:* vm.vol.freeSpacePercentage:[0 TO 10]

Base Alert On Find: min(/virtualMachine/diskVolume[capacity < 1*1024*1024*1024*1024]/freeSpacePercentage)

Triggers On: Range Less than 11

Notification (rounded to hundredths): string-join(for $fullVolume in /virtualMachine/diskVolume[freeSpacePercentage<11] return concat($fullVolume/mountPoint, ' (' , $fullVolume/freeSpacePercentage, '%, ', round($fullVolume/freeSpace div (1024*1024*1024) * 100) div 100 ,' GB)'), ', ')

VMAN_alert_small_disks.png

Big disks (free space less than 200 GB for disks > 1TB):

Scope (1TB = 1099511627776; 200GB = 214748364800): vm.powerstate:* vm.vol.capacity:[1099511627776 TO *] vm.vol.freeSpace:[0 TO 214748364800]

Base Alert On Find: min(/virtualMachine/diskVolume[capacity > 1*1024*1024*1024*1024]/freeSpace)

Triggers On: Range Less than 214748364800

Notification (rounded to hundredths): string-join(for $fullVolume in /virtualMachine/diskVolume[capacity>1*1024*1024*1024*1024][freeSpace<200*1024*1024*1024] return concat($fullVolume/mountPoint, ' (' , round($fullVolume/freeSpace div (1024*1024*1024) * 100) div 100, ' GB out of ', round($fullVolume/capacity div (1024*1024*1024*1024) * 100) div 100 ,' TB)'), ', ')

VMAN_alert_big_disks.png

2) if you want to merge both conditions in one alert, you could do it this way (I don't recommend this option; evaluation of complex xPath queries may last quite long, especially when there are thousands of VMs):

Scope: vm.powerstate:*

Base Alert On Find:

if(min(/virtualMachine/diskVolume[capacity > 1*1024*1024*1024*1024]/freeSpace) < 214748364800)

then 1

else

if(min(/virtualMachine/diskVolume[capacity < 1*1024*1024*1024*1024]/freeSpacePercentage) < 11)

then 1

else 0

Triggers On: Greater than 0

Notification: the xPath would be too complex but I would use something similar to the notification of small disks

VMAN_alert_all_disks.png

Does it help?

Milan

View solution in original post

0 Kudos

Hi Scott, you are on the right way. You can change the alert condition by going to Content > search for "Guest storage space utilization" alert > Open > Configure > Scope tab > Search Query

There you can change the default Lucene condition to something like

vm.powerstate:poweredOn AND vm.vol.freeSpacePercentage:[0 TO 10] AND vm.vol.freeSpace:[0 TO 5368709120]

like you did for a widget.

This is not mandatory, but in case you want to reflect that also in the search context functionality, you may want to modify also query in Advanced tab > In Context Search Link

and change the Search query to the same value as above.

To add remaining free space into mail notification, the xPath query should look like (haven't tested)

string-join(for $fullVolume in /virtualMachine/diskVolume[freeSpacePercentage<=10 and freeSpace<=5368709120] return concat($fullVolume/mountPoint, ' (' , $fullVolume/freeSpacePercentage, '% - ', floor($fullVolume/freeSpace div 1024 div 1024 div 1024),'GB)'), ', ')

0 Kudos