# you can disable an alarm notification by setting the 'to' line to: silent

# --- CPU ---

 template: am_vmss_cpu
       on: azure_monitor.vmss.cpu
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of average
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (85) : (90))
     crit: $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS CPU utilization on ${label:resource_name}
     info: Average CPU utilization of VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: sysadmin

 template: am_vmss_cpu_credits_remaining
       on: azure_monitor.vmss.cpu_credits
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of remaining
    units: credits
    every: 1m
     warn: $this != nan AND $this < (($status >= $WARNING)  ? (30) : (20))
     crit: $this != nan AND $this < (($status == $CRITICAL) ? (20) : (10))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS CPU credits low on ${label:resource_name}
     info: Remaining CPU credits on burstable VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Running out of credits will cap performance to baseline.
       to: sysadmin

# --- Memory ---

 template: am_vmss_memory_available
       on: azure_monitor.vmss.memory_percentage
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of available
    units: percentage
    every: 1m
     warn: $this < (($status >= $WARNING)  ? (15) : (10))
     crit: $this < (($status == $CRITICAL) ? (10) : (5))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS available memory low on ${label:resource_name}
     info: Average available memory percentage on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: sysadmin

# --- Availability ---

 template: am_vmss_availability
       on: azure_monitor.vmss.availability
    class: Availability
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of average
    units: state
    every: 1m
     crit: $this < 1
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS availability degraded on ${label:resource_name}
     info: VM availability state on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Values below 1 indicate instances are unavailable.
       to: sysadmin

# --- OS Disk ---

 template: am_vmss_os_disk_latency
       on: azure_monitor.vmss.os_disk_latency
    class: Latency
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of average
    units: milliseconds
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (30) : (50))
     crit: $this > (($status == $CRITICAL) ? (50) : (100))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS OS disk latency on ${label:resource_name}
     info: Average OS disk latency on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: sysadmin

 template: am_vmss_os_disk_queue_depth
       on: azure_monitor.vmss.os_disk_queue_depth
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of average
    units: operations
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (16) : (32))
     crit: $this > (($status == $CRITICAL) ? (32) : (64))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS OS disk queue depth on ${label:resource_name}
     info: Average OS disk queue depth on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           High queue depth indicates disk I/O saturation.
       to: sysadmin

 template: am_vmss_os_disk_bandwidth_throttling
       on: azure_monitor.vmss.os_disk_throttling
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of bandwidth
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS OS disk bandwidth consumed on ${label:resource_name}
     info: OS disk bandwidth consumed percentage on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Approaching 100% means disk throughput is being throttled.
       to: sysadmin

 template: am_vmss_os_disk_iops_throttling
       on: azure_monitor.vmss.os_disk_throttling
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of iops
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS OS disk IOPS consumed on ${label:resource_name}
     info: OS disk IOPS consumed percentage on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Approaching 100% means disk IOPS is being throttled.
       to: sysadmin

 template: am_vmss_os_disk_burst_bps_credits
       on: azure_monitor.vmss.os_disk_burst_credits
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of bandwidth
    units: percentage
    every: 1m
     warn: $this != nan AND $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this != nan AND $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS OS disk burst BPS credits depleting on ${label:resource_name}
     info: OS disk burst bandwidth credits consumed on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Exhausting burst credits will throttle disk throughput to baseline.
       to: sysadmin

 template: am_vmss_os_disk_burst_io_credits
       on: azure_monitor.vmss.os_disk_burst_credits
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of io
    units: percentage
    every: 1m
     warn: $this != nan AND $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this != nan AND $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS OS disk burst IO credits depleting on ${label:resource_name}
     info: OS disk burst IO credits consumed on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Exhausting burst credits will throttle disk IOPS to baseline.
       to: sysadmin

# --- Data Disk ---

 template: am_vmss_data_disk_latency
       on: azure_monitor.vmss.data_disk_latency
    class: Latency
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of average
    units: milliseconds
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (30) : (50))
     crit: $this > (($status == $CRITICAL) ? (50) : (100))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS data disk latency on ${label:resource_name}
     info: Average data disk latency on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: sysadmin

 template: am_vmss_data_disk_queue_depth
       on: azure_monitor.vmss.data_disk_queue_depth
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of average
    units: operations
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (16) : (32))
     crit: $this > (($status == $CRITICAL) ? (32) : (64))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS data disk queue depth on ${label:resource_name}
     info: Average data disk queue depth on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           High queue depth indicates disk I/O saturation.
       to: sysadmin

 template: am_vmss_data_disk_bandwidth_throttling
       on: azure_monitor.vmss.data_disk_throttling
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of bandwidth
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS data disk bandwidth consumed on ${label:resource_name}
     info: Data disk bandwidth consumed percentage on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Approaching 100% means disk throughput is being throttled.
       to: sysadmin

 template: am_vmss_data_disk_iops_throttling
       on: azure_monitor.vmss.data_disk_throttling
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of iops
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS data disk IOPS consumed on ${label:resource_name}
     info: Data disk IOPS consumed percentage on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Approaching 100% means disk IOPS is being throttled.
       to: sysadmin

 template: am_vmss_data_disk_burst_bps_credits
       on: azure_monitor.vmss.data_disk_burst_credits
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of bandwidth
    units: percentage
    every: 1m
     warn: $this != nan AND $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this != nan AND $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS data disk burst BPS credits depleting on ${label:resource_name}
     info: Data disk burst bandwidth credits consumed on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Exhausting burst credits will throttle disk throughput to baseline.
       to: sysadmin

 template: am_vmss_data_disk_burst_io_credits
       on: azure_monitor.vmss.data_disk_burst_credits
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of io
    units: percentage
    every: 1m
     warn: $this != nan AND $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this != nan AND $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS data disk burst IO credits depleting on ${label:resource_name}
     info: Data disk burst IO credits consumed on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Exhausting burst credits will throttle disk IOPS to baseline.
       to: sysadmin

# --- Temp Disk ---

 template: am_vmss_temp_disk_latency
       on: azure_monitor.vmss.temp_disk_latency
    class: Latency
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of average
    units: milliseconds
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (30) : (50))
     crit: $this > (($status == $CRITICAL) ? (50) : (100))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS temp disk latency on ${label:resource_name}
     info: Average temp disk latency on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: sysadmin

 template: am_vmss_temp_disk_queue_depth
       on: azure_monitor.vmss.temp_disk_queue_depth
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of average
    units: operations
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (16) : (32))
     crit: $this > (($status == $CRITICAL) ? (32) : (64))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS temp disk queue depth on ${label:resource_name}
     info: Average temp disk queue depth on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           High queue depth indicates disk I/O saturation.
       to: sysadmin

# --- VM-Level IO Throttling ---

 template: am_vmss_vm_cached_bandwidth_throttling
       on: azure_monitor.vmss.vm_cached_throttling
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of bandwidth
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS cached bandwidth consumed on ${label:resource_name}
     info: VM-level cached bandwidth consumed percentage on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Approaching 100% means the VM is being throttled at the host level.
       to: sysadmin

 template: am_vmss_vm_cached_iops_throttling
       on: azure_monitor.vmss.vm_cached_throttling
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of iops
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS cached IOPS consumed on ${label:resource_name}
     info: VM-level cached IOPS consumed percentage on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Approaching 100% means the VM is being throttled at the host level.
       to: sysadmin

 template: am_vmss_vm_uncached_bandwidth_throttling
       on: azure_monitor.vmss.vm_uncached_throttling
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of bandwidth
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS uncached bandwidth consumed on ${label:resource_name}
     info: VM-level uncached bandwidth consumed percentage on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Approaching 100% means the VM is being throttled at the host level.
       to: sysadmin

 template: am_vmss_vm_uncached_iops_throttling
       on: azure_monitor.vmss.vm_uncached_throttling
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of iops
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS uncached IOPS consumed on ${label:resource_name}
     info: VM-level uncached IOPS consumed percentage on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Approaching 100% means the VM is being throttled at the host level.
       to: sysadmin

# --- VM-Level Burst Credits ---

 template: am_vmss_vm_cached_burst_bps_credits
       on: azure_monitor.vmss.vm_cached_burst_credits
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of bandwidth
    units: percentage
    every: 1m
     warn: $this != nan AND $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this != nan AND $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS cached burst BPS credits depleting on ${label:resource_name}
     info: VM-level cached burst bandwidth credits consumed on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Exhausting credits will throttle cached IO throughput to baseline.
       to: sysadmin

 template: am_vmss_vm_cached_burst_io_credits
       on: azure_monitor.vmss.vm_cached_burst_credits
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of io
    units: percentage
    every: 1m
     warn: $this != nan AND $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this != nan AND $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS cached burst IO credits depleting on ${label:resource_name}
     info: VM-level cached burst IO credits consumed on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Exhausting credits will throttle cached IOPS to baseline.
       to: sysadmin

 template: am_vmss_vm_uncached_burst_bps_credits
       on: azure_monitor.vmss.vm_uncached_burst_credits
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of bandwidth
    units: percentage
    every: 1m
     warn: $this != nan AND $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this != nan AND $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS uncached burst BPS credits depleting on ${label:resource_name}
     info: VM-level uncached burst bandwidth credits consumed on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Exhausting credits will throttle uncached IO throughput to baseline.
       to: sysadmin

 template: am_vmss_vm_uncached_burst_io_credits
       on: azure_monitor.vmss.vm_uncached_burst_credits
    class: Utilization
     type: System
component: Azure VMSS
   lookup: average -5m unaligned of io
    units: percentage
    every: 1m
     warn: $this != nan AND $this > (($status >= $WARNING)  ? (80) : (90))
     crit: $this != nan AND $this > (($status == $CRITICAL) ? (90) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: VMSS uncached burst IO credits depleting on ${label:resource_name}
     info: VM-level uncached burst IO credits consumed on VMSS ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Exhausting credits will throttle uncached IOPS to baseline.
       to: sysadmin
