ข้ามไปยังเนื้อหาหลัก
ลด 50% ทุกแพลน เวลาจำกัด เริ่มต้นที่ $2.48/mo
Prometheus

Prometheus

Prometheus คือมาตรฐาน monitoring แบบ time-series รองรับ pull-based metrics, PromQL queries, alerting rules และ Kubernetes-native discovery ผ่านการรับรองจาก CNCF และถูกใช้งานที่ SoundCloud (ซึ่งเป็นผู้สร้าง), DigitalOcean และ deployment บน Kubernetes กว่า 80%

ภาพรวม

64.7k

GitHub stars

32

การดูหน้า

สัญญาอนุญาต Apache-2.0 เวอร์ชัน 3.13.2 OS Ubuntu Server 24.04 LTS Min RAM 1 GB IP IPV4,IPV6

การเข้าถึง

  • เปิด https://<SERVER_IP>:9090 ในเบราว์เซอร์ของคุณ
  • ใบรับรองเป็นแบบ self-signed เบราว์เซอร์ของคุณจึงจะแสดงคำเตือนเกี่ยวกับใบรับรอง
  • หน้า targets ของ Prometheus อยู่ที่ https://<SERVER_IP>:9090/targets.
  • เมตริกอยู่ที่ https://<SERVER_IP>:9090/metrics.

เข้าสู่ระบบ

Prometheus ได้รับการป้องกันด้วย HTTP Basic Authentication

  • ชื่อผู้ใช้: admin
  • รหัสผ่าน: เก็บไว้ใน /root/.prometheus-credentials

การยืนยันตัวตนเดียวกันนี้ป้องกันเว็บ UI, API และเอ็นด์พอยต์ /metrics .

ไฟล์และไดเรกทอรีที่สำคัญ

  • ไฟล์ตั้งค่า Prometheus: /etc/prometheus/prometheus.yml
  • ไฟล์ตั้งค่า Web/TLS/Auth: /etc/prometheus/web-config.yml
  • ใบรับรอง TLS: /etc/prometheus/tls/
  • ข้อมูล Prometheus: /var/lib/prometheus
  • Textfile Collector ของ Node Exporter: /var/lib/node_exporter/textfile_collector
  • ข้อมูลรับรอง: /root/.prometheus-credentials
  • ไฟล์ไบนารี Prometheus: /usr/local/bin/prometheus
  • Promtool: /usr/local/bin/promtool
  • ไฟล์ไบนารี Node Exporter: /usr/local/bin/node_exporter
  • เซอร์วิส Prometheus: /etc/systemd/system/prometheus.service
  • เซอร์วิส Node Exporter: /etc/systemd/system/node_exporter.service

การจัดการบริการ

ตรวจสอบ Prometheus:

systemctl status prometheus

รีสตาร์ต Prometheus:

systemctl restart prometheus

ดู log ของ Prometheus:

journalctl -u prometheus -f

ตรวจสอบ Node Exporter:

systemctl status node_exporter

รีสตาร์ต Node Exporter:

systemctl restart node_exporter

ดู log ของ Node Exporter:

journalctl -u node_exporter -f

การเพิ่ม targets

แก้ไข /etc/prometheus/prometheus.yml:

vim /etc/prometheus/prometheus.yml

ตรวจสอบความถูกต้องของการกำหนดค่า:

promtool check config /etc/prometheus/prometheus.yml

โหลด Prometheus ใหม่:

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

ระยะเวลาการเก็บรักษา

Prometheus ถูกตั้งค่าไว้ดังนี้:

  • ระยะเวลาเก็บข้อมูล: 30d
  • ขนาดพื้นที่จัดเก็บสูงสุด: 10GB

ขีดจำกัดใดถึงก่อนจะถูกนำมาใช้

หมายเหตุ

  • ไม่ได้ติดตั้ง Grafana และ Alertmanager คุณสามารถเพิ่มแยกต่างหากและเชื่อมต่อกับ Prometheus อินสแตนซ์นี้ได้
  • เมตริกจะถูกเก็บไว้สูงสุด 30 วันหรือ 10 GB แล้วแต่ขีดจำกัดใดถึงก่อน
  • สามารถเพิ่มเมตริกโฮสต์แบบกำหนดเองเป็นไฟล์ .prom ไว้ที่: /var/lib/node_exporter/textfile_collector

เพิ่มเติมใน Monitoring

แอปที่เกี่ยวข้อง

ติดตั้ง Prometheus ทันที เริ่มต้น $2.48/เดือน