resource "datadog_monitor" "time_skew_delay_on_kube_cluster_name_amp_dev_as_eks" {
  name = "Time Skew Delay on {{kube_cluster_name.name}} - AMP-DEV-AS-EKS"
  type = "query alert"
  query = <<EOT
max(last_5m):avg:ntp.offset{cluster_name:amp-dev-as-eks} by {kube_node,host} > 2
EOT
  message = <<EOT
{{#is_alert}}
### Time Delay on {{host}} is {{value}} sec  > {{threshold}} sec
PRIORITY=HIGH
{{/is_alert}}

@team-amp-developers
EOT
  tags = ["team:amp-developers"]
  draft_status = "published"
  new_group_delay = 60
  on_missing_data = "show_and_notify_no_data"
  require_full_window = false
  monitor_thresholds {
    critical = 2
  }
}
resource "datadog_monitor" "time_skew_delay_on_kube_cluster_name_amp_prod_as_eks" {
  name = "Time Skew Delay on {{kube_cluster_name.name}} - AMP-PROD-AS-EKS"
  type = "query alert"
  query = <<EOT
max(last_5m):avg:ntp.offset{cluster_name:amp-prod-as-eks} by {kube_node,host} > 2
EOT
  message = <<EOT
{{#is_alert}}
### Time Delay on {{host}} is {{value}} sec  > {{threshold}} sec
PRIORITY=HIGH
{{/is_alert}}

@team-amp-developers
EOT
  tags = ["team:amp-developers"]
  draft_status = "published"
  new_group_delay = 60
  on_missing_data = "show_and_notify_no_data"
  require_full_window = false
  monitor_thresholds {
    critical = 2
  }
}
