Smokeping 是一個很好用的網絡監測工具,主要用途是測量與目標主機的網絡延遲。
像 Pi-Hole 或 Smokeping 這些對硬件要求不高的工具,除非已經有一台 24/7 運行的機器,否則我認為使用低功耗的 Raspberry Pi 運行是很不錯的選擇。
在 Raspberry Pi 安裝 Smokeping 十分簡單,只需一行指令:
$ sudo apt install apache2 fping curl smokeping libapache2-mod-fcgid
開啟 smokeping 的 apache 設定檔:
$ sudo a2enconf smokeping
啟動並設定 Apache 及 Smoke 開機自動執行:
$ systemctl enable --now apache2 $ systemctl enable --now smokeping
這時便可以透過以下網址打開 smokeping 的頁面:
http://raspberry-pi-ip/smokeping
現在可以設定要測的主機:
$ sudo nano /etc/smokeping/config.d/Targets
以下是監測的例子:
*** Targets *** probe = FPing menu = Top title = Network Latency Grapher remark = Welcome to the SmokePing website of xxx Company. \ Here you will learn all about the latency of our network. + Internet menu = Network Latency title = Network Latency (ICMP Ping) ++ Google_DNS menu = Google DNS title = Google DNS 8.8.8.8 host = 8.8.8.8 ++ Cloudflare_DNS menu = Cloudflare title = Cloudflare DNS 1.1.1.1 host = 1.1.1.1 ++ China menu = China title = TsingHua University (China) host = mirrors.tuna.tsinghua.edu.cn ++ Japan menu = Japan title = FreeBSD Mirror at Japan host = ftp.jp.FreeBSD.org ++ Singapore menu = Singapore title = Arch Linux Mirror at Singapore host = mirror.sg.gs ++ USA menu = USA title = FreeBSD Mirror at New York, USA host = pkg0.nyi.freebsd.org ++ Germany menu = Germany title = FreeBSD Mirror at Germany host = ftp.de.FreeBSD.org ++ UK menu = UK title = FreeBSD Mirror at UK host = ftp.uk.FreeBSD.org
最後重啟 smokeping:
$ sudo systemctl restart smokeping
等 5 至 10 分鐘再查看 smokeping 的頁面,便會看到更新了。