This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Custom Alert - VM Disk Usage Rate

DESCRIPTION

This alert can be used with IgniteVM data (assuming you have the Ignite8 Performance product where alerts are defined) and will watch the VM Disk Usage Rate VMware metric. This specific example is limited to between 7:30 am and 5:00 pm (defined within the T-SQL) with the theory being that backups and other batch jobs run at night and can send the VM Disk Usage Rate up normally. This alert is designed to catch high disk usage during the day when end users are using the system. Based on the default thresholds below, it will send emails when the value exceeds 10MB / sec (10,000 KB / sec) for the most recent 10 minute timeframe.

This alert also only allows the alert to run between 7:30 am and 5:00 pm. If that is not needed you can modify or remove the "IF @TIME BETWEEN 730 AND 1700" code.

The example below uses the "vmDiskUsageRate" metric, but a very similar query can be used for other metrics as well. For a list of all metric names, you can run these queries in the Ignite repository database:

select metric_key from conv_metrics order by metric_key;

ALERT DEFINITION

To create the alert, click on Alerts > Manage Alerts tab and create a Custom Alert of type Custom SQL Alert - Single Numeric Return. Configure the alert with values similar to these:

Alert Name: VM Disk Usage Rate

Execution Interval: 10 minutes

Notification Text: The following VMs are experiencing high disk usage

SQL Statement:

declare @DBID int,

        @VMID int,

        @TIME int,

        @SQL varchar(1000)

-- #DBID# is passed in by the Ignite alert

set @DBID = #DBID#

-- get the current time in integer format, i.e. 7:30 am = 730 and 5:00 pm = 1700

select @TIME=CONVERT(INT,CONVERT(VARCHAR,DATEPART(HOUR, CURRENT_TIMESTAMP)) +

                         CONVERT(VARCHAR,DATEPART(MINUTE, CURRENT_TIMESTAMP)))

-- only run the following code between 7:30 am and 5:00 pm, otherwise return 0 for vmDiskUsageRate

IF @TIME BETWEEN 730 AND 1700

BEGIN

   -- get the VMID for this instance

   select @VMID=vm.id

   from cond d

   inner join CONV_VM vm on vm.ID = d.VMID

   where d.ID = @DBID

   set @SQL = 'select AVG(md.V) '+

              'from CONV_METRICS m '+

              'inner join CONV_METRIC_DETAIL_'+convert(varchar,@VMID)+' md on md.METRIC_ID = m.ID '+

              'where m.METRIC_KEY = ''vmDiskUsageRate'' '+

              'and md.D >= DATEADD(MINUTE, -10, CURRENT_TIMESTAMP)'

   exec (@SQL)

END

ELSE

   SELECT 0

Execute Against: Repository

Units: Disk Throughput

High Threshold: Min <depends on environment>, Max empty