1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Smokeping Install on CentOS7

Posted at

はじめに

Smokeping という、ネットワークレイテンシーを計測して可視化するツールの導入方法を紹介します。こんな感じで計測したいサーバーのレイテンシーや、そのブレ幅を時間軸と共に分析できます。

1606106169447.png

環境

  • CentOS 7

Timezoneの変更

UTC 時刻になっていると、Smokeping で表示される時刻も UTC になるので、日本時刻に変更します。
現在の設定が、UTC になっています。

[opc@smokeping ~]$ timedatectl
      Local time: Sun 2020-11-22 14:27:46 GMT
  Universal time: Sun 2020-11-22 14:27:46 UTC
        RTC time: Sun 2020-11-22 14:27:46
       Time zone: GMT (GMT, +0000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
[opc@smokeping ~]$

日本時間に変更します。

sudo timedatectl set-timezone Asia/Tokyo

JST に変更されています。

[opc@smokeping ~]$ timedatectl
      Local time: Sun 2020-11-22 23:28:15 JST
  Universal time: Sun 2020-11-22 14:28:15 UTC
        RTC time: Sun 2020-11-22 14:28:14
       Time zone: Asia/Tokyo (JST, +0900)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
[opc@smokeping ~]$

Firewalld 停止

今回の環境は、Public Cloud (Oracle Cloud) で構成しているため、Public Cloud 側でファイアウォール機能を有効にしています。CentOS 内部の firewalld は停止します。

sudo systemctl stop firewalld
sudo systemctl disable firewalld

Smokeping Install

EPELから、Smokeping をインストールします

sudo yum -y install smokeping

httpd も依存関係で自動的にインストールされていて、Smokeping 用のファイルも自動生成されています

[opc@smokeping ~]$ cat /etc/httpd/conf.d/smokeping.conf
<Directory "/usr/share/smokeping" >
  Require local
  # Require ip 2.5.6.8
  # Require host example.org
</Directory>

<Directory "/var/lib/smokeping" >
  Require local
  # Require ip 2.5.6.8
  # Require host example.org
</Directory>

# .fcgi : smokeping by mod_fcgid aka fastcgi
# _cgi  : plain old fashion cgi
ScriptAlias /smokeping/sm.cgi  /usr/share/smokeping/cgi/smokeping.fcgi
# ScriptAlias /smokeping/sm.cgi  /usr/share/smokeping/cgi/smokeping_cgi

Alias       /smokeping/images  /var/lib/smokeping/images
Alias       /smokeping         /usr/share/smokeping/htdocs
[opc@smokeping ~]$

編集します

sudo vim /etc/httpd/conf.d/smokeping.conf

デフォルトでは、ローカルのみなので、全員参照出来るような権限設定をします

<Directory "/usr/share/smokeping" >
    Require all granted
</Directory>

<Directory "/var/lib/smokeping" >
    Require all granted
</Directory>

# .fcgi : smokeping by mod_fcgid aka fastcgi
# _cgi  : plain old fashion cgi
ScriptAlias /smokeping/sm.cgi  /usr/share/smokeping/cgi/smokeping.fcgi
# ScriptAlias /smokeping/sm.cgi  /usr/share/smokeping/cgi/smokeping_cgi

Alias       /smokeping/images  /var/lib/smokeping/images
Alias       /smokeping         /usr/share/smokeping/htdocs

Apache と Smokeping を再起動します

sudo systemctl restart httpd
sudo systemctl restart smokeping

IP アドレスを書き換えて次のURLにアクセスすると、次の画像のページが表示されます。
http://ipaddress/smokeping/sm.cgi

1606037009536.png

Target の設定

Smokeping がネットワークレイテンシーを計測する対象を設定していきます。

sudo vim /etc/smokeping/config

元々の設定の一部を抜粋するとこんな感じです。

*** Targets ***

# menuextra = <a target='_blank' href='/smokeping/tr.html{HOST}' class='{CLASS}' \
#               onclick="window.open(this.href,this.target, \
#               'width=800,height=500,toolbar=no,location=no,status=no,scrollbars=no'); \
#                return false;">*</a>
#
probe = FPing

menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of <b>Insert Company Name Here</b>. \
         Here you will learn all about the latency of our network.

+ Ping

menu = Fedora
title = Fedora Pings

++ FedoraprojectOrg

menu = fedoraproject.org
title = Fedora Webserver
host = fedoraproject.org

++ DocsFedoraprojectOrg

menu = docs.fedoraproject.org
title = Fedora Docs Webserver
host = docs.fedoraproject.org

++ PlanetFedora

menu = planet.fedoraproject.org
title = Planet Fedora
host = planet.fedoraproject.org

変更後

*** Targets ***

probe = FPing

menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of <b>Insert Company Name Here</b>. \
         Here you will learn all about the latency of our network.

+ Ping
menu = OCI
title = OCI Pings

++ win-e2
menu = win-e2
title = win-e2
host = 10.0.0.5

++  win-e3
menu = win-e3
title = win-e3
host = 10.0.0.6

++ win-intel
menu = win-intel
title = win-intel
host = 10.0.0.7

++ win-e2-to-e3-paravirtual
menu = win-e2-to-e3-paravirtual
title = win-e2-to-e3-paravirtual
host = 10.0.0.10

++ win-e2-to-e3-vfio
menu = win-e2-to-e3-vfio
title = win-e2-to-e3-vfio
host = 10.0.0.11

++ linux-e3
menu = linux-e3
title = linux-e3
host = 10.0.0.8

++ metadata
menu = metadata
title = metadata
host = 169.254.169.254

Ping の実行間隔も変更可能です。自分の場合は、細かく Ping 結果を計測したかったので、3秒おきに3回の Ping を行うようにしています。(1秒おきに設定するとエラーになってしまった)

  • step : 何秒間隔か
  • pings : 実行するPingの回数 (最低3)
*** Database ***

step     = 3
pings    = 3

反映させます

sudo systemctl restart smokeping
sudo systemctl restart httpd

Error

設定によっては、次のようなエラーになるときがあります

Error: RRD parameter mismatch ('Wrong value of step: /var/lib/smokeping/rrd/Ping/e2-to-e3.rrd has 300, create string has 299'). You must delete /var/lib/smokeping/rrd/Ping/e2-to-e3.rrd or fix the configuration parameters.
For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error.

こういう時は、過去の RDD ファイルを削除すればOKです

rm -f /var/lib/smokeping/rrd/Ping/*

削除後にサービスを再起動しましょう

systemctl restart smokeping
systemctl restart httpd

ページの自動更新

Smokeping では、自動的にWebブラウザのページをリロードしてしまいます。設定によりますが、3秒おきに自動更新されてしまい、非常に気になりました。

次のファイルを編集することで、自動更新を停止可能です。

vim /etc/smokeping/basepage.html

8行目の部分を削除

<META HTTP-EQUIV="Refresh" CONTENT="<##step##>">

サービス再起動

systemctl restart smokeping
systemctl restart httpd

参考URL

Top Page
https://oss.oetiker.ch/smokeping/

How to Install
https://oss.oetiker.ch/smokeping/doc/smokeping_install.en.html

How to Install
https://www.qoosky.io/techs/4c3f3ab25f

How to Install
https://qiita.com/makotaka/items/7a6cb91b78562b97ca03

FreeBSD 11でSmokePingを使用してネットワーク遅延を追跡する方法
https://www.codeflow.site/ja/article/how-to-track-network-latency-with-smokeping-on-freebsd-11

【メモ】SmokePingでlatency視覚化はじめました(1)導入編
http://pocketstudio.jp/log3/2012/04/24/smokeping/

【メモ】SmokePingでlatency視覚化(2) DNS&HTTP応答編
http://pocketstudio.jp/log3/2012/04/26/smokeping_dns_and_http_latency/

SmokePing のグラフの読み取り方
https://oss.oetiker.ch/smokeping/doc/reading.en.html

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?