Skip to content

Raspberry Pi に Smokeping をインストールしてスループットをモニタする

自宅 → インターネット宛てのスループットを定点観測する為に Raspberry Pi へ Smokeping をインストールしました。 今回は Smokeping のインストール手順から初期設定までをメモしておきます。 尚、今回はスループットをモニタしたいだけなので、アラーム検出時のメール送信は設定しません。

インストール

Raspbian OS であれば標準リポジトリに Smokeping がありました。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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.

インストールします。

1
apt -y install smokeping

Apache で CGI を有効化しておきます。

1
a2enmod cgi

Probe の設定

/etc/smokeping/config.d/Probes の内容を以下のように書き換えます。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
*** 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 の内容を以下のように書き換えます。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
*** 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 が表示されるはずです。 時間の経過と共にモニタした結果がグラフ化されていきます。

file

参考

デフォルトの /etc/smokeping/config.d/General

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
*** 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

1
2
3
4
5
*** Probes ***

+ FPing

binary = /usr/bin/fping

デフォルトの /etc/smokeping/config.d/Targets

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
*** 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