Skip to content

Latest commit

 

History

History
140 lines (124 loc) · 4.82 KB

rules.md

File metadata and controls

140 lines (124 loc) · 4.82 KB
<style> ul { list-style: none; } </style>

⚠️ Caution ⚠️

Alert thresholds depend on nature of applications.
Some queries in this page may have arbitrary tolerance threshold.

Building an efficient and battle-tested monitoring platform takes time. 😉



    {% for group in site.data.rules.groups %} {% assign groupIndex = forloop.index %} {% for service in group.services %} {% assign serviceIndex = forloop.index %} {% assign nbrExporters = service.exporters | size %} {% for exporter in service.exporters %} {% assign exporterIndex = forloop.index %} {% assign nbrRules = exporter.rules | size %}
  • {% assign serviceId = service.name | replace: " ", "-" | downcase %}

    # {{ groupIndex }}.{{ serviceIndex }}.{% if nbrExporters > 1 %}{{ exporterIndex }}.{% endif %} {{ service.name }} {% if exporter.name %}: {% if exporter.doc_url %} {{ exporter.name }} {% else %} {{ exporter.name }} {% endif %} {% endif %}
          {% if nbrRules > 0 %}
            <small style="font-size: 60%; vertical-align: middle; margin-left: 10px;">
              ({{ nbrRules }} rules)
            </small>
            <span class="clipboard-multiple" data-clipboard-target-id="group-{{ groupIndex }}-service-{{ serviceIndex }}-exporter-{{ exporterIndex }}">[copy section]</span>
          {% endif %}
        </h2>
    
        {% if nbrRules == 0 %}
    

    {% highlight javascript %} // @TODO: Please contribute => https://github.com/samber/awesome-prometheus-alerts 👋 {% endhighlight %} {% else %} {% highlight bash %} $ wget https://raw.githubusercontent.com/samber/awesome-prometheus-alerts/master/dist/rules/{{ service.name | replace: " ", "-" | downcase }}/{{ exporter.slug }}.yml {% endhighlight %} {% endif %}

        <ul>
          {% for rule in exporter.rules %}
          {% assign ruleIndex = forloop.index %}
          {% assign comments = rule.comments | strip | newline_to_br | split: '<br />' %}
          <li>
            <h4 id="rule-{{ serviceId }}-{{ exporterIndex }}-{{ ruleIndex }}">
              <span id="rule-{{ serviceId }}-{{ ruleIndex }}"></span><!-- @deprecated -->
              <a class="anchor" href="#rule-{{ serviceId }}-{{ exporterIndex }}-{{ ruleIndex }}">#</a>
              {{ groupIndex}}.{{ serviceIndex }}.{% if nbrExporters > 1 %}{{ exporterIndex }}.{% endif %}{{ ruleIndex }}.
              {{ rule.name }}
            </h4>
            <summary>
              {{ rule.description }}
              <span class="clipboard-single" data-clipboard-target-id="group-{{ groupIndex }}-service-{{ serviceIndex }}-exporter-{{ exporterIndex }}-rule-{{ ruleIndex }}" onclick="event.preventDefault();">[copy]</span>
            </summary>
            <div id="group-{{ groupIndex }}-service-{{ serviceIndex }}-exporter-{{ exporterIndex }}-rule-{{ ruleIndex }}">
              {% assign ruleName = rule.name | split: ' ' %}
              {% capture ruleNameCamelcase %}{% for word in ruleName %}{{ word | capitalize }} {% endfor %}{% endcapture %}
    

    {% highlight yaml %} {% for comment in comments %}# {{ comment | strip }} {% endfor %}- alert: {{ ruleNameCamelcase | remove: ' ' }} expr: {{ rule.query }} for: {% if rule.for %}{{ rule.for }}{% else %}0m{% endif %} labels: severity: {{ rule.severity }} annotations: summary: {{ rule.name }} (instance {% raw %}{{ $labels.instance }}{% endraw %}) description: "{{ rule.description | replace: '"', '"' }}\n VALUE = {% raw %}{{ $value }}{% endraw %}\n LABELS = {% raw %}{{ $labels }}{% endraw %}"

    {% endhighlight %}

            </div>
            <br/>
          </li>
          {% endfor %}
        </ul>
    
      <hr/>
      </li>
    {% endfor %}
    {% endfor %}
    

    {% endfor %}

Menu

    {% for group in site.data.rules.groups %}
  • {{ group.name }}

      {% for service in group.services %}
    • 👉 {{ service.name }}
    • {% endfor %}
  • {% endfor %}
<script> $('#rules-navbar').affix({offset: {top: 750} }).css('display', 'block'); </script>