📂 Monitoring & Observability/Scouter

[Scouter] Springboot와 Scouter 연동하기

dhyuck 2022. 4. 6. 00:06
반응형

  • Scouter 정보
    • Scouter 버전 : 2.15.0
  • Java Application 정보
    • Java 11
    • Springboot 2.6.5
  • 기타 정보
    • 사용 Port : 6100
    • 스카우터 설치 디렉터리 : /application/scouter

스카우터 다운로드

  • 스카우터 다운로드

      cd /application
      wget https://github.com/scouter-project/scouter/releases/download/v2.15.0/scouter-all-2.15.0.tar.gz
      tar -zxvf scouter-all-2.15.0.tar.gz

스카우터 서버

  • 설정정보 /application/scouter/server/conf/scouter.conf

      # Server
      server_id=demo-collector-server
    
      # Network
      net_udp_listen_port=6100
      net_tcp_listen_port=6100
    
      # Dir
      db_dir=/application/scouter/server/database
      log_dir=/application/scouter/server/logs
    
      # Log
      log_rotation_enabled=true
    
      # Compress
      compress_xlog_enabled=true
      compress_profile_enabled=true
    
      # Manager
      mgr_purge_enabled=false
  • 기동 스크립트/application/scouter/server/startup.sh

  • 중지 스트립트 /application/scouter/server/stop.sh


스카우터 호스트 에이전트

  • 설정정보 /application/scouter/agent.host/conf/scouter.conf

      # Network
      net_collector_ip=127.0.0.1
      net_collector_udp_port=6100
      net_collector_tcp_port=6100
    
      # Object
      obj_name=demo-app-server
    
      # Alert
      disk_alert_enabled=true
      disk_warning_pct=80
      disk_fatal_pct=90
    
      cpu_alert_enabled=true
      cpu_warning_pct=80
      cpu_fatal_pct=90
    
      mem_alert_enabled=true
      mem_warning_pct=80
      mem_fatal_pct=90
  • 기동 스크립트 /application/scouter/agent.host/host.sh

  • 중지 스크립트 /application/scouter/agent.host/stop.sh


스카우트 자바 에이전트

  • 설정정보 /application/scouter/agent.java/conf/spring-scouter.conf

      # Network
      net_collector_ip=127.0.0.1
      net_collector_udp_port=6100
      net_collector_tcp_port=6100
    
      # Object
      obj_host_name=demo-app-server
      obj_name=demo-springboot-app
    
      # Trace
      trace_interservice_enabled=true
      trace_http_client_ip_header_key=X-Forwarded-For
  • 기동 명령

      nohup java -javaagent:/application/scouter/agent.java/scouter.agent.jar \
      -DScouter.config=/application/scouter/agent.java/conf/springboot-scouter.conf \
      -Dobj_host_name=demo-app-server \
      -Dobj_name=demo-springboot-app \
      -jar /application/springboot-scouter-0.0.1-SNAPSHOT.jar 2>&1 &
  • 중지 명령

      kill -15 `ps -ef | grep java | grep Dobj_name=demo-springboot-app | awk '{print $2}'`

반응형