Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

142778

August 31st, 2012 08:00

Simple Disk Capacity Alert for particular servers

Hi All,

Can anyone tell me how to do a simple disk capacity alert for particular virtual machines please? I.e if Server X drive E:\ hits 20GB free, send an email.

I've attempted to modify the VMW Virtual Machine Logical Drive Utilization rule but i cant restrict the scope to the particular servers I want to monitor. Very confusing.

Using vFoglight v6.6.2.

Thanks in advance.

132 Posts

August 31st, 2012 10:00

You can modify the scope call to only include specific VMs.

You can test this concept in the Script Console, using the Query line.  Remember that everything is case sensitive.

First, enter   VMWVirtualMachine     and select Query.  You should see all of your VMs

Next, enter  VMWVirtualMachine where name like 'ServerX%'  and you should only get back the matching VMs.  You can extend this using or, and, not constructs.  e.g.  VMWVirtualMachine where (name like 'ServerX%' or name like 'ServerY%')  Once you are comfortable with this, we can take step 2.  The '%' is a wildcard character, matching any number of any characters.

Now, let's look at your specific case, which is a bit more complicated, since the name of the VM is not directly part of the  VMWVirtualMachineLogicalDisk object. 

We need to start with VMWVirtualMachineLogicalDisk as our base, and then extend it.

Still in Script Editor, enter VMWVirtualMachineLogicalDisk into the Query line, and select Query.  You should see a lot of logical drive records.  Selecting one of them, and then selecting the object panel tab below will show you some of the properties of that object.

Next, enter VMWVirtualMachineLogicalDisk where name like 'C:%' and select Query.  You should see a smaller list, only showing C: drives.

This is nice, but since the name property on the VMWVirtualMachineLogicalDisk object is the drive letter, not the name of the VM, this doesn't help with your particular case.

The trick is to remember that these are Objects, not rows in a SQL table.  And there is a handy item on the object model called parents.  You can see this by scrolling down through the selected VMWVirtualMachineLogicalDisk properties, until you see Parents.  This is a link up the object tree, and can be used to select just what you need.

Enter VMWVirtualMachineLogicalDisk where parents.name like 'ServerX%', and you should see just the logical disks for the selected VM.  Again, you can construct more complex criteria.  Also, you need to be aware that in some object types, parents is not a single item, but a list of items (e.g. datastores under ESX Hosts, where one Datastore might be the child of many ESX Hosts.)  The query in that case would be constructed in a different manner, to handle multiple possible results. 

Ok, so now we are ready to make your new rule.  You don't EVER want to change a standard rule, you should always copy the rule, if necessary disabling the original.

Copy the VMW Virtual Machine Logical Drive Utilization rule to a new rule, and go to the Rule Definition tab.

Under Rule Scope, you'll see VMWVirtualMachineLogicalDisk in the larger box.  This can be filled in from the dropdown just above it, but it also can be added to by typing directly into the larger box.   

Change the larger box from VMWVirtualMachineLogicalDisk to VMWVirtualMachineLogicalDisk where parents.name like 'ServerX%', and test the rule scope with the small green checkmark off to the side.

In green text, you shuold see that your scope has been changed to the desired list of VMs.

Remember to hit save, very important

9 Posts

August 31st, 2012 14:00

Hi John,

Thanks a million for your comprehensive answer, that worked a treat! The bit i was missing was the parents.name part, would have taken an eternity to work out too!

Thanks again

No Events found!

Top