prometheus-configuration
設定 Prometheus 監控
Prometheus 設定複雜且容易出錯。本技能提供清晰的範例,包含 scrape 設定、規則和驗證,協助您實作穩健的監控功能。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「prometheus-configuration」。 Create alert rules for high CPU and low disk space.
預期結果:
- 高 CPU 警報在 5 分鐘內使用率超過 80% 時觸發。
- 低磁碟空間警報在 5 分鐘內使用率超過 90% 時觸發。
- 每個警報都包含嚴重性標籤和簡短摘要。
正在使用「prometheus-configuration」。 Show me how to configure Prometheus with Docker Compose.
預期結果:
- Docker Compose 檔案掛載 prometheus.yml 設定檔。
- 資料保存在具名磁碟區中以保留儲存。
- Prometheus 在連接埠 9090 上執行,保留期限為 30 天。
正在使用「prometheus-configuration」。 How do I set up recording rules for HTTP metrics?
預期結果:
- 請求率規則對 5 分鐘內的 http_requests_total 進行 rate 總和計算。
- 錯誤率規則過濾 5xx 狀態碼。
- P95 延遲使用 histogram_quantile 計算百分位數。
安全審計
低風險This is a documentation-only skill containing YAML configuration examples for Prometheus. No executable code, scripts, or malicious network behavior is present. Static findings are false positives caused by pattern-matching on documentation text rather than actual code analysis.
風險因素
⚙️ 外部命令 (38)
品質評分
你能建構什麼
啟動監控堆疊
使用 Helm 部署 Prometheus 並為新叢集套用基準設定。
定義警報涵蓋範圍
為可用性、延遲和資源使用率建立警報規則,並附上清晰的標籤。
暴露應用程式指標
為應用程式端點新增 scrape 作業,包含 TLS 設定和標籤。
試試這些提示
提供一個簡單的 prometheus.yml,包含一個用於我的應用的 scrape 作業,並解釋關鍵欄位。
為請求率、錯誤率和 p95 延遲建立錄製規則,並使用清晰的指標名稱。
為服務當機、高錯誤率和高延遲建立警報規則,並包含標籤和註釋。
展示使用 prometheus.io 註釋和 relabeling 的 Kubernetes pods 的 scrape_config。
最佳實務
- 在部署前使用 promtool 驗證設定和規則
- 設定 scrape 間隔以符合系統負載和保留需求
- 對昂貴的 PromQL 查詢使用錄製規則以提升效能
避免
- 在沒有適當儲存規劃的情況下過於頻繁地 scrape
- 使用沒有清晰標籤和註釋的警報
- 對複雜的儀表板查詢跳過錄製規則