mirror of
https://github.com/healthchecks/healthchecks.git
synced 2024-11-23 07:57:39 +00:00
63 lines
3.5 KiB
Plaintext
63 lines
3.5 KiB
Plaintext
<h1>Configuring Prometheus</h1>
|
||
<p>SITE_NAME supports exporting metrics and check statuses to
|
||
<a href="https://prometheus.io/">Prometheus</a>, for use with <a href="https://grafana.com/">Grafana</a>.</p>
|
||
<p>You can generate the metrics export endpoint by going to your project settings
|
||
and <strong>creating a read-only API key</strong>. You will then see the link to
|
||
the Prometheus endpoint:</p>
|
||
<p><img alt="Project's API Keys" src="IMG_URL/prometheus_endpoint.png" /></p>
|
||
<h2>Update the prometheus.yml</h2>
|
||
<p>You can copy the Prometheus endpoint URL and add it to the Prometheus configuration:</p>
|
||
<div class="highlight"><pre><span></span><code><span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">job_name</span><span class="p">:</span><span class="w"> </span><span class="s">"healthchecks"</span>
|
||
<span class="w"> </span><span class="nt">scrape_interval</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">60s</span>
|
||
<span class="w"> </span><span class="nt">scheme</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">SITE_SCHEME</span>
|
||
<span class="w"> </span><span class="nt">metrics_path</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">/projects/{your-project-uuid}/metrics/{your-readonly-api-key}</span>
|
||
<span class="w"> </span><span class="nt">static_configs</span><span class="p">:</span>
|
||
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">targets</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">[</span><span class="s">"SITE_HOSTNAME"</span><span class="p p-Indicator">]</span>
|
||
</code></pre></div>
|
||
|
||
<p>Notice how we split up the URL and paste in the scheme, domain, and path separately.</p>
|
||
<p>Reload Prometheus, and your changes should be live, coming in under the <code>hc_</code> prefix.</p>
|
||
<h2>Available Metrics</h2>
|
||
<p>The Prometheus metrics endpoint exports the following metrics:</p>
|
||
<dl>
|
||
<dt>hc_check_up</dt>
|
||
<dd>
|
||
<p>For every check, indicates whether the check is currently up
|
||
(1 for yes, 0 for no).</p>
|
||
<p>Labels:</p>
|
||
<ul>
|
||
<li><code>name</code> – the name of the check</li>
|
||
<li><code>tags</code> – check's tags as a text string; multiple tags are delimited with spaces</li>
|
||
<li><code>unique_key</code> – a stable, unique identifier of the check (derived from the check's code)</li>
|
||
</ul>
|
||
</dd>
|
||
<dt>hc_check_started</dt>
|
||
<dd>
|
||
<p>For every check, indicates whether the check is currently running
|
||
(1 for yes, 0 for no).</p>
|
||
<p>Labels:</p>
|
||
<ul>
|
||
<li><code>name</code> – the name of the check</li>
|
||
<li><code>tags</code> – check's tags as a text string; multiple tags are delimited with spaces</li>
|
||
<li><code>unique_key</code> – a stable, unique identifier of the check (derived from the check's code)</li>
|
||
</ul>
|
||
</dd>
|
||
<dt>hc_tag_up</dt>
|
||
<dd>
|
||
<p>For every tag, indicates whether all checks with this tag are up
|
||
(1 for yes, 0 for no).</p>
|
||
<p>Labels:</p>
|
||
<ul>
|
||
<li><code>tag</code> – name of the tag</li>
|
||
</ul>
|
||
</dd>
|
||
<dt>hc_checks_total</dt>
|
||
<dd>The total number of checks.</dd>
|
||
<dt>hc_checks_down_total</dt>
|
||
<dd><br>The number of checks currently down.</dd>
|
||
</dl>
|
||
<h2>Constructing URLs to Check Details Pages</h2>
|
||
<p>You can use the <code>unique_key</code> labels to construct URLs to check's
|
||
details pages in SITE_NAME. Construct the URLs like so:</p>
|
||
<div class="highlight"><pre><span></span><code>SITE_ROOT/cloaked/{unique_key}/
|
||
</code></pre></div> |