<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Ntfy on Tarragon</title><link>https://tarrragon.github.io/blog/tags/ntfy/</link><description>Recent content in Ntfy on Tarragon</description><generator>Hugo -- gohugo.io</generator><language>zh-TW</language><copyright>Tarragon (CC BY 4.0)</copyright><lastBuildDate>Fri, 03 Jul 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://tarrragon.github.io/blog/tags/ntfy/index.xml" rel="self" type="application/rss+xml"/><item><title>ntfy：推送通知服務怎麼運作、公共站 vs 自架</title><link>https://tarrragon.github.io/blog/linux/debug/ntfy-push-notification-service/</link><pubDate>Fri, 03 Jul 2026 00:00:00 +0000</pubDate><guid>https://tarrragon.github.io/blog/linux/debug/ntfy-push-notification-service/</guid><description>&lt;p>ntfy（唸作 &amp;ldquo;notify&amp;rdquo;）是一套開源的發布/訂閱推送通知服務，把「一台機器想告訴你一件事」變成「你手機上跳一則通知」，而且發送端只要一個 HTTP 請求、不需要註冊帳號。&lt;a href="../service-failure-monitoring/">服務失敗監控&lt;/a>那篇的告警就是靠它把「某個 service 掛了」推到手機。這篇說清楚它怎麼運作、誰在維護、以及一個會直接影響你安全的模型：在公共站上，&lt;strong>topic 名稱就是唯一的密碼&lt;/strong>。&lt;/p>
&lt;h2 id="怎麼運作topic-是頻道發送是一個-post">怎麼運作：topic 是頻道，發送是一個 POST&lt;/h2>
&lt;p>ntfy 的模型簡單到幾乎不需要學：一個 &lt;strong>topic&lt;/strong> 就是一個頻道，發送端對那個 topic 發 HTTP 請求、訂閱端就收到。發一則通知是這樣：&lt;/p>





&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="ln">1&lt;/span>&lt;span class="cl">curl -d &lt;span class="s2">&amp;#34;sshd 在 web-01 掛了&amp;#34;&lt;/span> ntfy.sh/你的topic&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>訂閱端可以是手機 app、瀏覽器，或程式（它提供 SSE、JSON stream、WebSocket 三種串流讓你的程式訂閱）。就這樣——沒有 broker 設定、沒有 API key 必填、沒有帳號流程。這種「一行 curl 就送出」正是它在監控告警場景最省事的原因：處理器腳本裡塞一行 &lt;code>curl&lt;/code> 就完成推送。&lt;/p>
&lt;p>進階一點的用法都是加 HTTP header：&lt;code>Title&lt;/code>（標題）、&lt;code>Priority&lt;/code>（優先級，高優先級手機會強提醒）、&lt;code>Tags&lt;/code>（標籤/emoji）、&lt;code>Click&lt;/code>（點通知打開的網址）。但核心就是「POST 到一個 topic」。&lt;/p>
&lt;h2 id="手機訂閱官方-app-三步">手機訂閱：官方 app 三步&lt;/h2>
&lt;p>告警最終要落到手機上，訂閱端在手機這頭是三步：&lt;/p>
&lt;ol>
&lt;li>裝官方 app：App Store（iOS）或 Google Play（Android）搜 &lt;strong>ntfy&lt;/strong>，作者 &lt;code>binwiederhier&lt;/code>（也可從 F-Droid 裝）。&lt;/li>
&lt;li>開 app、點 &lt;strong>Add subscription（新增訂閱）&lt;/strong>，填入你的 &lt;strong>topic 名稱&lt;/strong>（就是 &lt;code>curl -d ... ntfy.sh/&amp;lt;topic&amp;gt;&lt;/code> 裡那個 &lt;code>&amp;lt;topic&amp;gt;&lt;/code>）。用公共站的話到這步就收得到了。&lt;/li>
&lt;li>自架 server 的話，在同一個 Add subscription 對話框把「Use another server」打開、填自架的 base URL（例 &lt;code>https://ntfy.example.com&lt;/code>），再填 topic。&lt;/li>
&lt;/ol>
&lt;p>填完發一則 &lt;code>curl -d &amp;quot;test&amp;quot; ntfy.sh/&amp;lt;topic&amp;gt;&lt;/code> 驗證手機有跳通知，這條鏈就通了。app 收到後長按通知可設定每 topic 的優先級與勿擾。&lt;/p>
&lt;h2 id="本地訂閱不只手機-app">本地訂閱：不只手機 app&lt;/h2>
&lt;p>訂閱端不一定要手機 app——因為訂閱也只是一個 HTTP GET，本地有好幾種方式：&lt;/p>
&lt;ul>
&lt;li>&lt;strong>純 curl（零安裝）&lt;/strong>：&lt;code>curl -sN https://ntfy.sh/&amp;lt;topic&amp;gt;/json&lt;/code> 即時串流、一行一則 JSON（&lt;code>-N&lt;/code> 不緩衝）；&lt;code>/raw&lt;/code> 只給純文字、&lt;code>/sse&lt;/code> 給網頁、&lt;code>/ws&lt;/code> 給 WebSocket。要補看最近的：&lt;code>curl -s &amp;quot;https://ntfy.sh/&amp;lt;topic&amp;gt;/json?poll=1&amp;amp;since=10m&amp;quot;&lt;/code> 拉最近 10 分鐘就關。&lt;/li>
&lt;li>&lt;strong>瀏覽器&lt;/strong>：直接開 &lt;code>https://ntfy.sh/&amp;lt;topic&amp;gt;&lt;/code>，就是一個即時 web UI。&lt;/li>
&lt;li>&lt;strong>ntfy CLI&lt;/strong>：&lt;code>ntfy subscribe &amp;lt;topic&amp;gt;&lt;/code> 串到終端機；&lt;code>ntfy subscribe &amp;lt;topic&amp;gt; &amp;lt;指令&amp;gt;&lt;/code> 每來一則跑一次指令（訊息塞進 &lt;code>$NTFY_TITLE&lt;/code> / &lt;code>$NTFY_MESSAGE&lt;/code>）。&lt;/li>
&lt;/ul>
&lt;h3 id="常駐成桌面通知">常駐成桌面通知&lt;/h3>
&lt;p>Linux 桌面上最順的用法，是把訂閱做成一個常駐服務、每則告警用 &lt;code>notify-send&lt;/code> 彈成桌面通知（走你的通知 daemon，mako 或桌面 shell 內建的都行）。核心就是一個串流迴圈：&lt;/p>





&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="ln">1&lt;/span>&lt;span class="cl">curl -sN https://ntfy.sh/&amp;lt;topic&amp;gt;/json &lt;span class="p">|&lt;/span> &lt;span class="k">while&lt;/span> &lt;span class="nb">read&lt;/span> -r l&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="ln">2&lt;/span>&lt;span class="cl"> &lt;span class="o">[&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">$(&lt;/span>jq -r &lt;span class="s1">&amp;#39;.event&amp;#39;&lt;/span> &lt;span class="o">&amp;lt;&amp;lt;&amp;lt;&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$l&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">)&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="o">=&lt;/span> message &lt;span class="o">]&lt;/span> &lt;span class="o">||&lt;/span> &lt;span class="k">continue&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="ln">3&lt;/span>&lt;span class="cl"> notify-send -u critical &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">$(&lt;/span>jq -r &lt;span class="s1">&amp;#39;.title&amp;#39;&lt;/span> &lt;span class="o">&amp;lt;&amp;lt;&amp;lt;&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$l&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">)&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">$(&lt;/span>jq -r &lt;span class="s1">&amp;#39;.message&amp;#39;&lt;/span> &lt;span class="o">&amp;lt;&amp;lt;&amp;lt;&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="nv">$l&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="k">)&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="ln">4&lt;/span>&lt;span class="cl">&lt;span class="k">done&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>把它包成一個 &lt;strong>user systemd 服務&lt;/strong>（&lt;code>WantedBy=default.target&lt;/code> + &lt;code>Restart=always&lt;/code>）就能開機常駐、斷線自動重連。這是「盯著機器狀態」很實用的一塊：人在電腦前不必掏手機就看得到告警。&lt;/p>
&lt;p>&lt;strong>放哪台有講究&lt;/strong>：在被監控的機器上訂閱它自己的告警有點循環——那台掛了，桌面通知也彈不出來。桌面訂閱更適合放在&lt;strong>你盯著的工作機&lt;/strong>上、訂遠端機器的 topic。放被監控機本身只適合當測試 / 示範。&lt;/p>
&lt;h2 id="誰維護它開源專案不是正式標準">誰維護它：開源專案，不是正式標準&lt;/h2>
&lt;p>ntfy 是&lt;strong>開源專案&lt;/strong>（server 以 Apache-2.0 授權），主要由一個人維護——Philipp Heckel（GitHub &lt;code>binwiederhier&lt;/code>）——加上社群貢獻。理解這個定位很重要：&lt;/p>
&lt;ul>
&lt;li>它&lt;strong>不是&lt;/strong>像 HTTP、SMTP 那種有 RFC、多廠商共同實作的正式標準。&lt;/li>
&lt;li>但它的 API 公開又極簡（就是 HTTP + 幾種串流），所以&lt;strong>任何人都能寫自己的 client 或 server&lt;/strong>去對接。官方已經有 Android / iOS / Web / CLI 客戶端，你要自己寫一個也完全可行。&lt;/li>
&lt;/ul>
&lt;p>所以「誰都能訂閱跟寫 app 嗎」的答案是：協議公開、可以；但它是一個專案的 API，不是一份跨廠商標準。你用的 app 多半是官方那幾個，或你自己寫的。&lt;/p>
&lt;h2 id="公共站-vs-自架兩種很不一樣的東西">公共站 vs 自架：兩種很不一樣的東西&lt;/h2>
&lt;p>ntfy 同時是「一個免費公共服務」跟「一套你能自己跑的軟體」，兩者的安全性差很多：&lt;/p>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>&lt;/th>
 &lt;th>&lt;code>ntfy.sh&lt;/code> 公共站&lt;/th>
 &lt;th>自架&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>認證&lt;/td>
 &lt;td>預設無、topic 名稱就是存取控制&lt;/td>
 &lt;td>可開帳號 / access token / 每 topic ACL&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>資料經過誰&lt;/td>
 &lt;td>別人的伺服器&lt;/td>
 &lt;td>你自己的機器&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>成本&lt;/td>
 &lt;td>免費（有額度上限）&lt;/td>
 &lt;td>自己的一台機器 + 維運&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>上手&lt;/td>
 &lt;td>立刻能用&lt;/td>
 &lt;td>一個 Go binary 或 docker container&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;p>&lt;strong>公共站&lt;/strong>適合測試、個人用、告警內容不敏感的場景——立刻能用。&lt;strong>自架&lt;/strong>因為 ntfy 是開源的，一個單一 Go 執行檔（或 docker）就能跑起你自己的 ntfy server，支援帳號、token、以及「哪個 topic 誰能讀寫」的 ACL；適合「不想讓告警內容經過第三方伺服器」或要正式部署的場景。&lt;/p></description><content:encoded><![CDATA[<p>ntfy（唸作 &ldquo;notify&rdquo;）是一套開源的發布/訂閱推送通知服務，把「一台機器想告訴你一件事」變成「你手機上跳一則通知」，而且發送端只要一個 HTTP 請求、不需要註冊帳號。<a href="../service-failure-monitoring/">服務失敗監控</a>那篇的告警就是靠它把「某個 service 掛了」推到手機。這篇說清楚它怎麼運作、誰在維護、以及一個會直接影響你安全的模型：在公共站上，<strong>topic 名稱就是唯一的密碼</strong>。</p>
<h2 id="怎麼運作topic-是頻道發送是一個-post">怎麼運作：topic 是頻道，發送是一個 POST</h2>
<p>ntfy 的模型簡單到幾乎不需要學：一個 <strong>topic</strong> 就是一個頻道，發送端對那個 topic 發 HTTP 請求、訂閱端就收到。發一則通知是這樣：</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="ln">1</span><span class="cl">curl -d <span class="s2">&#34;sshd 在 web-01 掛了&#34;</span> ntfy.sh/你的topic</span></span></code></pre></div><p>訂閱端可以是手機 app、瀏覽器，或程式（它提供 SSE、JSON stream、WebSocket 三種串流讓你的程式訂閱）。就這樣——沒有 broker 設定、沒有 API key 必填、沒有帳號流程。這種「一行 curl 就送出」正是它在監控告警場景最省事的原因：處理器腳本裡塞一行 <code>curl</code> 就完成推送。</p>
<p>進階一點的用法都是加 HTTP header：<code>Title</code>（標題）、<code>Priority</code>（優先級，高優先級手機會強提醒）、<code>Tags</code>（標籤/emoji）、<code>Click</code>（點通知打開的網址）。但核心就是「POST 到一個 topic」。</p>
<h2 id="手機訂閱官方-app-三步">手機訂閱：官方 app 三步</h2>
<p>告警最終要落到手機上，訂閱端在手機這頭是三步：</p>
<ol>
<li>裝官方 app：App Store（iOS）或 Google Play（Android）搜 <strong>ntfy</strong>，作者 <code>binwiederhier</code>（也可從 F-Droid 裝）。</li>
<li>開 app、點 <strong>Add subscription（新增訂閱）</strong>，填入你的 <strong>topic 名稱</strong>（就是 <code>curl -d ... ntfy.sh/&lt;topic&gt;</code> 裡那個 <code>&lt;topic&gt;</code>）。用公共站的話到這步就收得到了。</li>
<li>自架 server 的話，在同一個 Add subscription 對話框把「Use another server」打開、填自架的 base URL（例 <code>https://ntfy.example.com</code>），再填 topic。</li>
</ol>
<p>填完發一則 <code>curl -d &quot;test&quot; ntfy.sh/&lt;topic&gt;</code> 驗證手機有跳通知，這條鏈就通了。app 收到後長按通知可設定每 topic 的優先級與勿擾。</p>
<h2 id="本地訂閱不只手機-app">本地訂閱：不只手機 app</h2>
<p>訂閱端不一定要手機 app——因為訂閱也只是一個 HTTP GET，本地有好幾種方式：</p>
<ul>
<li><strong>純 curl（零安裝）</strong>：<code>curl -sN https://ntfy.sh/&lt;topic&gt;/json</code> 即時串流、一行一則 JSON（<code>-N</code> 不緩衝）；<code>/raw</code> 只給純文字、<code>/sse</code> 給網頁、<code>/ws</code> 給 WebSocket。要補看最近的：<code>curl -s &quot;https://ntfy.sh/&lt;topic&gt;/json?poll=1&amp;since=10m&quot;</code> 拉最近 10 分鐘就關。</li>
<li><strong>瀏覽器</strong>：直接開 <code>https://ntfy.sh/&lt;topic&gt;</code>，就是一個即時 web UI。</li>
<li><strong>ntfy CLI</strong>：<code>ntfy subscribe &lt;topic&gt;</code> 串到終端機；<code>ntfy subscribe &lt;topic&gt; &lt;指令&gt;</code> 每來一則跑一次指令（訊息塞進 <code>$NTFY_TITLE</code> / <code>$NTFY_MESSAGE</code>）。</li>
</ul>
<h3 id="常駐成桌面通知">常駐成桌面通知</h3>
<p>Linux 桌面上最順的用法，是把訂閱做成一個常駐服務、每則告警用 <code>notify-send</code> 彈成桌面通知（走你的通知 daemon，mako 或桌面 shell 內建的都行）。核心就是一個串流迴圈：</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="ln">1</span><span class="cl">curl -sN https://ntfy.sh/&lt;topic&gt;/json <span class="p">|</span> <span class="k">while</span> <span class="nb">read</span> -r l<span class="p">;</span> <span class="k">do</span>
</span></span><span class="line"><span class="ln">2</span><span class="cl">  <span class="o">[</span> <span class="s2">&#34;</span><span class="k">$(</span>jq -r <span class="s1">&#39;.event&#39;</span> <span class="o">&lt;&lt;&lt;</span><span class="s2">&#34;</span><span class="nv">$l</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span> <span class="o">=</span> message <span class="o">]</span> <span class="o">||</span> <span class="k">continue</span>
</span></span><span class="line"><span class="ln">3</span><span class="cl">  notify-send -u critical <span class="s2">&#34;</span><span class="k">$(</span>jq -r <span class="s1">&#39;.title&#39;</span> <span class="o">&lt;&lt;&lt;</span><span class="s2">&#34;</span><span class="nv">$l</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span> <span class="s2">&#34;</span><span class="k">$(</span>jq -r <span class="s1">&#39;.message&#39;</span> <span class="o">&lt;&lt;&lt;</span><span class="s2">&#34;</span><span class="nv">$l</span><span class="s2">&#34;</span><span class="k">)</span><span class="s2">&#34;</span>
</span></span><span class="line"><span class="ln">4</span><span class="cl"><span class="k">done</span></span></span></code></pre></div><p>把它包成一個 <strong>user systemd 服務</strong>（<code>WantedBy=default.target</code> + <code>Restart=always</code>）就能開機常駐、斷線自動重連。這是「盯著機器狀態」很實用的一塊：人在電腦前不必掏手機就看得到告警。</p>
<p><strong>放哪台有講究</strong>：在被監控的機器上訂閱它自己的告警有點循環——那台掛了，桌面通知也彈不出來。桌面訂閱更適合放在<strong>你盯著的工作機</strong>上、訂遠端機器的 topic。放被監控機本身只適合當測試 / 示範。</p>
<h2 id="誰維護它開源專案不是正式標準">誰維護它：開源專案，不是正式標準</h2>
<p>ntfy 是<strong>開源專案</strong>（server 以 Apache-2.0 授權），主要由一個人維護——Philipp Heckel（GitHub <code>binwiederhier</code>）——加上社群貢獻。理解這個定位很重要：</p>
<ul>
<li>它<strong>不是</strong>像 HTTP、SMTP 那種有 RFC、多廠商共同實作的正式標準。</li>
<li>但它的 API 公開又極簡（就是 HTTP + 幾種串流），所以<strong>任何人都能寫自己的 client 或 server</strong>去對接。官方已經有 Android / iOS / Web / CLI 客戶端，你要自己寫一個也完全可行。</li>
</ul>
<p>所以「誰都能訂閱跟寫 app 嗎」的答案是：協議公開、可以；但它是一個專案的 API，不是一份跨廠商標準。你用的 app 多半是官方那幾個，或你自己寫的。</p>
<h2 id="公共站-vs-自架兩種很不一樣的東西">公共站 vs 自架：兩種很不一樣的東西</h2>
<p>ntfy 同時是「一個免費公共服務」跟「一套你能自己跑的軟體」，兩者的安全性差很多：</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th><code>ntfy.sh</code> 公共站</th>
          <th>自架</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>認證</td>
          <td>預設無、topic 名稱就是存取控制</td>
          <td>可開帳號 / access token / 每 topic ACL</td>
      </tr>
      <tr>
          <td>資料經過誰</td>
          <td>別人的伺服器</td>
          <td>你自己的機器</td>
      </tr>
      <tr>
          <td>成本</td>
          <td>免費（有額度上限）</td>
          <td>自己的一台機器 + 維運</td>
      </tr>
      <tr>
          <td>上手</td>
          <td>立刻能用</td>
          <td>一個 Go binary 或 docker container</td>
      </tr>
  </tbody>
</table>
<p><strong>公共站</strong>適合測試、個人用、告警內容不敏感的場景——立刻能用。<strong>自架</strong>因為 ntfy 是開源的，一個單一 Go 執行檔（或 docker）就能跑起你自己的 ntfy server，支援帳號、token、以及「哪個 topic 誰能讀寫」的 ACL；適合「不想讓告警內容經過第三方伺服器」或要正式部署的場景。</p>
<p>最小起手（docker，先跑起來再談 ACL）：</p>





<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="ln">1</span><span class="cl">docker run -d --name ntfy -p 80:80 -v /var/cache/ntfy:/var/cache/ntfy <span class="se">\
</span></span></span><span class="line"><span class="ln">2</span><span class="cl"><span class="se"></span>  binwiederhier/ntfy serve --base-url http://你的主機
</span></span><span class="line"><span class="ln">3</span><span class="cl"><span class="c1"># 之後把發送端 curl 的 ntfy.sh 換成你這台的 base-url，行為完全一樣</span></span></span></code></pre></div><p>要開認證再加 <code>--auth-file</code> 與 <code>--auth-default-access deny-all</code>，然後用 <code>ntfy access</code> 逐條授權 topic。想先驗證能跑通就先不開認證。</p>
<h2 id="安全模型公共站上topic-名稱就是密碼">安全模型：公共站上，topic 名稱就是密碼</h2>
<p>這是用 ntfy.sh 一定要懂的一件事：<strong>公共站預設沒有認證，topic 名稱本身就是唯一的存取控制。</strong> 這導致兩個後果：</p>
<ul>
<li>任何知道或猜到你 topic 名稱的人，能<strong>讀到你所有推去那個 topic 的通知</strong>——而告警內容常含主機名、哪個服務掛了這類資訊。</li>
<li>他也能<strong>往你的 topic 發訊息</strong>，讓你收到不是真的的假告警。</li>
</ul>
<p>所以在公共站上，topic 名稱要當<strong>密碼</strong>看待：用長的、隨機的、不可猜的字串（<code>server-alert-8f3k2xq9</code> 而不是 <code>myserver</code>）。一個好記好猜的 topic 等於把告警頻道公開。要更徹底就走上一節的自架加 ACL，或用 ntfy.sh 的「保留 topic」（見下）把 topic 綁定到你帳號、別人不能佔用。</p>
<p>判準：告警內容有多敏感、被人偷看或偽造的代價有多高，決定你停在「長隨機 topic」還是往「自架 + 認證」走。純個人測試機，長隨機 topic 通常夠；跑正事、內容敏感，自架。</p>
<h2 id="商業模式與維護">商業模式與維護</h2>
<p>單一維護者靠三塊支撐這個免費服務：免費公共站、<strong>ntfy Pro</strong>（付費層，買更高的發送額度與「保留 topic」——保留 topic 就是把名稱綁到你帳號、擋掉別人在公共站上佔用或偷聽同名 topic）、以及贊助。所以核心是開源免費，商業只是加值層，不是把功能鎖在付費牆後。這種模式對「一個人維護的基礎服務」是常見且可持續的安排。</p>
<h2 id="同類服務對照">同類服務對照</h2>
<p>ntfy 不是唯一選擇，依你的取捨還有幾個：</p>
<table>
  <thead>
      <tr>
          <th>服務</th>
          <th>定位</th>
          <th>什麼時候選它</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>ntfy</td>
          <td>免帳號、一行 curl、可自架</td>
          <td>要最省事的 HTTP 推送、或想自架掌握資料</td>
      </tr>
      <tr>
          <td>Gotify</td>
          <td>自架的開源推送 server（跟 ntfy 最像）</td>
          <td>只想自架、要一個簡單的 self-host 方案</td>
      </tr>
      <tr>
          <td>Pushover</td>
          <td>商業、一次性買斷、以穩定著稱</td>
          <td>願意付費換「不用自己維運、送達可靠」</td>
      </tr>
      <tr>
          <td>Apprise</td>
          <td>不是服務、是打通幾十種通知目標的函式庫</td>
          <td>要一份程式碼同時能發 ntfy / Telegram / email / Slack</td>
      </tr>
  </tbody>
</table>
<p>Apprise 跟其他三個不同一層：它是抽象層，底下可以接 ntfy 或其他。如果你不確定未來要用哪個推送目標、或要同時發多個，用 Apprise 當中介、之後換目標不用改發送端程式碼。</p>
<h2 id="下一步">下一步</h2>
<ul>
<li>把 ntfy 接進 systemd 服務失敗告警的完整做法（<code>OnFailure</code> 鉤子、只在放棄才告警、canary 驗證管線）：<a href="../service-failure-monitoring/">服務掛了怎麼自動知道</a>。</li>
<li>整台機器死掉時 ntfy 這種體內推送發不出來、要改用體外心跳（healthchecks.io / Uptime Kuma），見 <a href="../service-failure-monitoring/">服務掛了怎麼自動知道</a> 的「整台機器死掉怎麼辦」段。</li>
<li>ntfy 是個人 / 單機規模的最小告警通道；規模長大後事件怎麼分類、告警怎麼收斂 → <a href="/blog/monitoring/" data-link-title="監控實務指南" data-link-desc="整理非伺服器端運行時的監控體系 — 行為蒐集、錯誤回報、效能指標、生命週期追蹤，從自架方案到商業方案的完整知識路線">Monitoring 系列</a>；服務探活與自動恢復的概念層 → <a href="/blog/devops/04-service-health/" data-link-title="模組四：服務探活與自動恢復" data-link-desc="服務掛了怎麼自動發現和恢復 — health check 設計、liveness vs readiness、systemd watchdog、process supervisor">DevOps：服務探活與自動恢復</a>。</li>
</ul>
]]></content:encoded></item></channel></rss>