自宅 → インターネット宛てのスループットを定点観測する為に Raspberry Pi へ Smokeping をインストールしました。 今回は Smokeping のインストール手順から初期設定までをメモしておきます。 尚、今回はスループットをモニタしたいだけなので、アラーム検出時のメール送信は設定しません。
インストール
Raspbian OS であれば標準リポジトリに Smokeping がありました。
# apt show smokeping
Package: smokeping
Version: 2.7.3-2
Priority: optional
Section: net
Maintainer: Gabriel Filion <gabriel@koumbit.org>
Installed-Size: 1,176 kB
Depends: perl, libwww-perl, libsnmp-session-perl (>= 0.86), librrds-perl (>= 1.2), liburi-perl, fping (>= 2.4b2-to-ipv6-2),
libcgi-fast-perl, debianutils (>= 1.7), adduser, lsb-base (>= 3.0-6), libdigest-hmac-perl, ucf (>= 0.28), libconfig-grammar-perl, libjs-cropper, libjs-scriptaculous, libjs-prototype, default-mta | mail-transport-agent
Recommends: apache2 | httpd-cgi, libsocket6-perl, dnsutils, echoping, apache2 (>= 2.4.6-4~) | apache2 | httpd
Suggests: curl, libauthen-radius-perl, libnet-ldap-perl, libnet-dns-perl, openssh-client, libio-socket-ssl-perl, libnet-telnet-perl
Homepage: https://smokeping.org/
Tag: admin::logging, admin::monitoring, implemented-in::perl,
interface::commandline, interface::daemon, interface::web,
network::server, protocol::ipv6, protocol::snmp, role::program,
scope::utility, use::monitor, use::scanning, web::cgi, works-with::db,
works-with::image, works-with::image:vector, works-with::logfile
Download-Size: 491 kB
APT-Sources: http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
Description: latency logging and graphing system
SmokePing consists of a daemon process which organizes the
latency measurements and a CGI which presents the graphs.
.
With SmokePing you can measure latency and packet loss in your network.
SmokePing uses RRDtool to maintain a longterm datastore and to draw pretty
graphs giving up to the minute information on the state of each
network connection.
インストールします。
apt -y install smokeping
Apache で CGI を有効化しておきます。
a2enmod cgi
Probe の設定
/etc/smokeping/config.d/Probes
の内容を以下のように書き換えます。
*** Probes ***
+ FPing
binary = /usr/bin/fping
+ DNS
binary = /usr/bin/dig
lookup = example.com
pings = 5
step = 180
+ Curl
binary = /usr/bin/curl
step = 60
urlformat = https://%host%/
Targets の設定
/etc/smokeping/config.d/Targets
の内容を以下のように書き換えます。
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
+ ICMP
probe = FPing
menu = ICMP
title = ICMP
++ Google_1_ICMP
menu = 8.8.8.8
title = 8.8.8.8
host = 8.8.8.8
++ Google_2_ICMP
menu = 8.8.4.4
title = 8.8.4.4
host = 8.8.4.4
++ Cloudflare_1_ICMP
menu = 1.1.1.1
title = 1.1.1.1
host = 1.1.1.1
++ Cloudflare_2_ICMP
menu = 1.0.0.1
title = 1.0.0.1
host = 1.0.0.1
+ DNS
probe = DNS
menu = DNS
title = DNS
++ Google_1_DNS
menu = 8.8.8.8
title = 8.8.8.8
host = 8.8.8.8
++ Google_2_DNS
menu = 8.8.4.4
title = 8.8.4.4
host = 8.8.4.4
++ Cloudflare_1_DNS
menu = 1.1.1.1
title = 1.1.1.1
host = 1.1.1.1
++ Cloudflare_2_DNS
menu = 1.0.0.1
title = 1.0.0.1
host = 1.0.0.1
+ HTTP
probe = Curl
menu = HTTP
title = HTTP
++ Google_HTTP
menu = Google
title = www.google.co.jp
host = www.google.co.jp
++ Yahoo_HTTP
menu = Yahoo!
title = www.yahoo.co.jp
host = www.yahoo.co.jp
Smokeping にアクセスする
http://xx.xx.xx.xx/cgi-bin/smokeping.cgi
へアクセスすると Smokepoing が表示されるはずです。 時間の経過と共にモニタした結果がグラフ化されていきます。
参考
デフォルトの /etc/smokeping/config.d/General
*** General ***
owner = Peter Random
contact = some@address.nowhere
mailhost = my.mail.host
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed ... this is not
# good for images.
cgiurl = http://some.url/smokeping.cgi
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no
@include /etc/smokeping/config.d/pathnames
デフォルトの /etc/smokeping/config.d/Probes
*** Probes ***
+ FPing
binary = /usr/bin/fping
デフォルトの /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.
+ Local
menu = Local
title = Local Network
#parents = owner:/Test/James location:/
++ LocalMachine
menu = Local Machine
title = This host
host = localhost
#alerts = someloss
コメント