การเข้าถึง
- เปิด
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