Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTC-8156 add ansible monitor function #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

juser0719
Copy link

@juser0719 juser0719 commented Jan 7, 2025

Fixes: #nnn
Related: Relevant tracking issues, for context
Merge before/after: Dependent or prerequisite PRs

Description

  • SSM 클라이언트에 ansible 로그 모니터링 기능 추가

  • HealthChecking 단계에서 ansible 실행 결과 확인 로직 추가

  • 실시간 로그 출력 및 실패 감지 기능 구현

  • MonitorAnsibleLog Flow

1. tail -f 명령어를 통해 /var/log/ansible.log 파일 모니터링 시작
2. 1초 간격으로 로그 내용 확인 -> 이전 로그 내용과 비교하여 새로운 내용만 출력 -> PLAY RECAP이 발견될 때까지 계속 모니터링
3. failed=0 && unreachable=0 인 경우 성공 처리

User facing changes (remove if N/A)

Follow-up Work (remove if N/A)

}

if !strings.Contains(currentContent, "PLAY RECAP") {
time.Sleep(time.Second)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sleep보다 좋은 체크 방법이 있으면 좋겠네요

@YoungJinJung
Copy link
Contributor

sleep으로 거는것 보다 이벤트 기반으로 동작하는게 더 좋을거 같아요.
예를 들면 실패하면 실패한 이벤트를 어딘가에 pub하고 goployer에서는 sub을 해서 본다든가 하는 방향으로

@juser0719
Copy link
Author

juser0719 commented Jan 7, 2025

sleep으로 거는것 보다 이벤트 기반으로 동작하는게 더 좋을거 같아요. 예를 들면 실패하면 실패한 이벤트를 어딘가에 pub하고 goployer에서는 sub을 해서 본다든가 하는 방향으로

오 좋은 제안 같습니다. 이벤트 기반으로 가면 확실히 깔끔하고 좋을 것 같긴 한데요, 지금은 ansible 로그만 체크하는 심플한 기능이라 일단은 심플하게 가고, 나중에 실제로 문제되는 부분이 생기면 그때 이벤트 기반으로 바꾸는건 어떨까요..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants