Chuyển đến nội dung chính
Giảm 50% tất cả các gói, có thời hạn. Khởi điểm từ $2.48/mo
Prometheus

Prometheus

Prometheus là chuẩn giám sát dữ liệu chuỗi thời gian. Hỗ trợ thu thập metrics theo mô hình pull, truy vấn PromQL, quy tắc cảnh báo và tự động phát hiện tài nguyên Kubernetes. Đã tốt nghiệp CNCF, được dùng tại SoundCloud (nơi dự án ra đời), DigitalOcean và 80% các triển khai Kubernetes.

Tổng quan

64.7k

Sao GitHub

32

Lượt xem trang

Giấy phép Apache-2.0 Phiên bản 3.13.2 OS Ubuntu Server 24.04 LTS Min RAM 1 GB IP IPV4,IPV6

Truy cập

  • Mở https://<SERVER_IP>:9090 trong trình duyệt của bạn.
  • Chứng chỉ là tự ký, nên trình duyệt của bạn sẽ hiển thị cảnh báo chứng chỉ.
  • Trang targets của Prometheus có tại https://<SERVER_IP>:9090/targets.
  • Các metric có tại https://<SERVER_IP>:9090/metrics.

Đăng nhập

Prometheus được bảo vệ bằng xác thực HTTP Basic.

  • Tên người dùng: admin
  • Mật khẩu: được lưu trữ trong /root/.prometheus-credentials

Cùng cơ chế xác thực này bảo vệ giao diện web, API và endpoint /metrics .

File và thư mục quan trọng

  • Cấu hình Prometheus: /etc/prometheus/prometheus.yml
  • Cấu hình web/TLS/auth: /etc/prometheus/web-config.yml
  • Chứng chỉ TLS: /etc/prometheus/tls/
  • Dữ liệu Prometheus: /var/lib/prometheus
  • Textfile Collector của Node Exporter: /var/lib/node_exporter/textfile_collector
  • Thông tin đăng nhập: /root/.prometheus-credentials
  • Tệp nhị phân Prometheus: /usr/local/bin/prometheus
  • Promtool: /usr/local/bin/promtool
  • Tệp nhị phân Node Exporter: /usr/local/bin/node_exporter
  • Dịch vụ Prometheus: /etc/systemd/system/prometheus.service
  • Dịch vụ Node Exporter: /etc/systemd/system/node_exporter.service

Quản lý dịch vụ

Kiểm tra Prometheus:

systemctl status prometheus

Khởi động lại Prometheus:

systemctl restart prometheus

Xem log Prometheus:

journalctl -u prometheus -f

Kiểm tra Node Exporter:

systemctl status node_exporter

Khởi động lại Node Exporter:

systemctl restart node_exporter

Xem log Node Exporter:

journalctl -u node_exporter -f

Thêm targets

Chỉnh sửa /etc/prometheus/prometheus.yml:

vim /etc/prometheus/prometheus.yml

Xác thực cấu hình:

promtool check config /etc/prometheus/prometheus.yml

Tải lại Prometheus:

curl -sS --cacert /etc/prometheus/tls/prometheus.crt \
  -u admin:<PASSWORD> \
  -X POST https://localhost:9090/-/reload

Thời gian lưu giữ

Prometheus được cấu hình với:

  • Thời gian lưu giữ: 30d
  • Dung lượng lưu trữ tối đa: 10GB

Giới hạn nào đạt trước sẽ được áp dụng.

Ghi chú

  • Grafana và Alertmanager không được cài đặt. Bạn có thể thêm riêng và kết nối chúng với phiên bản Prometheus này.
  • Các metric được lưu giữ tối đa 30 ngày hoặc 10 GB, tùy giới hạn nào đạt trước.
  • Có thể thêm metric máy chủ tùy chỉnh dưới dạng tệp .prom tại: /var/lib/node_exporter/textfile_collector

Thêm trong Monitoring

Ứng dụng liên quan.

Triển khai Prometheus ngay. Từ $2.48/tháng.