Cloudera Manager(7.13.1 기준) 에서 CPU·디스크 같은 임계점 트리거를 만들고, 알림이 실제 이메일로 나가게 하는 설정과, Send Test Alert 가 발송되지 않을 때의 진단 절차다. 알림은 다음 경로로 전달된다.
Service / Role / Host 이벤트 → Event Server (7184/7185) → Alert Publisher → Email / SNMP Trap / Custom Script
"무엇을 알림으로 보낼 것인가" 는 각 서비스 Configuration 의 Monitoring 항목에서, "어디로 어떻게 보낼 것인가" 는 Cloudera Management Service 의 Alert Publisher 역할에서 따로 설정한다.
트리거는 tsquery 로 조건을 정의하고, 조건이 충족되면 대상의 Health 를 Concerning 또는 Bad 로 바꾼다. 호스트 리소스는 Hosts → All Hosts → 호스트, 서비스 지표는 Clusters → 서비스의 Status 페이지에서 Health Tests 섹션 → Create Trigger 로 만든다. Name, Expression(Metric / Scalar Function / 비교자 / 값), Action(Mark as concerning 또는 Mark as bad), Stream Threshold, Enabled 를 채운다. 복잡한 조건은 Edit manually 로 직접 쓴다.
IF (SELECT cpu_percent WHERE entityName=$HOSTID AND min(cpu_percent) > 90) DO health:concerning
IF (SELECT cpu_percent WHERE entityName=$HOSTID AND min(moving_avg(cpu_percent, 300)) > 90) DO health:bad
IF (SELECT capacity_free WHERE entityName RLIKE ".*" AND category=FILESYSTEM AND hostname=$HOSTNAME AND last(capacity_free) < 10737418240) DO health:concerning
메모리는 physical_memory_used, HDFS 전체 사용량은 dfs_capacity_used 를 쓰며, 메트릭 이름은 Charts → Chart Builder 에서 SELECT 뒤 자동완성으로 확인한다. 생성된 트리거는 전역 목록이 없고 만든 대상의 Status 페이지 Health Tests 에 항목으로 나타난다(정상이면 Show n Good 을 펼친다). 서비스 Configuration 에서 "trigger" 로 검색하면 Service Triggers / Role Triggers / Host Triggers 에 JSON 으로 전체 목록이 보인다.
Administration → Alerts → Mail Server 탭(또는 Cloudera Management Service → Alert Publisher → Configuration → Main) 에서 Enable Email Alerts, Mail Server Protocol(smtp/smtps), Hostname, Port(25/465/587), Username/Password(인증 없으면 공란), Mail From Address, Mail Message Recipients, Mail Message Format(text/json) 을 설정한다. 비밀번호에 @ # $ % ^ & * 같은 특수문자가 있으면 RAW(...) 로 감싼다. 저장 후 Alert Publisher 를 재시작하지 않으면 반영되지 않으며, Administration → Alerts 의 Send Test Alert 로 확인한다.
트리거가 발동해도 메일이 오지 않는 가장 흔한 원인은 임계값 불일치다. 서비스의 Health Alert Threshold 기본값이 Bad 인데 트리거 Action 이 health:concerning 이면 메일이 나가지 않는다. 트리거를 DO health:bad 로 바꾸거나 임계값을 Concerning 으로 낮춘다. "죽었을 때만" 받으려면 Bad 로 두고, 복구 알림이 필요하면 Enable Alerts for Transitioning Out of Alerting Health Threshold 를 켠다. 호스트 다운은 Hosts → All Hosts → Configuration 의 Health Alert 항목에서 따로 켠다. 대규모 장애 시 메일 폭탄을 막으려면 Alert Publisher 의 Maximum Batch Size / Maximum Batch Interval 을 키운다. 발송 이력은 Diagnostics → Events 에서 Alert 필터로 본다.
curl -s -u <admin> "https://<cm-host>:7183/api/v54/events?query=alert==true;serviceName==hdfs"
/opt/cloudera/alert/alert 같은 경로가 있으면 Cloudera 기본 경로가 아니라 Custom Alert Script 다. Alert Publisher Configuration 의 Custom Alert Script 에 등록돼 있는지 확인하고, 스크립트는 Alert Publisher 호스트에서 cloudera-scm 사용자가 읽기·실행할 수 있어야 하며 알람 목록이 담긴 JSON 파일 경로를 인자로 받는다(SERVICE_TYPE: HDFS, EVENTCODE: EV_SERVICE_HEALTH_CHECK_BAD 등). 표준 출력은 /var/log/cloudera-scm-alertpublisher/ 로그에 남는다.
LOG=/var/log/cloudera-scm-alertpublisher/mgmt-cmf-mgmt-ALERTPUBLISHER-*.log.out
grep -A 40 "Test Alert" $LOG | tail -120
grep -iE "MessagingException|Failed delivery|DefaultErrorHandler|AuthenticationFailed|relay|Connection refused|SocketTimeout" $LOG | tail -50
sudo ss -tlnp | grep -E '7184|7185'
nc -zv <event-server-host> 7184
nc -zv <smtp-host> 25
nc -zv <smtp-host> 587
| 로그 | 원인 | 조치 |
|---|---|---|
EventStoreConsumer ... 7184 ... Connection refused |
Alert Publisher 가 Event Server 에 붙지 못함. Health/Log Alert 가 아예 나가지 않는다 | Event Server 역할 상태·디스크·OOM 확인 후 Event Server 를 먼저 정상화하고 Alert Publisher 를 재시작. 같은 호스트라면 기동 순서 경합인 경우가 많다 |
Generated subject [Cloudera Alert] Test Alert. 뒤에 아무것도 없음 |
메일 본문 생성까지 성공, SMTP 전송 구간 문제 | 그 뒤 20~40줄을 확인 |
MailConnectException ... Connection refused (수십 ms 만에 실패) |
포트에 리스너가 없거나 방화벽 REJECT. timeout 이 아니라 refused 면 DROP 이 아니다 | 사내 릴레이가 587/465 만 여는지 확인하고 포트·프로토콜(587 은 smtp, 465 는 smtps) 을 맞춘다 |
SocketTimeoutException |
방화벽 DROP | 아웃바운드 허용 |
AuthenticationFailedException |
계정 오류 | RAW(...) 확인 |
550 relay not permitted |
릴레이 정책 | Alert Publisher 호스트 IP 를 릴레이 허용 목록에 등록, From 주소를 사내 도메인으로 |
| 에러 없음 | 실제 발송됨 | 스팸함·격리함 확인 |
로그가 전혀 없으면 Alert Publisher Logging Threshold 를 DEBUG 로, Java Configuration Options 에 -Dmail.debug=true 를 넣고 재시작해 테스트한 뒤 반드시 원복한다.
SMTP 연결까지 정상인데도 발송이 실패하며 WARN This exception is ignored 로 조용히 끝나는 경우가 있다.
java.lang.NoClassDefFoundError: org/apache/camel/attachment/AttachmentMessage
at org.apache.camel.component.mail.MailBinding.populateMailMessage(MailBinding.java:145)
rpm -ql cloudera-manager-daemons | grep -i camel 로 보면 camel 3.14.9-cloudera 모듈 14개 중 camel-mail 은 있는데 필수 의존인 camel-attachments 가 패키지 원본 목록에조차 없다. 설정으로 풀 수 없는 제품 패키징 누락이므로 Cloudera 지원 케이스를 열고, 그동안은 Maven Central 의 org.apache.camel:camel-attachments:3.14.9 를 무결성 검증 후 /opt/cloudera/cm/lib/ 에 root:root 644 로 두고 Alert Publisher 를 재시작하거나, Custom Alert Script 로 Camel mail 컴포넌트를 우회한다. 수동 배치한 JAR 은 변경관리에 기록하고 정식 수정본 적용·CM 업그레이드 전에 제거한다.