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

# --- Availability ---

 template: am_load_balancers_vip_availability
       on: azure_monitor.load_balancers.vip_availability
    class: Availability
     type: Other
component: Azure Load Balancer
   lookup: average -5m unaligned of average
    units: percentage
    every: 1m
     warn: $this < (($status >= $WARNING)  ? (99.9) : (99))
     crit: $this < (($status == $CRITICAL) ? (99)   : (90))
    delay: down 5m multiplier 1.5 max 1h
  summary: LB data path availability on ${label:resource_name}
     info: Data path availability of Azure Load Balancer ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Low values indicate the load balancer is unable to forward traffic
       to: sysadmin

 template: am_load_balancers_dip_availability
       on: azure_monitor.load_balancers.dip_availability
    class: Availability
     type: Other
component: Azure Load Balancer
   lookup: average -5m unaligned of average
    units: percentage
    every: 1m
     warn: $this < (($status >= $WARNING)  ? (99.9) : (99))
     crit: $this < (($status == $CRITICAL) ? (99)   : (90))
    delay: down 5m multiplier 1.5 max 1h
  summary: LB health probe status on ${label:resource_name}
     info: Health probe availability of Azure Load Balancer ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Low values indicate backend instances are failing health probes
       to: sysadmin

 template: am_load_balancers_global_backend_availability
       on: azure_monitor.load_balancers.global_backend_availability
    class: Availability
     type: Other
component: Azure Load Balancer
   lookup: average -5m unaligned of average
    units: percentage
    every: 1m
     warn: $this != nan AND $this < (($status >= $WARNING)  ? (99.9) : (99))
     crit: $this != nan AND $this < (($status == $CRITICAL) ? (99)   : (90))
    delay: down 5m multiplier 1.5 max 1h
  summary: LB global backend availability on ${label:resource_name}
     info: Global backend availability of Azure Load Balancer ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Applies to cross-region load balancers only
       to: sysadmin

# --- SNAT Port Exhaustion ---

 template: am_load_balancers_snat_port_utilization
       on: azure_monitor.load_balancers.snat_ports
    class: Utilization
     type: Other
component: Azure Load Balancer
     calc: ($allocated > 0) ? ($used * 100 / $allocated) : (0)
    units: %
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (70) : (80))
     crit: $this > (($status == $CRITICAL) ? (85) : (95))
    delay: down 5m multiplier 1.5 max 1h
  summary: LB SNAT port utilization on ${label:resource_name}
     info: Percentage of allocated SNAT ports in use on Azure Load Balancer ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           SNAT port exhaustion causes outbound connection failures
       to: sysadmin
