산업 빅데이터 서비스 영역인 산업사물인터넷 지원: 프로메테우스 소개 [36]

03: 프로메테우스 소개

  • 목표 : Prometheus의 기능과 특징을 이해합니다.

    • 1단계: 기능
    • 2단계: 기능
  • 구현하다

    • https://prometheus.io/

      이미지-20211005165514332

    • 기능: 서버 성능 지표 모니터링 및 순차 데이터 저장

      • Prometheus는 고위도 데이터 모델을 구현하며 시계열 데이터는 지표 이름과 키-값 쌍으로 구성됩니다.
      • PromQL을 사용하면 수집된 시계열 데이터를 슬라이싱 및 다이싱하여 임시 그래프, 차트, 경고를 생성할 수 있습니다.
      • Prometheus에는 내장 표현식 브라우저, Grafana 통합, 콘솔 템플릿 언어 등 다양한 데이터 시각화 모드가 있습니다.
      • Prometheus는 효율적인 사용자 정의 형식을 사용하여 시계열 데이터를 메모리와 로컬 디스크에 저장하고 기능적 샤딩 및 페더레이션을 통해 탄력적으로 확장합니다.
      • 각 서버는 독립적이며 로컬 저장소에만 의존합니다. Go 언어로 작성된 모든 바이너리는 쉽게 배포할 수 있도록 정적으로 링크되어 있습니다.
      • 경고는 PromQL을 기반으로 유연하게 정의되며 차원 정보를 유지합니다. 경고 관리자는 경고 정보 알림 여부를 제어합니다.
    • 특징

      • 다차원 데이터 모델.
      • 유연한 쿼리 언어.
      • 분산 스토리지에 의존하지 않고 단일 서버 노드가 자율적입니다.
      • 시계열 데이터는 HTTP 기반 가져오기를 통해 수집됩니다.
      • 시계열 데이터는 중간 게이트웨이를 통해 푸시될 수 있습니다.
      • 서비스 검색 또는 정적 구성을 통해 대상 서비스 개체를 검색합니다.
      • Grafana 등 다양한 차트 및 인터페이스 표시를 지원합니다.
  • 요약

    • 프로메테우스의 기능과 특징을 이해합니다.

04: 프로메테우스의 건축

  • 목표 : 프로메테우스의 아키텍처 이해

  • 구현하다

    이미지-20211005172848417

    • 프로메테우스 서버 : 시계열 데이터를 수집하고 저장하는 프로메테우스 마스터 서버

    • Aalert Manager : 알람 정보를 처리합니다.

    • 푸시 게이트웨이 : 단기 작업을 지원하는 푸시 게이트웨이

    • 클라이언트 라이브러리: 애플리케이션 코드 계측을 위한 클라이언트 라이브러리

    • 수출업체: HAProxy, StatsD, Graphite 및 기타 서비스와 같은 특정 수출업체 서비스입니다.

  • 요약

    • 프로메테우스의 아키텍처 이해

05: 프로메테우스 배포

  • 목표 : Prometheus 배포 실현

  • 구현하다

    • 업로드 압축 풀기

      cd ~
      rz
      # 解压安装包
      tar zxvf prometheus-2.26.0.linux-amd64.tar.gz -C /opt
      # 修改文件名
      mv /opt/prometheus-2.26.0.linux-amd64/ /opt/prometheus-2.26
      # 进入解压后的安装包
      cd /opt/prometheus-2.26
      
    • 확인하다

      ./prometheus --version
      
    • 구성 보기 : prometheus.yml

      # my global config
      global:
        scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
        evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
        # scrape_timeout is set to the global default (10s).
      
      # Alertmanager configuration
      alerting:
        alertmanagers:
        - static_configs:
          - targets:
            # - alertmanager:9093
      
      # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
      rule_files:
        # - "first_rules.yml"
        # - "second_rules.yml"
      
      # A scrape configuration containing exactly one endpoint to scrape:
      # Here it's Prometheus itself.
      scrape_configs:
        # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
        - job_name: 'prometheus'
      
          # metrics_path defaults to '/metrics'
          # scheme defaults to 'http'.
      
          static_configs:
          - targets: ['localhost:9090']
      
    • 시스템 서비스 등록

      vim /etc/systemd/system/prometheus.service
      
      [Unit]
      Description=Prometheus
      Documentation=Prometheus Monitoring System
      
      [Service]
      ExecStart=/opt/prometheus-2.26/prometheus --config.file=/opt/prometheus-2.26/prometheus.yml
      Restart=on-failure
      [Install]
      WantedBy=multi-user.target
      
    • 시작하다

      # 设置开机自启动
      systemctl enable prometheus
      # 启动服务
      systemctl start prometheus
      # 查看服务状态
      systemctl status prometheus
      
    • 확인 : node1:9090

      이미지-20211005174237698

  • 요약

    • Prometheus 배포 실현

추천

출처blog.csdn.net/xianyu120/article/details/132326826