mirror of
https://github.com/healthchecks/healthchecks.git
synced 2024-11-23 16:07:39 +00:00
18 lines
2.5 KiB
HTML
18 lines
2.5 KiB
HTML
<div class="highlight"><pre><span></span><span class="kn">package</span><span class="w"> </span><span class="nx">main</span><span class="w"></span>
|
|
|
|
<span class="kn">import</span><span class="w"> </span><span class="s">"fmt"</span><span class="w"></span>
|
|
<span class="kn">import</span><span class="w"> </span><span class="s">"net/http"</span><span class="w"></span>
|
|
<span class="kn">import</span><span class="w"> </span><span class="s">"time"</span><span class="w"></span>
|
|
|
|
<span class="kd">func</span><span class="w"> </span><span class="nx">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
|
|
<span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">client</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="o">&</span><span class="nx">http</span><span class="p">.</span><span class="nx">Client</span><span class="p">{</span><span class="w"></span>
|
|
<span class="w"> </span><span class="nx">Timeout</span><span class="p">:</span><span class="w"> </span><span class="mi">10</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="nx">time</span><span class="p">.</span><span class="nx">Second</span><span class="p">,</span><span class="w"></span>
|
|
<span class="w"> </span><span class="p">}</span><span class="w"></span>
|
|
|
|
<span class="w"> </span><span class="nx">_</span><span class="p">,</span><span class="w"> </span><span class="nx">err</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="nx">client</span><span class="p">.</span><span class="nx">Head</span><span class="p">(</span><span class="s">"{{ ping_url }}"</span><span class="p">)</span><span class="w"></span>
|
|
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="nx">err</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="kc">nil</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
|
|
<span class="w"> </span><span class="nx">fmt</span><span class="p">.</span><span class="nx">Printf</span><span class="p">(</span><span class="s">"%s"</span><span class="p">,</span><span class="w"> </span><span class="nx">err</span><span class="p">)</span><span class="w"></span>
|
|
<span class="w"> </span><span class="p">}</span><span class="w"></span>
|
|
<span class="p">}</span><span class="w"></span>
|
|
</pre></div>
|