h9803660ブログ

ネットワーク関連の技術検証のメモ、ネットワーク製品動向、投資のこと等を気が向いた時に書くかもしれません。

DockerでGrafanaの実行メモ

自分向けのGrafana構築メモ

1.イメージの取得

Dcoker HubにアクセスするとGrafana用のDocker Pull Commandが記載されている。

docker pull grafana/grafana

https://hub.docker.com/r/grafana/grafana/

実際に実行する

docker pull grafana/grafana
Using default tag: latest
latest: Pulling from grafana/grafana
188c0c94c7c5: Pull complete
7d32da56c871: Pull complete
76d59ca1d00e: Pull complete
1d21979af256: Pull complete
4f9a6c75b3a8: Pull complete
4f4fb700ef54: Pull complete
26ab0eecf834: Pull complete
6c118c1965f4: Pull complete
Digest: sha256:15b977f5207d0cf0f3fdceebd81fea9240d6976d1c7a44045b0d6adbadacb2e5
Status: Downloaded newer image for grafana/grafana:latest
docker.io/grafana/grafana:latest

2.イメージの確認

 docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
grafana/grafana     latest              1eaf753fbbdd        6 days ago          186MB

3.Grafanaを起動

docker run -d -p 3000:3000 --name=grafana -e"GF_SERVER_ROOT_URL=http://192.168.112.41" -e "GF_SECURITY_ADMIN_PASSWORD=admin" grafana/grafana
095e40832ff681da76de6d03c3525eac356775c7788c986cf55c7f58f305b7d6

以下の公式サイトに手順が記載されている。今回はオプション(GF_SERVER_ROOT_URL/GF_SECURITY_ADMIN_PASSWORD)をつけて起動

https://grafana.com/grafana/download?platform=docker

4.起動

先ほどGF_SERVER_ROOT_URLで指定したアドレス宛(ここではhttp://192.168.112.41:3000)にアクセス。デフォルトのユーザ名とパスワードはadminだが パスワードの変更を求められる。GF_SECURITY_ADMIN_PASSWORDでadmin以外のパスワードで設定すればパスワード変更を求めてこない模様。

無事ログイン完了。

データソースを前回起動させたPrometheusを指定する。

連携が成功すると以下のようなメッセージが出力される。

PlayStation Plus の自動更新を取り消しできた話

"PlayStation®Network"購入明細というメールが本日届き、何かなと思って見たらPS Plusの更新のメールだった。 一年前にセールになっていたPS Pluseの自動更新を無効にすることを怠っていたためのようである。

一旦あきらめていたのだが、どうやらキャンセルできる可能性もありそうであることが判明。

www.playstation.com

該当箇所抜粋

f:id:h9803660:20201123232904p:plain

キャンセルの依頼はLINEで依頼可能。

www.playstation.com

※定額サービスの返金申請を行う場合は、LINE窓口へお問い合わせください。

誤って更新をしてしまった旨を伝え、必要情報(請求メールの写し等)を提供した結果、 意図しない形で購入したってことで今回限りキャンセルしますとのことで事なきを得ました。

もしかすると次回以降では対応履歴が残っており、同様の自動更新の取り消しはできないのかも??

次回からは気を付けよう。

ちなみに今Amazonで期間限定?(ブラックフライデー&サイバーマンデーセール?)のPlayStation Plus 12ヶ月利用権 +3ヶ月が 売ってるからもしこの時期期限切れで更新しようとするなら自動更新止めてこっち買った方がお得っぽいですね・・・。

f:id:h9803660:20201123233610p:plain

DockerでPrometheusの実行メモ

自分向けのPrometheusの構築メモ

1.イメージの取得

Dcoker Hubにアクセスするとprometheus用のDocker Pull Commandが記載されている。

docker pull prom/prometheus

https://hub.docker.com/r/prom/prometheus/

実際に実行する

docker pull prom/prometheus
Using default tag: latest
latest: Pulling from prom/prometheus
76df9210b28c: Pull complete
559be8e06c14: Pull complete
f2a3d2457edd: Pull complete
c10a6fd58778: Pull complete
2ad73ff104d9: Pull complete
aec3e0b4446f: Pull complete
4cb49d0057e3: Pull complete
04db6a5b5334: Pull complete
ca0f04bfda22: Pull complete
ffd457fc1981: Pull complete
9fcdfe67a33b: Pull complete
d4f360942982: Pull complete
Digest: sha256:f7ffebdd428ba005e2c65ec1c7debdffdd39c43eb6bd0ddfa64ea7aba2a3fd14
Status: Downloaded newer image for prom/prometheus:latest
docker.io/prom/prometheus:latest

2.イメージの確認

docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
prom/prometheus     latest              6fa696e177e3        6 days ago  

3.Prometheusを起動

docker run -p 9090:9090 prom/prometheus
level=info ts=2020-11-22T14:35:11.088Z caller=main.go:315 msg="No time or size retention was set so using the default time retention" duration=15d
level=info ts=2020-11-22T14:35:11.088Z caller=main.go:353 msg="Starting Prometheus" version="(version=2.22.2, branch=HEAD, revision=de1c1243f4dd66fbac3e8213e9a7bd8dbc9f38b2)"
level=info ts=2020-11-22T14:35:11.088Z caller=main.go:358 build_context="(go=go1.15.5, user=root@f7d7e91063f0, date=20201116-12:43:43)"
level=info ts=2020-11-22T14:35:11.088Z caller=main.go:359 host_details="(Linux 4.18.0-193.28.1.el8_2.x86_64 #1 SMP Thu Oct 22 00:20:22 UTC 2020 x86_64 32b6cb369259 (none))"
level=info ts=2020-11-22T14:35:11.088Z caller=main.go:360 fd_limits="(soft=1048576, hard=1048576)"
level=info ts=2020-11-22T14:35:11.088Z caller=main.go:361 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2020-11-22T14:35:11.089Z caller=main.go:712 msg="Starting TSDB ..."
level=info ts=2020-11-22T14:35:11.098Z caller=web.go:516 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2020-11-22T14:35:11.100Z caller=head.go:642 component=tsdb msg="Replaying on-disk memory mappable chunks if any"
level=info ts=2020-11-22T14:35:11.100Z caller=head.go:656 component=tsdb msg="On-disk memory mappable chunks replay completed" duration=1.901μs
level=info ts=2020-11-22T14:35:11.100Z caller=head.go:662 component=tsdb msg="Replaying WAL, this may take a while"
level=info ts=2020-11-22T14:35:11.100Z caller=head.go:714 component=tsdb msg="WAL segment loaded" segment=0 maxSegment=0
level=info ts=2020-11-22T14:35:11.100Z caller=head.go:719 component=tsdb msg="WAL replay completed" checkpoint_replay_duration=15.602μs wal_replay_duration=163.428μs total_replay_duration=195.54μs
level=info ts=2020-11-22T14:35:11.101Z caller=main.go:732 fs_type=XFS_SUPER_MAGIC
level=info ts=2020-11-22T14:35:11.101Z caller=main.go:735 msg="TSDB started"
level=info ts=2020-11-22T14:35:11.101Z caller=main.go:861 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2020-11-22T14:35:11.102Z caller=main.go:892 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml totalDuration=539.829μs remote_storage=1.65μs web_handler=266ns query_engine=554ns scrape=253.613μs scrape_sd=24.038μs notify=19.707μs notify_sd=28.324μs rules=889ns
level=info ts=2020-11-22T14:35:11.102Z caller=main.go:684 msg="Server is ready to receive web requests."

^Clevel=warn ts=2020-11-22T14:36:34.658Z caller=main.go:562 msg="Received SIGTERM, exiting gracefully..."
level=info ts=2020-11-22T14:36:34.658Z caller=main.go:585 msg="Stopping scrape discovery manager..."
level=info ts=2020-11-22T14:36:34.658Z caller=main.go:599 msg="Stopping notify discovery manager..."
level=info ts=2020-11-22T14:36:34.658Z caller=main.go:621 msg="Stopping scrape manager..."
level=info ts=2020-11-22T14:36:34.658Z caller=main.go:581 msg="Scrape discovery manager stopped"
level=info ts=2020-11-22T14:36:34.658Z caller=main.go:595 msg="Notify discovery manager stopped"
level=info ts=2020-11-22T14:36:34.658Z caller=manager.go:924 component="rule manager" msg="Stopping rule manager..."
level=info ts=2020-11-22T14:36:34.658Z caller=manager.go:934 component="rule manager" msg="Rule manager stopped"
level=info ts=2020-11-22T14:36:34.659Z caller=main.go:615 msg="Scrape manager stopped"
level=info ts=2020-11-22T14:36:34.659Z caller=notifier.go:601 component=notifier msg="Stopping notification manager..."
level=info ts=2020-11-22T14:36:34.659Z caller=main.go:789 msg="Notifier manager stopped"
level=info ts=2020-11-22T14:36:34.660Z caller=main.go:801 msg="See you next time!"
[root@localhost keima-s]# docker run -p 9090:9090 prom/prometheus
level=info ts=2020-11-22T14:36:41.012Z caller=main.go:315 msg="No time or size retention was set so using the default time retention" duration=15d
level=info ts=2020-11-22T14:36:41.013Z caller=main.go:353 msg="Starting Prometheus" version="(version=2.22.2, branch=HEAD, revision=de1c1243f4dd66fbac3e8213e9a7bd8dbc9f38b2)"
level=info ts=2020-11-22T14:36:41.013Z caller=main.go:358 build_context="(go=go1.15.5, user=root@f7d7e91063f0, date=20201116-12:43:43)"
level=info ts=2020-11-22T14:36:41.013Z caller=main.go:359 host_details="(Linux 4.18.0-193.28.1.el8_2.x86_64 #1 SMP Thu Oct 22 00:20:22 UTC 2020 x86_64 e645299537df (none))"
level=info ts=2020-11-22T14:36:41.013Z caller=main.go:360 fd_limits="(soft=1048576, hard=1048576)"
level=info ts=2020-11-22T14:36:41.013Z caller=main.go:361 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2020-11-22T14:36:41.014Z caller=main.go:712 msg="Starting TSDB ..."
level=info ts=2020-11-22T14:36:41.022Z caller=web.go:516 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2020-11-22T14:36:41.023Z caller=head.go:642 component=tsdb msg="Replaying on-disk memory mappable chunks if any"
level=info ts=2020-11-22T14:36:41.023Z caller=head.go:656 component=tsdb msg="On-disk memory mappable chunks replay completed" duration=1.999μs
level=info ts=2020-11-22T14:36:41.023Z caller=head.go:662 component=tsdb msg="Replaying WAL, this may take a while"
level=info ts=2020-11-22T14:36:41.023Z caller=head.go:714 component=tsdb msg="WAL segment loaded" segment=0 maxSegment=0
level=info ts=2020-11-22T14:36:41.023Z caller=head.go:719 component=tsdb msg="WAL replay completed" checkpoint_replay_duration=16.859μs wal_replay_duration=202.096μs total_replay_duration=236.534μs
level=info ts=2020-11-22T14:36:41.024Z caller=main.go:732 fs_type=XFS_SUPER_MAGIC
level=info ts=2020-11-22T14:36:41.024Z caller=main.go:735 msg="TSDB started"
level=info ts=2020-11-22T14:36:41.024Z caller=main.go:861 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2020-11-22T14:36:41.025Z caller=main.go:892 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml totalDuration=439.448μs remote_storage=1.627μs web_handler=174ns query_engine=660ns scrape=179.743μs scrape_sd=20.808μs notify=17.355μs notify_sd=22.231μs rules=1.038μs
level=info ts=2020-11-22T14:36:41.025Z caller=main.go:684 msg="Server is ready to receive web requests."

4.ブラウザで確認

Webブラウザを使ってlocalhost:9090でアクセス。起動を確認。

公式の手順をそのまま使ってみただけなので特にひねりもないが簡単にPrometheusの起動確認ができた。

prometheus.io

追記

5.バインドマウント

prometheus.ymlを作成し、実行。バインドマウントをする。/tmp/prometheusというディレクトリを作りその中にprometheus.ymlを入れた。

prometheus.ymlの設定は以下に記載のものをそのまま使う。

https://prometheus.io/docs/prometheus/latest/getting_started/

prometheus.yml(公式の設定そのまま)

global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
      - targets: ['localhost:9090']

バインドマウント実行

docker run -d --name prometheus -p 9090:9090 -v /tmp/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
c466c90d88b5c1a144f13c28a4d258edcef77840cb5c72196d763f7ad312d993

※バインドマウントはdockerの公式ドキュメントだと-vより --mount使った方が良いとあるがprometheusの公式で使っているコマンドが-vだったのでそのまま利用

確認

docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
c466c90d88b5        prom/prometheus     "/bin/prometheus --c…"   5 minutes ago       Up 5 minutes        0.0.0.0:9090->9090/tcp   prometheus

--mount使った場合はこんな構文になる。

docker run -d --name prometheus -p 9090:9090 --mount type=bind,src=/tmp/prometheus/prometheus.yml,dst=/etc/prometheus/prometheus.yml prom/prometheus
9e53cda6fa1193fc101dfaa7b6a0a9f5c32e9b34e9d4fc9cdf1dc71ddd20f9aa

CentOS8にDocker/Docker Composeをインストール

自分向けのDocker/DockerComposeインストールメモ(CentOS8利用)

Docker

1.リポジトリの確認

dnf repolist
repo id                            repo name
AppStream                          CentOS-8 - AppStream
BaseOS                             CentOS-8 - Base
extras                             CentOS-8 - Extras

2.リポジトリの追加及び追加されたことの確認

dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

 dnf repolist
repo id                             repo name
AppStream                           CentOS-8 - AppStream
BaseOS                              CentOS-8 - Base
docker-ce-stable                    Docker CE Stable - x86_64
extras                              CentOS-8 - Extras

3.インストール

dnf -y install --nobest docker-ce docker-ce-cli
Docker CE Stable - x86_64                        17 kB/s | 3.8 kB     00:00
Dependencies resolved.
================================================================================
 Package                      Arch   Version             Repository        Size
================================================================================
Installing:
 docker-ce                    x86_64 3:19.03.13-3.el8    docker-ce-stable  24 M
 docker-ce-cli                x86_64 1:19.03.13-3.el8    docker-ce-stable  38 M
Installing dependencies:
 checkpolicy                  x86_64 2.9-1.el8           BaseOS           348 k
 container-selinux            noarch 2:2.124.0-1.module_el8.2.0+305+5e198a41
                                                         AppStream         47 k
 containerd.io                x86_64 1.3.7-3.1.el8       docker-ce-stable  29 M
 libcgroup                    x86_64 0.41-19.el8         BaseOS            70 k
 policycoreutils-python-utils noarch 2.9-9.el8           BaseOS           251 k
 python3-audit                x86_64 3.0-0.17.20191104git1c2f876.el8
                                                         BaseOS            86 k
 python3-libsemanage          x86_64 2.9-2.el8           BaseOS           127 k
 python3-policycoreutils      noarch 2.9-9.el8           BaseOS           2.2 M
 python3-setools              x86_64 4.2.2-2.el8         BaseOS           601 k
Enabling module streams:
 container-tools                     rhel8

Transaction Summary
================================================================================
Install  11 Packages

Total download size: 95 M
Installed size: 395 M
Downloading Packages:
(1/11): libcgroup-0.41-19.el8.x86_64.rpm        2.2 kB/s |  70 kB     00:31
(2/11): container-selinux-2.124.0-1.module_el8. 1.0 kB/s |  47 kB     00:48
[MIRROR] python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64.rpm: Curl error (28): Timeout was reached for http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
(3/11): containerd.io-1.3.7-3.1.el8.x86_64.rpm  6.0 MB/s |  29 MB     00:04
(4/11): docker-ce-19.03.13-3.el8.x86_64.rpm     7.5 MB/s |  24 MB     00:03
[MIRROR] checkpolicy-2.9-1.el8.x86_64.rpm: Curl error (28): Timeout was reached for http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/checkpolicy-2.9-1.el8.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
(5/11): docker-ce-cli-19.03.13-3.el8.x86_64.rpm 7.0 MB/s |  38 MB     00:05
(6/11): policycoreutils-python-utils-2.9-9.el8. 1.7 kB/s | 251 kB     02:31
(7/11): checkpolicy-2.9-1.el8.x86_64.rpm        1.9 kB/s | 348 kB     03:03
(8/11): python3-audit-3.0-0.17.20191104git1c2f8 649  B/s |  86 kB     02:15
(9/11): python3-libsemanage-2.9-2.el8.x86_64.rp 812 kB/s | 127 kB     00:00
(10/11): python3-policycoreutils-2.9-9.el8.noar 3.6 MB/s | 2.2 MB     00:00
(11/11): python3-setools-4.2.2-2.el8.x86_64.rpm 1.2 MB/s | 601 kB     00:00
--------------------------------------------------------------------------------
Total                                           523 kB/s |  95 MB     03:06
warning: /var/cache/dnf/docker-ce-stable-fa9dc42ab4cec2f4/packages/containerd.io-1.3.7-3.1.el8.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Docker CE Stable - x86_64                        25 kB/s | 1.6 kB     00:00
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
 From       : https://download.docker.com/linux/centos/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : docker-ce-cli-1:19.03.13-3.el8.x86_64                 1/11
  Running scriptlet: docker-ce-cli-1:19.03.13-3.el8.x86_64                 1/11
  Installing       : python3-setools-4.2.2-2.el8.x86_64                    2/11
  Installing       : python3-libsemanage-2.9-2.el8.x86_64                  3/11
  Installing       : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_    4/11
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                          5/11
  Installing       : libcgroup-0.41-19.el8.x86_64                          5/11
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                          5/11
  Installing       : checkpolicy-2.9-1.el8.x86_64                          6/11
  Installing       : python3-policycoreutils-2.9-9.el8.noarch              7/11
  Installing       : policycoreutils-python-utils-2.9-9.el8.noarch         8/11
  Running scriptlet: container-selinux-2:2.124.0-1.module_el8.2.0+305+5    9/11
  Installing       : container-selinux-2:2.124.0-1.module_el8.2.0+305+5    9/11
  Running scriptlet: container-selinux-2:2.124.0-1.module_el8.2.0+305+5    9/11
  Installing       : containerd.io-1.3.7-3.1.el8.x86_64                   10/11
  Running scriptlet: containerd.io-1.3.7-3.1.el8.x86_64                   10/11
  Installing       : docker-ce-3:19.03.13-3.el8.x86_64                    11/11
  Running scriptlet: docker-ce-3:19.03.13-3.el8.x86_64                    11/11
  Running scriptlet: container-selinux-2:2.124.0-1.module_el8.2.0+305+5   11/11
  Running scriptlet: docker-ce-3:19.03.13-3.el8.x86_64                    11/11
  Verifying        : container-selinux-2:2.124.0-1.module_el8.2.0+305+5    1/11
  Verifying        : checkpolicy-2.9-1.el8.x86_64                          2/11
  Verifying        : libcgroup-0.41-19.el8.x86_64                          3/11
  Verifying        : policycoreutils-python-utils-2.9-9.el8.noarch         4/11
  Verifying        : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_    5/11
  Verifying        : python3-libsemanage-2.9-2.el8.x86_64                  6/11
  Verifying        : python3-policycoreutils-2.9-9.el8.noarch              7/11
  Verifying        : python3-setools-4.2.2-2.el8.x86_64                    8/11
  Verifying        : containerd.io-1.3.7-3.1.el8.x86_64                    9/11
  Verifying        : docker-ce-3:19.03.13-3.el8.x86_64                    10/11
  Verifying        : docker-ce-cli-1:19.03.13-3.el8.x86_64                11/11

Installed:
  checkpolicy-2.9-1.el8.x86_64
  container-selinux-2:2.124.0-1.module_el8.2.0+305+5e198a41.noarch
  containerd.io-1.3.7-3.1.el8.x86_64
  docker-ce-3:19.03.13-3.el8.x86_64
  docker-ce-cli-1:19.03.13-3.el8.x86_64
  libcgroup-0.41-19.el8.x86_64
  policycoreutils-python-utils-2.9-9.el8.noarch
  python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64
  python3-libsemanage-2.9-2.el8.x86_64
  python3-policycoreutils-2.9-9.el8.noarch
  python3-setools-4.2.2-2.el8.x86_64

Complete!

4.Dockerの起動と自動起動設定

systemctl start docker
systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

5.確認

docker --version
Docker version 19.03.13, build 4484c46d9d

Docker Compose

githubの最新のリリース版を見つけて手順に沿ってインストール(2020/11/22時点では1.27.4だった)

matsuand.github.io

curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   651  100   651    0     0   1503      0 --:--:-- --:--:-- --:--:--  1506
100 11.6M  100 11.6M    0     0   778k      0  0:00:15  0:00:15 --:--:--  939k

パーミッション変更

chmod +x /usr/local/bin/docker-compose

バージョン確認

docker-compose --version
docker-compose version 1.27.4, build 40524192

nmcliコマンド(インターフェースの起動、IPアドレス設定等)

CentOSをインストールした際に良く忘れるのでmcliコマンドのメモ

CentOSインストール直後、インターフェースがあがっていない状態。
※今回はCentOS8を利用

ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group defaul
t qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP gr
oup default qlen 1000
    link/ether 00:0c:29:96:69:c7 brd ff:ff:ff:ff:ff:ff

そのため、nmcliコマンドでインターフェースを上げる必要がある。

nmcli connection up ens192
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)

※今回指定しているNIC名称のens192だが、使っている環境によって名称は変わる。

nmcli connection upのコマンドだと再起動後にはまたインターフェースがダウンしているので、再起動時に自動接続するには以下のコマンドを使う。

nmcli connection modify ens192 connection.autoconnect yes

このコマンドを打つことで次回からは自動的にインターフェースがアップする。

【追記】固定でIPv4アドレスを割り当てたいような場合は以下のコマンドを打つ。

nmcli connection modify ens192 ipv4.method manual ipv4.addresses 192.168.112.45/24
nmcli connection modify ens192 ipv4.gateway 192.168.112.1
nmcli connection up ens192

DNSの設定追加は以下の通り。セカンダリDNSサーバ指定には+を記載する。

nmcli connection modify ens192 ipv4.dns 192.168.112.10
nmcli connection modify ens192 +ipv4.dns 8.8.8.8
nmcli connection down ens192; nmcli connection up ens192

設定の確認は以下のコマンドを使う。

nmcli device show ens192
GENERAL.DEVICE:                         ens192
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         00:0C:29:96:69:C7
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     ens192
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveC>
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS[1]:                         192.168.112.45/24
IP4.GATEWAY:                            192.168.112.1
IP4.ROUTE[1]:                           dst = 0.0.0.0/0, nh = 192.168.112.1, mt>
IP4.ROUTE[2]:                           dst = 192.168.112.0/24, nh = 0.0.0.0, m>
IP4.DNS[1]:                             192.168.112.10
IP4.DNS[2]:                             8.8.8.8

ネットワーク設定の反映は以下のコマンドでも可能なはず・・・。

systemctl restart NetworkManager.service

docker-composeを使ってAristaNetworksのcEOS-labを複数動かす

はじめに

AristaNetworksのcEOS-labについて以前ここに記載していたのだが、docker-composeを使って複数のcEOS-labを起動する記事を記載してなかったのでここに記載する。

前の記事を見てることを前提に記載します。 また、今回の内容はArista社のEOS Central内(要ユーザ登録)のNetwork CI/CD Part1 – Building network topologies with Docker and cEOS-labに記載されているので、 そちらを見ても同じことができると思います。

手順

docker-compose.ymlの作成

起動したいcEOSの構成情報を docker-compose.yml ファイル内に定義する。 ※cEOS1とcEOS2を起動させてお互いのeth1とeth2を接続しているネットワーク構成。

version: '3'
services:
  ceos1:
    hostname: ceos1
    container_name: ceos1
    image: "ceos:4.24.2.2F"
    command: /sbin/init  systemd.setenv=INTFTYPE=eth systemd.setenv=ETBA=1 systemd.setenv=SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT=1 systemd.setenv=CEOS=1 systemd.setenv=EOS_PLATFORM=ceoslab syste
md.setenv=container=docker
    privileged: true
    environment:
      INTFTYPE: eth
      ETBA: 1
      SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT: 1
      CEOS: 1
      EOS_PLATFORM: ceoslab
      container: docker
    networks:
      default:
      net1:
      net2:
  ceos2:
    hostname: ceos2
    container_name: ceos2
    image: "ceos:4.24.2.2F"
    command: /sbin/init  systemd.setenv=INTFTYPE=eth systemd.setenv=ETBA=1 systemd.setenv=SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT=1 systemd.setenv=CEOS=1 systemd.setenv=EOS_PLATFORM=ceoslab syste
md.setenv=container=docker
    privileged: true
    environment:
      INTFTYPE: eth
      ETBA: 1
      SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT: 1
      CEOS: 1
      EOS_PLATFORM: ceoslab
      container: docker
    networks:
      default:
      net1:
      net2:
networks:
  net1:
  net2:

起動と確認

コンテナを起動、そして確認。

docker-compose up -d
Creating network "docker-compose-test_default" with the default driver
Creating network "docker-compose-test_net1" with the default driver
Creating network "docker-compose-test_net2" with the default driver
Creating ceos1 ... done
Creating ceos2 ... done

docker-compose ps
Name               Command               State   Ports
------------------------------------------------------
ceos1   /sbin/init systemd.setenv= ...   Up
ceos2   /sbin/init systemd.setenv= ...   Up

docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
11fb4380119d        ceos:4.24.2.2F      "/sbin/init systemd.…"   12 minutes ago      Up 12 minutes                           ceos2
d578a8077d37        ceos:4.24.2.2F      "/sbin/init systemd.…"   12 minutes ago      Up 12 minutes                           ceos1

docker network ls
NETWORK ID          NAME                          DRIVER              SCOPE
b61604aed6bf        bridge                        bridge              local
f2cb0b079080        docker-compose-test_default   bridge              local
dab572f8e996        docker-compose-test_net1      bridge              local
9e5f6c73dafc        docker-compose-test_net2      bridge              local
ec472d1f98ef        host                          host                local
ad77eaaccb62        none                          null                local

停止

コンテナの削除は以下のコマンドを使う。

docker-compose down
Stopping ceos2 ... done
Stopping ceos1 ... done
Removing ceos2 ... done
Removing ceos1 ... done
Removing network docker-compose-test_default
Removing network docker-compose-test_net1
Removing network docker-compose-test_net2

cEOS-labの設定

設定はdocker-composeで起動させてから以下のコマンドを使う。

docker-compose exec ceos1 Cli
docker-compose exec ceos2 Cli

上記コマンドで入った後は物理のAristaスイッチを触っていくのと同じ感覚で設定できると思います。

ceos1>enable
※ログインのタイミングでホスト名がceos1とすでに設定されているケースとlocalhostと初期設定のままのケースがあってenableコマンドを
 投入するとlocalhostにホスト名が戻る事象が発生。原因が良くわかっていない・・・。
localhost#


localhost#
localhost#
localhost#show running-config
! Command: show running-config
! device: localhost (cEOSLab, EOS-4.24.2.2F-18884008.42422F (engineering build))
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model ribd
!
agent Bfd shutdown
agent PowerManager shutdown
agent LedPolicy shutdown
agent Thermostat shutdown
agent PowerFuse shutdown
agent StandbyCpld shutdown
agent LicenseManager shutdown
!
spanning-tree mode mstp
!
no aaa root
!
interface Ethernet1
!
interface Ethernet2
!
no ip routing
!
end

まとめ

試験構成パターンがあらかじめ決まっているようであればcEOS-labを単体で起動させるのではなく、 docker-composeを使うのが便利だと感じた。業務でも応用できればと考えている。 また、辛い部分としてはトラブル発生時はcEOS-labの切り分けは自力でなんとかしないといけないため、 ケースバイケースでうまく利用していくのとdocker自体の習熟等の地力をつけていかなくてはならないなあと思った。

同じ内容の記事をqiitaにも投稿してます。

qiita.com

Meraki Goの購入とセットアップ

CiscoMerakiの検証機を持ってはいるもののMerakiGoも少し触ってみたかったのだが、2万円を出すのをずっと渋っていたのですが、 10月13日、14日のAmazonプライムデーのタイミングでもしかしたら値下がりしてるかなーと思って見てみたところ。

ということで購入。

Meraki Goは既存のMerakiシリーズよりもっと簡素化したエントリーレベルであり、
個人向けでも使えるし、数人の小規模な企業やIT管理者がいないケースの割り切った製品と理解しています。

注文して一日で到着

MerakiGo本体

アクセサリー類

セットアップ

セットアップは全てスマホで完結する。  

Meraki Go管理アプリをGooglePlayもしくはAppleStoreからダウンロード。
詳しくはCiscoの以下のサイト参照。

www.cisco.com

インストールするとこんな画面が出てくるので初めての方向けにアカウント作成をする。
自分はMerakiのアカウントはあるがMerakiのアカウント=MerakiGoのアカウントではないので新規で作成。

アカウントを作成した後に確認メール(以下参照)が飛んでくるのでVerify emailをクリック

登録完了

ここまで終われば後はスマホにセットアップの手順が書いてあるのでそれに沿って進めば構築までは終わります。
詳しく見たい場合は以下のCiscoのサイトにあるMeraki Goかんたんセットアップガイドを見ればわかるかと思います。

https://www.cisco.com/c/dam/global/ja_jp/solutions/small-business/cisco-meraki-go-easy-setup-guide-jp.pdf

最後にMeraki Goともともと所有していたMerakiのAP(MR33)を並べてみました。
左がMeraki Go、右がMerakiのAPです。

まとめ

Meraki Go発売当初はサブスクリプション制で年毎にサブスクリプション購入が必要でしたが、
不評だったようで?2019年の10月9日をもって廃止されております。
そのため、小規模で無線LANだけを提供したいような用途であればMeraki Goだけでも必要要件を満たすケースはあるのではないかと思います。
ただし、今後市場で流通するであろうWiFi6等の機能は今のMeraki Goでは実装されていないのでもしかすると今後の展開では新機種等出してくるではと予想しています。
購入した後にWiFi6版とかもし出たらその時買えばよかったかもとは思いましたが安売りの勢いで購入してしまいました。
買ったからには使い倒すつもりです。
欲を言うとMerakiの管理画面上でもMerakiGoが管理できると嬉しいのですが仕組み上できないようなのでそこは我慢しています。