diff --git a/static/img/docs/ddwrt.png b/static/img/docs/ddwrt.png new file mode 100644 index 00000000..ebc7461d Binary files /dev/null and b/static/img/docs/ddwrt.png differ diff --git a/static/img/docs/routeros1.png b/static/img/docs/routeros1.png new file mode 100644 index 00000000..bc10da09 Binary files /dev/null and b/static/img/docs/routeros1.png differ diff --git a/static/img/docs/routeros2.png b/static/img/docs/routeros2.png new file mode 100644 index 00000000..2cd5c824 Binary files /dev/null and b/static/img/docs/routeros2.png differ diff --git a/templates/docs/network_routers.html-fragment b/templates/docs/network_routers.html-fragment new file mode 100644 index 00000000..c55a38f0 --- /dev/null +++ b/templates/docs/network_routers.html-fragment @@ -0,0 +1,51 @@ +<h1>Network Routers</h1> +<p>Certain network router operating systems can be configured to send regular HTTP(S) +requests to SITE_NAME directly from the router. This is a handy way to monitor them: when +the router loses its WAN connection, it will not be able to ping SITE_NAME, and SITE_NAME +will notify you about the outage.</p> +<h2>DD-WRT</h2> +<p><a href="https://dd-wrt.com/">DD-WRT</a> is a Linux-based firmware for routers that runs on wide +variety of router models. DD-WRT ships with a cron daemon and wget utility. You can +enable the cron daemon and edit crontab in DD-WRT control panel, +<strong>Administration › Management › Cron</strong>.</p> +<p>The crontab syntax on DD-WRT is:</p> +<div class="highlight"><pre><span></span><code><span class="p">[</span><span class="n">cron</span><span class="w"> </span><span class="n">expression</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="n">username</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="n">command</span><span class="p">]</span> +</code></pre></div> + +<p>Example for sending a ping every minute:</p> +<div class="highlight"><pre><span></span><code><span class="k">*</span> * <span class="gs">* *</span> * root wget PING_URL +</code></pre></div> + +<p>Screenshot:</p> +<p><img alt="DD-WRT control panel" src="IMG_URL/ddwrt.png" /></p> +<h2>MikroTik RouterOS</h2> +<p><a href="https://mikrotik.com/software">MikroTik RouterOS</a> is a router operating system used +primarily on MikroTik network hardware. Among its many features is scripting support +and a scheduler.</p> +<p>First, create a script in WebFig, <strong>System › Scripts › Add New</strong>. Use the following +parameters:</p> +<ul> +<li>Name: <code>ping</code> (example, you can use a different name)</li> +<li>Policy: <code>read</code>, <code>test</code></li> +<li>Source: <code>/tool fetch url="/tool fetch url="PING_URL" output=none</code></li> +</ul> +<p><img alt="DD-WRT control panel" src="IMG_URL/routeros1.png" /></p> +<p>Then, create a schedule in WebFig, <strong>System › Scheduler › Add New</strong>. Use parameters:</p> +<ul> +<li>Interval: <code>00:01:00</code> (one minute)</li> +<li>Policy: <code>read</code>, <code>test</code></li> +<li>On Event: <code>ping</code> (the name of the script from the previous step)</li> +</ul> +<p><img alt="DD-WRT control panel" src="IMG_URL/routeros2.png" /></p> +<p>Notes:</p> +<ul> +<li>The <code>output=none</code> parameter tells the system to discard response body. Without + this parameter, the system will save response body to a file, which will additionally + require the <code>write</code> policy.</li> +<li>The "tool fetch" utility supports HTTPS URLs but does not verify TLS certificates + by default. You can add <code>check-certificate=yes</code> parameter to require a valid TLS + certificate. Note that RouterOS ships with no root CA certificates, so you will + also need to load these.</li> +<li><a href="https://wiki.mikrotik.com/wiki/Manual:Tools/Fetch">Here's the full list of options</a> + supported by "tool fetch".</li> +</ul> \ No newline at end of file diff --git a/templates/docs/network_routers.md b/templates/docs/network_routers.md new file mode 100644 index 00000000..90dd8e1c --- /dev/null +++ b/templates/docs/network_routers.md @@ -0,0 +1,63 @@ +# Network Routers + +Certain network router operating systems can be configured to send regular HTTP(S) +requests to SITE_NAME directly from the router. This is a handy way to monitor them: when +the router loses its WAN connection, it will not be able to ping SITE_NAME, and SITE_NAME +will notify you about the outage. + +## DD-WRT + +[DD-WRT](https://dd-wrt.com/) is a Linux-based firmware for routers that runs on wide +variety of router models. DD-WRT ships with a cron daemon and wget utility. You can +enable the cron daemon and edit crontab in DD-WRT control panel, +**Administration › Management › Cron**. + +The crontab syntax on DD-WRT is: + + [cron expression] [username] [command] + +Example for sending a ping every minute: + + * * * * * root wget PING_URL + +Screenshot: + + + +## MikroTik RouterOS + +[MikroTik RouterOS](https://mikrotik.com/software) is a router operating system used +primarily on MikroTik network hardware. Among its many features is scripting support +and a scheduler. + +First, create a script in WebFig, **System › Scripts › Add New**. Use the following +parameters: + +* Name: `ping` (example, you can use a different name) +* Policy: `read`, `test` +* Source: `/tool fetch url="/tool fetch url="PING_URL" output=none` + + + +Then, create a schedule in WebFig, **System › Scheduler › Add New**. Use parameters: + +* Interval: `00:01:00` (one minute) +* Policy: `read`, `test` +* On Event: `ping` (the name of the script from the previous step) + + + +Notes: + +* The `output=none` parameter tells the system to discard response body. Without + this parameter, the system will save response body to a file, which will additionally + require the `write` policy. +* The "tool fetch" utility supports HTTPS URLs but does not verify TLS certificates + by default. You can add `check-certificate=yes` parameter to require a valid TLS + certificate. Note that RouterOS ships with no root CA certificates, so you will + also need to load these. +* [Here's the full list of options](https://wiki.mikrotik.com/wiki/Manual:Tools/Fetch) + supported by "tool fetch". + + + diff --git a/templates/front/docs_single.html b/templates/front/docs_single.html index 388a80a5..a5f5ac45 100644 --- a/templates/front/docs_single.html +++ b/templates/front/docs_single.html @@ -37,6 +37,7 @@ {% include "front/docs_nav_item.html" with slug="reliability_tips" title="Reliability tips" %} {% include "front/docs_nav_item.html" with slug="bash" title="Shell scripts" %} {% include "front/docs_nav_item.html" with slug="arduino" title="Arduino" %} + {% include "front/docs_nav_item.html" with slug="network_routers" title="Network Routers" %} {% include "front/docs_nav_item.html" with slug="csharp" title="C#" %} {% include "front/docs_nav_item.html" with slug="email" title="Email" %} {% include "front/docs_nav_item.html" with slug="github_actions" title="GitHub Actions" %}