<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # **報警規則** <br /> 報警規則使您可以基于Prometheus表達式定義報警條件,并將有關觸發報警的通知發送到外部服務。 只要報警表達式在給定的時間點產生一個或多個向量元素,該報警就被視為以這些元素的標簽集處于活躍狀態。 ## **定義報警規則** 報警規則在Prometheus中的配置方式與記錄規則相同。 帶有報警的示例規則文件如下: ~~~ groups: - name: example rules: - alert: HighRequestLatency expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5 for: 10m labels: severity: page annotations: summary: High request latency ~~~ 可選填的`for`子句,可以使Prometheus在第一次遇到一個新的表達式向量元素和計數一個Firing警報的該元素之間等待一段時間。 在這種情況下,Prometheus將在每次發出警報之前評估、檢查警報在10分鐘內是否繼續處于活躍狀態。活躍但尚未觸發的元素處于掛起(pending)狀態。 `labels`子句允許指定一組附加標簽來附加到警報。 任何現有的沖突標簽都將被覆蓋。 標簽值可以模板化。 `annotations`子句指定一組信息標簽,這些標簽可用于存儲更長的附加信息,例如警報描述或運行手冊鏈接。 注釋值可以模板化。 ## **模版化 Templating** 標簽(labels)和注釋(annotations)值可以使用[控制臺模板(console templates)](https://prometheus.io/docs/visualization/consoles)進行模板化。 `$labels`變量保存報警實例的標簽鍵/值對。 可以通過`$externalLabels`變量訪問已配置的外部標簽。 `$value`變量保存警報實例的評估值。 ~~~ # To insert a firing element's label values: {{ $labels.<labelname> }} # To insert the numeric expression value of the firing element: {{ $value }} ~~~ 示例 ~~~ groups: - name: example rules: # Alert for any instance that is unreachable for >5 minutes. - alert: InstanceDown expr: up == 0 for: 5m labels: severity: page annotations: summary: "Instance {{ $labels.instance }} down" description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes." # Alert for any instance that has a median request latency >1s. - alert: APIHighRequestLatency expr: api_http_request_latencies_second{quantile="0.5"} > 1 for: 10m annotations: summary: "High request latency on {{ $labels.instance }}" description: "{{ $labels.instance }} has a median request latency above 1s (current value: {{ $value }}s)" ~~~ ## **運行時檢查報警** 要手動檢查哪些警處于活躍狀態(pending或firing),請導航到Prometheus的“Alerts”選項卡。 這將向您顯示每個定義的警報當前處于活躍狀態的確切標簽集。 對于掛起(pending)和觸發(firing)警報,Prometheus還存儲格式為`ALERTS {alertname =“ <警報名稱>”,alertstate =“ pending | firing”,<其他警報標簽>}`的合成時間序列。 只要警報處于指示的活躍(掛起或觸發)狀態,樣本值就設置為1;如果不再是這種情況,則將系列標記為陳舊狀態(stale)。 ## **發送報警通知** Prometheus的報警規則擅長于確定當前已有問題的內容,但它們并不是完整的報警通知解決方案。 在簡單的警報定義之上,還需要另一層來做添加摘要、通知速率限制、靜默和報警依賴關系等。 在Prometheus的生態系統中,[Alertmanager](https://prometheus.io/docs/alerting/alertmanager/)擔當了這個角色。 因此,Prometheus可以配置為定期將有關警報狀態的信息發送到Alertmanager實例,該實例隨后負責調度正確的通知。 可以將Prometheus[配置](https://prometheus.io/docs/prometheus/latest/configuration/configuration/)為通過其服務發現機制,自動發現可用的Alertmanager實例。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看