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

# --- CPU Utilization ---

 template: am_express_route_gateway_cpu
       on: azure_monitor.express_route_gateway.cpu_utilization
    class: Utilization
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of average
    units: percentage
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (70) : (80))
     crit: $this > (($status == $CRITICAL) ? (80) : (90))
    delay: down 5m multiplier 1.5 max 1h
  summary: ExpressRoute GW CPU on ${label:resource_name}
     info: Average CPU utilization of ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           High CPU may cause degraded forwarding performance
       to: sysadmin

# --- Gateway Throughput ---

 template: am_express_route_gateway_throughput
       on: azure_monitor.express_route_gateway.gateway_throughput
    class: Workload
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of average
    units: bits/s
    every: 1m
     info: Average throughput of ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: silent

# --- Connection Throughput ---

 template: am_express_route_gateway_connection_in
       on: azure_monitor.express_route_gateway.connection_throughput
    class: Workload
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of in
    units: bits/s
    every: 1m
     info: Average inbound connection throughput of ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: silent

 template: am_express_route_gateway_connection_out
       on: azure_monitor.express_route_gateway.connection_throughput
    class: Workload
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of out
    units: bits/s
    every: 1m
     info: Average outbound connection throughput of ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: silent

# --- Packets ---

 template: am_express_route_gateway_packets
       on: azure_monitor.express_route_gateway.packets
    class: Workload
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of average
    units: packets/s
    every: 1m
     info: Average packet rate through ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: silent

# --- Active Flows ---

 template: am_express_route_gateway_active_flows
       on: azure_monitor.express_route_gateway.active_flows
    class: Workload
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of average
    units: flows
    every: 1m
     warn: $this > (($status >= $WARNING) ? (200000) : (250000))
    delay: down 5m multiplier 1.5 max 1h
  summary: ExpressRoute GW active flows on ${label:resource_name}
     info: Average number of active flows on ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           High flow counts may indicate approaching scalability limits
       to: sysadmin

# --- Route Changes ---

 template: am_express_route_gateway_route_changes
       on: azure_monitor.express_route_gateway.route_changes
    class: Errors
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of total
    units: changes/s
    every: 1m
     warn: $this > (($status >= $WARNING) ? (5) : (10))
    delay: down 5m multiplier 1.5 max 1h
  summary: ExpressRoute GW route churn on ${label:resource_name}
     info: Rate of BGP route changes on ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Frequent route changes may indicate BGP instability
       to: sysadmin

# --- Routes Advertised ---

 template: am_express_route_gateway_routes_advertised
       on: azure_monitor.express_route_gateway.routes_advertised
    class: Workload
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of maximum
    units: routes
    every: 1m
     warn: $this > (($status >= $WARNING) ? (900) : (950))
    delay: down 5m multiplier 1.5 max 1h
  summary: ExpressRoute GW routes advertised on ${label:resource_name}
     info: Number of routes advertised to peer by ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Azure limits advertised routes to 1000 per peering
       to: sysadmin

# --- Routes Learned ---

 template: am_express_route_gateway_routes_learned
       on: azure_monitor.express_route_gateway.routes_learned
    class: Workload
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of maximum
    units: routes
    every: 1m
     warn: $this > (($status >= $WARNING) ? (3800) : (3900))
    delay: down 5m multiplier 1.5 max 1h
  summary: ExpressRoute GW routes learned on ${label:resource_name}
     info: Number of routes learned from peer by ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region}). \
           Azure limits learned routes to 4000 per peering
       to: sysadmin

# --- Max Flow Creation Rate ---

 template: am_express_route_gateway_flow_creation_rate
       on: azure_monitor.express_route_gateway.max_flows_creation_rate
    class: Workload
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of maximum
    units: flows/s
    every: 1m
     info: Maximum flow creation rate on ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: silent

# --- VMs in VNet ---

 template: am_express_route_gateway_vm_count
       on: azure_monitor.express_route_gateway.vm_count
    class: Workload
     type: Other
component: ExpressRoute Gateway
   lookup: average -5m unaligned of maximum
    units: VMs
    every: 1m
     info: Number of VMs in the VNet behind ExpressRoute Gateway ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: silent
