오픈소스 APM Scouter 이메일 알람 플러그인 연동

onestone·2022년 8월 5일
1
post-thumbnail

❓ Scouter 이메일 알람 플러그인

  • 서버에서 발생한 Alert 메시지를 이메일로 발송하는 역할을 함

  • 지원되는 Alert 종류

    • Agent의 CPU (warning / fatal)
    • Agent의 Memory (warning / fatal)
    • Agent의 Disk (warning / fatal)
    • 신규 Agent 연결
    • Agent의 연결 해제
    • Agent의 재접속
    • 응답시간의 임계치 초과
    • GC Time의 임계치 초과
    • Thread 갯수의 임계치 초과

1. 플러그인 jar 파일로 만들고 서버에 업로드

  • 플러그인 소스코드 다운로드
    다운로드 링크

  • 소스코드 빌드(maven 사전 설치 필요)

    mvn clean package
  • target/lib 내의 jar 파일 및 빌드된 플러그인 jar 파일 (총 4개)
    -> scouter/server/lib 디렉토리에 전송

    • activation-1.1.1.jar
    • commons-email-1.4.jar
    • javax.mail-1.5.2.jar
    • scouter-plugin-server-alert-email-1.0.0.jar

2. 서버 설정

  • scouter/server/conf/scouter.conf 수정
    # 이메일 발송 여부
    ext_plugin_email_send_alert=true
    # 로깅 여부  
    ext_plugin_email_debug=true
    # 수신할 알람 레벨 (0: INFO, 1: WARN, 2: ERROR, 3: FATAL) 
    ext_plugin_email_level=0
    # SMTP 서버 IP or 도메인
    ext_plugin_email_smtp_hostname=
    # SMTP 서버 포트
    ext_plugin_email_smtp_port=
    # SMTP 인증 사용 여부
    ext_plugin_email_smtpauth_enabled=true
    ext_plugin_email_username=
    ext_plugin_email_password=
    # SSL 사용 여부
    ext_plugin_email_ssl_enabled=true
    # STARTTLS 사용 여부
    ext_plugin_email_starttls_enabled=true
    # 이메일 발신자 계정
    ext_plugin_email_from_address=noreply@scouter.com
    # 이메일 수신자 계정
    ext_plugin_email_to_address=receiver1@scouter.com,receiver2@scouter.com
    # 이메일 참조 수신 계정
    ext_plugin_email_cc_address=ccreceiver@yopmail.com
    # 응답시간 임계치 (0 설정시, 임계치 초과 여부 확인하지 않음)
    ext_plugin_elapsed_time_threshold=5000
    # GC Time 임계치 (0 설정시, 임계치 초과 여부 확인하지 않음)
    ext_plugin_gc_time_threshold=5000
    # Thread Count 임계치 (0 설정시, 임계치 초과 여부 확인하지 않음)
    ext_plugin_thread_count_threshold=300
    # Alert 메세지 발송에서 제외할 NAME 패턴 목록
    ext_plugin_ignore_name_patterns=myTomcat1
    # Alert 메세지 발송에서 제외할 TITLE 패턴 목록   
    ext_plugin_ignore_title_patterns=Elapsed,CONNECTION,activat*
    # Alert 메시지 발송에서 제외할 MESSAGE 패턴 목록
    ext_plugin_ignore_message_patterns=*(/v1/common/user/testuser)*
    # 연속된 동일 Alert을 1시간 동안 제외
    ext_plugin_ignore_continuous_dup_alert=true

3. 서버 재기동

  • 서버를 재기동해야 세팅한 이메일 플러그인이 동작함

4. 호스트 설정

  • 기본적으로 Scouter 설치시 호스트 Alert를 설정할 수 있음
  • 이메일 플러그인 연동시 호스트 Alert를 메일 발송해줌
  • scouter/agent.host/conf/scouter.conf 수정
    # CPU 설정
    cpu_alert_enabled : cpu 알림을 활성화하거나 비활성 (기본 : true)
    cpu_warnig_pct : cpu waring 레벨 알림의 퍼센트 (정수로 설정)
    cpu_fatal_pct : cpu fatal 레벨 알림의 퍼센트 (정수로 설정)
    cpu_check_period_ms : 어느 기간동안 cpu를 체크할지를 지정
    cpu_waring_history, cpu_fatal_history : 각 레벨에 설정한 값의 초과가 몇회 발생하였을때 알림을 알릴지를 설정
    cpu_alert_interval_ms : 설정 시간동안 동일한 알림을 발송하지 않음
    
    # Memory 설정
    mem_alert_enabled=
    mem_alert_interval_ms=
    mem_warning_pct=
    mem_fatal_pct=
    
    # Disk 설정
    disk_alert_enabled=true
    disk_warning_pct=70
    disk_fatal_pct=90
profile
Technical Coordinator

0개의 댓글