SmokePing:修订间差异

来自Gea-Suan Lin's Wiki
跳到导航 跳到搜索
 
(未显示同一用户的5个中间版本)
第18行: 第18行:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo mkdir -p /etc/systemd/system/smokeping.service.d; echo -e "#\n[Unit]\nRequires=network-online.target\n\n[Service]\nRestart=on-failure" | sudo tee /etc/systemd/system/smokeping.service.d/override.conf; sudo systemctl daemon-reload
sudo mkdir -p /etc/systemd/system/smokeping.service.d; echo -e "#\n[Unit]\nRequires=network-online.target\n\n[Service]\nRestart=on-failure" | sudo tee /etc/systemd/system/smokeping.service.d/override.conf; sudo systemctl daemon-reload
</syntaxhighlight>
=== 網頁介面 ===
這邊為了在網頁上可以看,會另外安裝[[FastCGI]]相關的套件以及相關的設定:
<syntaxhighlight lang="bash">
sudo apt install -y spawn-fcgi; sudo apt clean; sudo ln -s ../smokeping.cgi /usr/share/smokeping/www/smokeping.fcgi
</syntaxhighlight>
使用[[nginx]]時可以這樣設定:
<syntaxhighlight lang="nginx">
   location /smokeping/ {
     alias /usr/share/smokeping/www/;
     index smokeping.fcgi;
     location ~ \.fcgi$ {
       include fastcgi_params;
       fastcgi_intercept_errors on;
       fastcgi_pass unix:/var/run/smokeping-fcgi.sock;
     }
   }
</syntaxhighlight>
另外[[systemd]]的設定可以放在<code>/etc/systemd/system/smokeping-fcgi.service</code>下:
<syntaxhighlight lang="ini">
#
# Install into /etc/systemd/system
[Unit]
Description=Smokeping FastCGI daemon
Requires=remote-fs.target smokeping.service
[Service]
ExecStart=/usr/bin/spawn-fcgi -s /var/run/smokeping-fcgi.sock -P /var/run/smokeping-fcgi.pid -u www-data -g www-data -- /usr/share/smokeping/www/smokeping.fcgi
PIDFile=/run/smokeping-fcgi.pid
Restart=always
RestartSec=60
Type=simple
[Install]
WantedBy=multi-user.target
</syntaxhighlight>
</syntaxhighlight>



2024年4月9日 (二) 18:04的最新版本

SmokePing是一套监控网路品质的软体。

安装

Ubuntu下可以直接透过系统内的套件安装:

sudo apt install -y smokeping; sudo apt clean

设定

目前Ubuntu内建的systemd有两个问题会透过drop-in设定修正:

  • 有dependency的问题,不能保证开机后会正确启动(可能会在网路还没起来的时候就先启动了)。
  • 在发生问题后不会自动重启的问题。
sudo mkdir -p /etc/systemd/system/smokeping.service.d; echo -e "#\n[Unit]\nRequires=network-online.target\n\n[Service]\nRestart=on-failure" | sudo tee /etc/systemd/system/smokeping.service.d/override.conf; sudo systemctl daemon-reload

网页介面

这边为了在网页上可以看,会另外安装FastCGI相关的套件以及相关的设定:

sudo apt install -y spawn-fcgi; sudo apt clean; sudo ln -s ../smokeping.cgi /usr/share/smokeping/www/smokeping.fcgi

使用nginx时可以这样设定:

    location /smokeping/ {
        alias /usr/share/smokeping/www/;
        index smokeping.fcgi;

        location ~ \.fcgi$ {
            include fastcgi_params;

            fastcgi_intercept_errors on;
            fastcgi_pass unix:/var/run/smokeping-fcgi.sock;
        }
    }

另外systemd的设定可以放在/etc/systemd/system/smokeping-fcgi.service下:

#
# Install into /etc/systemd/system
[Unit]
Description=Smokeping FastCGI daemon
Requires=remote-fs.target smokeping.service

[Service]
ExecStart=/usr/bin/spawn-fcgi -s /var/run/smokeping-fcgi.sock -P /var/run/smokeping-fcgi.pid -u www-data -g www-data -- /usr/share/smokeping/www/smokeping.fcgi
PIDFile=/run/smokeping-fcgi.pid
Restart=always
RestartSec=60
Type=simple

[Install]
WantedBy=multi-user.target

站台

我自己的

其他

外部连结