💻
DevOps Cookbook
  • Home
    • Meiko DevOps Cookbook
  • Gitlab
    • Tips
      • 사전 정의된 CI/CD 변수의 기본 세트
    • 딥다이브 Gitlab CI/CD
      • GitLab CI/CD 시작하기
        • .gitlab-ci.yml 파일
        • Runner
        • 파이프라인
        • CI/CD 변수
        • CI/CD 컴포넌트
      • CI/CD YAML 구문 참조
    • CI/CD Notifications
      • CI/CD slack notifiaction 구축작업 결과
  • Kubernetes
    • Persistence Volume
      • play-cluster
    • Ingress
      • Ingress란
      • 수동으로 ingress 배포하기
    • Security
    • HPA
      • hpa troubleshooting history
        • 1. HELM_UPGRADE_VALUES_FILE로 hpa가 추가되지 않는 원인
        • 2. targetCPUUtilizationPercentage 계산은 어떻게 되는가
        • 3. helm values에 cpu resource 단위를 1로 했을 때 실제 파드에 1m( 0.001 ) 코어가 부여된 것
        • 4. pod cpu resources가 할당받은 것을 나타내는 것인 지 현재 사용량을 나타내는 것인지 검증
        • 5. 설정한 hpa를 기반으로 pod auto scaling이 동작하는 지 검증
      • HorizontalPodAutoscaler의 behavior 필드 중 stabilizationWindowSeconds 값이 Kubernetes 코드에서 어떻게 사용되는지 분석
  • prometheus
    • prometheus 리소스 alert 세팅
      • 슬랙 채널 구성
      • alert 환경 구성 가이드
  • Loki
    • loki-grafana alert 세팅
      • 1차 검증 결과
      • Alert 환경 구성 가이드
  • load test
    • nGrinder
      • nGrinder Test Configuration 값들
      • 질문리스트
        • groovy는 JUnit 스타일에 포함되지 않는건가 ? + GTest가 뭔지 좀 헷갈린다
      • Script
        • Groovy Script Structure
          • reference
          • Groovy script deep dive
          • Groovy Script 실행 구조 분석
      • Test
        • [nGrinder] single endpoint load test 하기
          • [nGrinder] single endpoint load test script 기반 cpu 사용량 테스트
          • [nGrinder] single endpoint load test script 기반 pod autoscaling 테스트
        • [nGrinder] multi endpoint load test 하기
          • [nGrinder] multi endpoint load test script에 정의한 test들이 실행 순서를 보장 받는가?
  • AWS
    • aws-cli
      • eks cluster vpc 스펙보기
    • aws-vpc
  • EKS
    • youtube links
    • EKS best practice
    • 질문 정리
  • Istio
    • Istio Basic
      • Istio 컴포넌트 별 역할
      • Kubernetes Ingress와 Istio VirtualService의 관계
    • Gateway
      • Gateway 주요 특징
      • Istio Gateway와 Kubernetes Ingress의 주요 차이점
  • IAC
    • Terraform
      • 테라폼 설치
      • 테라폼 문서
      • 테라폼 개념
        • 언어 구조
        • 사용 순서
        • 상태파일 (tfstate)
        • 변수 정의 방법
      • Terraform - AWS VPC
    • Ansible
      • Ansible 초기 학습 내용
      • Ansible Playbook
      • Ansible Study
        • Inventory
        • Playbook
          • Module
        • Variable
  • etc
    • Toss SLASH24
    • Elastic Load Balancing
    • 낙서장
      • IRSA
    • deep dive
      • Istio 공식문서 번역
        • Overview
          • What is Istio?
          • Why choose Istio?
          • Sidecar or ambient?
        • Concepts
          • Traffic Management
        • Page
      • eks 에서 control plane < - > data plane 통신 원리
Powered by GitBook
On this page
  • 1. pre-requisites
  • 1.1 contact-point에 연결할 네이밍 컨벤션이 맞춰진 slack 채널과 webhook URL을 보유하고 있는가?
  • 1.2 alert 을 분류할 folder가 생성되어 있는가?
  • 2. contact point 생성
  • 3. [optional] 시간대 별 알림이 필요한 경우
  • 4. Notification Policy 생성
  • 5. alert rule 생성
Edit on GitHub
  1. prometheus
  2. prometheus 리소스 alert 세팅

alert 환경 구성 가이드

Previous슬랙 채널 구성Nextloki-grafana alert 세팅

Last updated 1 year ago

1. pre-requisites

1.1 contact-point에 연결할 네이밍 컨벤션이 맞춰진 slack 채널과 webhook URL을 보유하고 있는가?

1.2 alert 을 분류할 folder가 생성되어 있는가?

naming convention : cluster resources - dev-node-compute-resources project ( namespace resources ) - dev-projectName-compute-resources

2. contact point 생성

  1. contact point type -> slack 선택

  2. name

    1. slack channel 이름

  3. webhook URL

    1. contact point 추가에 필요한 사전 작업 가이드 에서 생성한 webhook URL 입력

    2. Test 버튼 클릭 후 해당 채널에 알림 왔는 지 테스트

    3. Optional Slack settings

      1. Mention Channel

        1. Every channel member

          1. 채널 알림 메시지에 @channel 멘션 추가 됨

      2. Disable resolved message

        1. alert rule 조건이 firing → normal status가 되었을 때 resolved 되었다는 메시지가 오지 않음

  4. Save contact point 버튼 누르고 생성


3. [optional] 시간대 별 알림이 필요한 경우

  • Time range 제외한 값들은 사진과 값을 모두 같게하고

  • Time range 값에 원하는 시간대를 UTC 기준으로 넣은 후 생성


4. Notification Policy 생성

  • + Add matcher 클릭

    종류
    Label
    Value

    cluster resource

    cluster

    dev

    project resource

    project

    project name

  • Contact point

    • 2. contact point 생성 한 것 선택 ( 선택한 슬랙 채널로 alert-rule 발동 시 알림 전송 )

  • Overide general timings

    • Group wait

      • 30s

    • Group interval

      • 1m

    • Repeat interval

      • 1m

  • Mute timing

    • 3. [optional] 시간대 별 알림이 필요한 경우 여기서 생성한 것을 적용하고 싶다면, 선택


5. alert rule 생성

  1. cluster resource 또는 project resource 모니터할 건 지 고르기

  2. Query 작성

  • project resource query

query
cpu
memory
disk

A-query

sum(rate(container_cpu_usage_seconds_total{namespace="your-namespace”}[5m])) by (namespace)

sum(avg_over_time(container_memory_working_set_bytes{namespace="your-namespace"}[10m])) / (1024^3)

필요없음

B-expression

WHEN → 정해야 함 IS ABOBE → 임계치 값 정해야 함

WHEN → 정해야 함 IS ABOBE → 임계치 값 정해야 함

  • cluster resource query

query
cpu
memory
disk

A-query

(1 - (avg(irate({name=~"node_cpu_seconds_total|windows_cpu_time_total",mode="idle"}[5m])))) * 100

(1 - sum({name="node_memory_MemAvailable_bytes|windows_os_physical_memory_free_bytes"}) / sum({name="node_memory_MemTotal_bytes|windows_cs_physical_memory_bytes"})) * 100

(1 - (((sum(node_filesystem_free_bytes{device!"rootfs|HarddiskVolume.+"}) OR on() vector(0)) + (sum(windows_logical_disk_free_bytes{volume!"(HarddiskVolume.+|[A-Z]:.+)"}) OR on() vector(0))) / ((sum(node_filesystem_size_bytes{device!"rootfs|HarddiskVolume.+"}) OR on() vector(0)) + (sum(windows_logical_disk_size_bytes{volume!"(HarddiskVolume.+|[A-Z]:.+)"}) OR on() vector(0))))) * 100

B-expression

WHEN → max() IS ABOBE → 65

WHEN → max() IS ABOBE → 70

WHEN → max() IS ABOBE → 70

  1. Alert evaluation behaivor 작성

    1. e.g 1m for 2m

      1. 1분마다 rule 작동 + 2분간 지속 시 알림

  1. alert detail 설정

    1. Rule name

      1. cpu

        1. name : cpu-max-warning-alert-rule

      2. memory

        1. memory-max-warning-alert-rule

      3. disk

        1. disk-max-warning-alert-rule

    2. Folder

      1. 분류하기 위해 초반에 생성한 또는 이미 존재하는 folder 선택

    3. Group

      1. cluster

        1. dev-node

      2. project인 경우

        1. project name

    4. summary

      1. 각자 설명 추가

    5. (중요) Custom Labels

      1. 공통

        1. severity = warning

      2. 프로젝트 분류 위한 label 추가 ( 4. Notification policy 생성 할 때 add matcher 에 넣은 값을 같이 넣어줘야 해당 채널로 알림이 전송됨 )

        1. cluster resource 인 경우

          1. cluster = dev

        2. project resource 인 경우

          1. project = projectName

    6. Save 클릭하여 생성

New contact point 클릭
contact point type -> slack 선택
Notification policies → New mute timing 클릭
Notification policies → New policy 클릭
Alerting → New alert rule 선택