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

# --- CPU ---
# CPU usage in millicores. Default thresholds assume a 1 vCPU (1000 millicores) allocation.
# Adjust warn/crit values to match your container group CPU allocation:
#   2 vCPU = 2000 millicores, 4 vCPU = 4000 millicores, etc.

 template: am_container_instances_cpu_usage
       on: azure_monitor.container_instances.cpu_usage
    class: Utilization
     type: Containers
component: Azure Container Instances
   lookup: average -5m unaligned of average
    units: millicores
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (850) : (900))
     crit: $this > (($status == $CRITICAL) ? (900) : (950))
    delay: down 5m multiplier 1.5 max 1h
  summary: Container CPU on ${label:resource_name}
     info: Average CPU usage of container group ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: sysadmin

# --- Memory ---
# Memory usage in bytes. Default thresholds assume a 1.5 GiB memory allocation.
# Adjust warn/crit values to match your container group memory allocation.
#   1.5 GiB: warn ~1.3 GiB (1395864371), crit ~1.4 GiB (1503238553)
#   4.0 GiB: warn ~3.4 GiB (3650722201), crit ~3.6 GiB (3865470566)

 template: am_container_instances_memory_usage
       on: azure_monitor.container_instances.memory_usage
    class: Utilization
     type: Containers
component: Azure Container Instances
   lookup: average -5m unaligned of average
    units: bytes
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (1288490189) : (1395864371))
     crit: $this > (($status == $CRITICAL) ? (1395864371) : (1503238553))
    delay: down 5m multiplier 1.5 max 1h
  summary: Container memory on ${label:resource_name}
     info: Average memory usage of container group ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: sysadmin

# --- Network ---

 template: am_container_instances_network_rx
       on: azure_monitor.container_instances.network
    class: Workload
     type: Containers
component: Azure Container Instances
   lookup: average -5m unaligned of received
    units: bytes/s
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (100000000) : (125000000))
    delay: down 5m multiplier 1.5 max 1h
  summary: Container inbound traffic on ${label:resource_name}
     info: High inbound network traffic on container group ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: sysadmin

 template: am_container_instances_network_tx
       on: azure_monitor.container_instances.network
    class: Workload
     type: Containers
component: Azure Container Instances
   lookup: average -5m unaligned of sent
    units: bytes/s
    every: 1m
     warn: $this > (($status >= $WARNING)  ? (100000000) : (125000000))
    delay: down 5m multiplier 1.5 max 1h
  summary: Container outbound traffic on ${label:resource_name}
     info: High outbound network traffic on container group ${label:resource_name} \
           in ${label:resource_group} (${label:region})
       to: sysadmin
