Version 1

    DESCRIPTION

    This custom metric will track the fragmentation of an index

     

    METRIC DEFINITION

    To create the custom metric, click on Options > Custom Resource Metrics and configure the metric similar to this:

     

    Database Versions: <no limitations>

    Display Name: Index Fragmentation

    Description: <add your own description>

    Category: <add to whatevfer category you like or create a new one>

    Units: %

    Metric Type: Single Value

    Frequency: 900

    Timeout: 50

    SQL Statement:

    Use [Database]

    SELECT round(avg_fragmentation_in_percent, 0) FROM sys.dm_db_index_physical_stats(DB_ID(N'Database'), Object_ID(N'Database.Table'), INDEXPROPERTY(OBJECT_ID('Database.Table'), 'Index_Name', 'IndexID'), NULL , NULL)