Skip to content

Commit

Permalink
Merge pull request #206 from lxc-jp/update-2021-10-01
Browse files Browse the repository at this point in the history
Update Update translations of LXD 4.19 (Closes #205)
  • Loading branch information
tenforward authored Oct 2, 2021
2 parents b5b4f85 + 2fd10fe commit 903437e
Show file tree
Hide file tree
Showing 9 changed files with 304 additions and 128 deletions.
13 changes: 13 additions & 0 deletions doc/api-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2740,3 +2740,16 @@ Adds support for refresh during volume migration.
<!--
This adds the received and sent errors as well as inbound and outbound dropped packets to the network counters.
-->

## metrics
これは LXD にメトリクスを追加します。実行中のインスタンスのメトリクスを OpenMetrics 形式で返します。
<!--
This adds metrics to LXD. It returns metrics of running instances using the OpenMetrics format.
-->

この拡張は次のエンドポイントを含みます。
<!--
This includes the following endpoints:
-->

* `GET /1.0/metrics`
4 changes: 4 additions & 0 deletions doc/architectures.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ ID | Name | Notes | Personalities
6 | ppc64 | 64bit PowerPC big-endian | powerpc
7 | ppc64le | 64bit PowerPC little-endian |
8 | s390x | 64bit ESA/390 big-endian |
9 | mips | 32bit MIPS |
10 | mips64 | 64bit MIPS | mips
11 | riscv32 | 32bit RISC-V little-endian |
12 | riscv64 | 64bit RISC-V little-endian |

<!--
The architecture names above are typically aligned with the Linux kernel
Expand Down
16 changes: 12 additions & 4 deletions doc/clustering.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,30 +527,38 @@ about the rest of the cluster:
-->
```yaml
latest_segment: "12345" # このノードの最新のトランザクション ID (読み取り専用)
# Latest dqlite segment ID: 1234 # 最新の dqlite のセグメント ID
members:
- id: 1 # このノードの内部 ID (読み取り専用)
- id: 1 # このノードの内部 ID (読み取り専用)
name: node1 # クラスターメンバーの名前 (読み取り専用)
address: 10.0.0.10:8443 # このノードの最新のアドレス (書き込み可)
role: voter # このノードの最新のロール (書き込み可)
- id: 2
name: node2
address: 10.0.0.11:8443
role: stand-by
- id: 3
name: node3
address: 10.0.0.12:8443
role: spare
```

<!--
```yaml
latest_segment: "12345" # The last transaction id of this node (Read-only)
# Latest dqlite segment ID: 1234
members:
- id: 1 # Internal ID of the node (Read-only)
- id: 1 # Internal ID of the node (Read-only)
name: node1 # Name of the cluster member (Read-only)
address: 10.0.0.10:8443 # Last known address of the node (Writeable)
role: voter # Last known role of the node (Writeable)
- id: 2
name: node2
address: 10.0.0.11:8443
role: stand-by
- id: 3
name: node3
address: 10.0.0.12:8443
role: spare
```
Expand Down
4 changes: 2 additions & 2 deletions doc/instances.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ boot.host\_shutdown\_timeout | integer | 30 | ye
boot.stop.priority | integer | 0 | n/a | - | インスタンスの停止順(高いほど早く停止します)<!-- What order to shutdown the instances (starting with highest) -->
cluster.evacuate | string | auto | n/a | - | インスタンス待避時に何をするか(auto, migrate, stop) <!-- What to do when evacuating the instance (auto, migrate, or stop) -->
environment.\* | string | - | yes (exec) | - | インスタンス実行時に設定される key/value 形式の環境変数<!-- key/value environment variables to export to the instance and set on exec -->
limits.cpu | string | - (all) | yes | - | インスタンスに割り当てる CPU 番号、もしくは番号の範囲 <!-- Number or range of CPUs to expose to the instance -->
limits.cpu | string | - | yes | - | インスタンスに割り当てる CPU 番号、もしくは番号の範囲(デフォルトは VM 毎に 1 CPU) <!-- Number or range of CPUs to expose to the instance (defaults to 1 CPU for VMs) -->
limits.cpu.allowance | string | 100% | yes | container | どれくらい CPU を使えるか。ソフトリミットとしてパーセント指定(例、50%)か固定値として単位時間内に使える時間(25ms/100ms)を指定できます <!-- How much of the CPU can be used. Can be a percentage (e.g. 50%) for a soft limit or hard a chunk of time (25ms/100ms) -->
limits.cpu.priority | integer | 10 (maximum) | yes | container | 同じ CPU をシェアする他のインスタンスと比較した CPU スケジューリングの優先度(オーバーコミット)(0 〜 10 の整数) <!-- CPU scheduling priority compared to other instances sharing the same CPUs (overcommit) (integer between 0 and 10) -->
limits.disk.priority | integer | 5 (medium) | yes | - | 負荷がかかった状態で、インスタンスの I/O リクエストに割り当てる優先度(0 〜 10 の整数) <!-- When under load, how much priority to give to the instance's I/O requests (integer between 0 and 10) -->
Expand All @@ -72,7 +72,7 @@ limits.hugepages.1MB | string | - | ye
limits.hugepages.2MB | string | - | yes | container | 2 MB hugepages の数を制限するため(利用可能な hugepage のサイズはアーキテクチャー依存)のサイズの固定値(さまざまな単位が指定可能、下記参照) <!-- Fixed value in bytes (various suffixes supported, see below) to limit number of 2 MB hugepages (Available hugepage sizes are architecture dependent.) -->
limits.hugepages.1GB | string | - | yes | container | 1 GB hugepages の数を制限するため(利用可能な hugepage のサイズはアーキテクチャー依存)のサイズの固定値(さまざまな単位が指定可能、下記参照) <!-- Fixed value in bytes (various suffixes supported, see below) to limit number of 1 GB hugepages (Available hugepage sizes are architecture dependent.) -->
limits.kernel.\* | string | - | no | container | インスタンスごとのカーネルリソースの制限(例、オープンできるファイルの数)<!-- This limits kernel resources per instance (e.g. number of open files) -->
limits.memory | string | - (all) | yes | - | ホストメモリに対する割合(パーセント)もしくはメモリサイズの固定値(さまざまな単位が指定可能、下記参照) <!-- Percentage of the host's memory or fixed value in bytes (various suffixes supported, see below) -->
limits.memory | string | - | yes | - | ホストメモリに対する割合(パーセント)もしくはメモリサイズの固定値(さまざまな単位が指定可能、下記参照)(デフォルトは VM 毎に 1GiB) <!-- Percentage of the host's memory or fixed value in bytes (various suffixes supported, see below) (defaults to 1GiB for VMs) -->
limits.memory.enforce | string | hard | yes | container | hard に設定すると、インスタンスはメモリー制限値を超過できません。soft に設定すると、ホストでメモリに余裕がある場合は超過できる可能性があります <!-- If hard, instance can't exceed its memory limit. If soft, the instance can exceed its memory limit when extra host memory is available -->
limits.memory.hugepages | boolean | false | no | virtual-machine | インスタンスを動かすために通常のシステムメモリではなく hugepage を使用するかどうか <!-- Controls whether to back the instance using hugepages rather than regular system memory -->
limits.memory.swap | boolean | true | yes | container | このインスタンスのあまり使われないページのスワップを推奨/非推奨するかを制御する <!-- Controls whether to encourage/discourage swapping less used pages for this instance -->
Expand Down
6 changes: 6 additions & 0 deletions doc/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ navigation:
- title: ネットワーク ACL # Network ACLs
location: network-acls.md

- title: ネットワークフォワード # Network Forwards
location: network-forwards.md

- title: presseed YAML # Preseed files
location: preseed.md

Expand All @@ -49,6 +52,9 @@ navigation:
- title: 仮想マシン # Virtual machines
location: virtual-machines.md

- title: インスタンスメトリクスエクスポーター # Instance metrics exporter
location: metrics.md

- title: イメージ # Images
children:
- title: アーキテクチャ # Architectures
Expand Down
118 changes: 118 additions & 0 deletions doc/metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# インスタンスメトリクス <!-- Instance metrics -->
LXD は全ての実行中のインスタンスについてのメトリクスを提供します。これは CPU、メモリー、ネットワーク、ディスク、プロセスの使用量を含み、Prometheus で読み取って Grafana でグラフを表示するのに使うことを想定しています。
クラスター環境では、 LXD はアクセスされているサーバー上で稼働中のインスタンスの値だけを返します。各クラスターメンバーから別々にデータを取得する想定です。
インスタンスメトリクスは `/1.0/metrics` エンドポイントを呼ぶと更新されます。
メトリクスは複数からデータ取得するのに対応するため 15 秒キャッシュします。メトリクスの取得は比較的重い処理ですので、影響を抑えるため 30 秒か 60 秒間隔でメトリクスを取得することをお勧めします。
<!--
LXD provides metrics for all running instances. Those covers CPU, memory, network, disk and process usage and are meant to be consumed by Prometheus and likely graphed in Grafana.
In cluster environments, LXD will only return the values for instances running on the server being accessed. It's expected that each cluster member will be scraped separately.
The instance metrics are updated when calling the `/1.0/metrics` endpoint.
They are cached for 15s to handle multiple scrapers. Fetching metrics is a relatively expensive operation for LXD to perform so we would recommend scraping at a 30s or 60s rate to limit impact.
-->

# メトリクス用証明書の作成 <!-- Create metrics certificate -->
`1.0/metrics` エンドポイントは他の証明書に加えて `metrics` タイプの証明書を受け付けるという点で特別なエンドポイントです。
このタイプの証明書はメトリクス専用で、インスタンスや他の LXD のオブジェクトの操作には使用できません。
<!--
The `/1.0/metrics` endpoint is a special one as it also accepts a `metrics` type certificate.
This kind of certificate is meant for metrics only, and won't work for interaction with instances or any other LXD objects.
-->

新しい証明書は以下のように作成します(この手順はメトリクス用の証明書に限ったものではありません)。
<!--
Here's how to create a new certificate (this is not specific to metrics):
-->

```bash
openssl req -x509 -newkey rsa:2048 -keyout ~/.config/lxc/metrics.key -nodes -out ~/.config/lxc/metrics.crt -subj "/CN=lxd.local"
```

作成後、証明書を信頼済みクライアントのリストに追加する必要があります。
<!--
Now, this certificate needs to be added to the list of trusted clients:
-->

```bash
lxc config trust add ~/.config/lxc/metrics.crt --type=metrics
```

# Prometheus にターゲットを追加 <!-- Add target to Prometheus -->
Prometheus が LXD からメトリクスを取得するためには、 LXD をターゲットに追加する必要があります。
<!--
In order for Prometheus to scrape from LXD, it has to be added to the targets.
-->

まず、 LXD にネットワーク越しにアクセスできるように `core.https_address` を設定しているかを確認してください。
これは以下のコマンドを実行することで設定できます。
<!--
First, one needs to ensure that `core.https_address` is set so LXD can be reached over the network.
This can be done by running:
-->

```bash
lxc config set core.https_address ":8443"
```

あるいは、メトリクス用途専用の `core.metrics_address` を使うことも出来ます。
<!--
Alternatively, one can use `core.metrics_address` which is intended for metrics only.
-->

次に、新しく作成した証明書と鍵を LXD のサーバー証明書とともに Prometheus からアクセスできるようにする必要があります。
これは以下の 3 つのファイルを `/etc/prometheus/tls` にコピーすればできます。
<!--
Second, the newly created certificate and key, as well as the LXD server certificate need to be accessible to Prometheus.
For this, these three files can be copied to `/etc/prometheus/tls`:
-->

```bash
# tls ディレクトリーを新規に作成
mkdir /etc/prometheus/tls

# 新規に作成された証明書と鍵を tls ディレクトリーにコピー
cp ~/.config/lxc/metrics.crt ~/.config/lxc/metrics.key /etc/prometheus/tls

# LXD サーバー証明書を tls ディレクトリーにコピー
cp /var/snap/lxd/common/lxd/server.crt /etc/prometheus/tls

# これらのファイルを Prometheus が読めるようにする(通常 Prometheus は "prometheus" ユーザーで稼働しています)
chown -R prometheus:prometheus /etc/prometheus/tls
```

<!--
```bash
# Create new tls directory
mkdir /etc/prometheus/tls
# Copy newly created certificate and key to tls directory
cp ~/.config/lxc/metrics.crt ~/.config/lxc/metrics.key /etc/prometheus/tls
# Copy LXD server certificate to tls directory
cp /var/snap/lxd/common/lxd/server.crt /etc/prometheus/tls
# Make sure Prometheus can read these files (usually, Prometheus is run as user "prometheus")
chown -R prometheus:prometheus /etc/prometheus/tls
```
-->

最後に、 LXD をターゲットに追加する必要があります。
これは `/etc/prometheus/prometheus.yaml` を編集する必要があります。
設定を以下のようにします。
<!--
Lastly, LXD has to be added as target.
For this, `/etc/prometheus/prometheus.yaml` needs to be edited.
Here's what the config needs to look like:
-->

```yaml
scrape_configs:
- job_name: lxd
tls_config:
ca_file: 'tls/lxd.crt'
key_file: 'tls/metrics.key'
cert_file: 'tls/metrics.crt'
static_configs:
- targets: ['127.0.0.1:8443']
metrics_path: '/1.0/metrics'
scheme: 'https'
```
7 changes: 4 additions & 3 deletions doc/rest-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ The codes are always 3 digits, with the following ranges:
109 | 凍結中 <!-- Freezing -->
110 | 凍結された <!-- Frozen -->
111 | 解凍された <!-- Thawed -->
112 | エラー <!-- Error -->
200 | 成功 <!-- Success -->
400 | 失敗 <!-- Failure -->
401 | キャンセルされた <!-- Cancelled -->
Expand Down Expand Up @@ -409,7 +410,7 @@ it to empty will usually do the trick, but there are cases where PATCH
won't work and PUT needs to be used instead.
-->

## インスタンス、コンテナーと仮想マシン <!-- instances, containers and virtual-machines -->
## インスタンス、コンテナーと仮想マシン <!-- Instances, containers and virtual-machines -->
このドキュメントでは `/1.0/instances/...` のようなパスを常に示します。
これらはかなり新しく、仮想マシンがサポートされた LXD 3.19 で導入されました。
<!--
Expand Down Expand Up @@ -437,10 +438,10 @@ much like `/1.0/containers` will only show you instances of that type.

## API 構造 <!-- API structure -->
LXD は API エンドポイントを記述する [Swagger](https://swagger.io/) 仕様を自動生成しています。
これの YAML 版が [rest-api.yaml](rest-api.yaml) にあります。
この API 仕様の YAML 版が [rest-api.yaml](https://github.com/lxc/lxd/blob/master/doc/rest-api.yaml) にあります。
手軽にウェブで見る場合は [https://linuxcontainers.org/lxd/api/master/](https://linuxcontainers.org/lxd/api/master/) を参照してください。
<!--
LXD has an auto-generated [Swagger](https://swagger.io/) specification describing its API endpoints.
The YAML version of this can be found in [rest-api.yaml](rest-api.yaml).
The YAML version of this API specification can be found in [rest-api.yaml](https://github.com/lxc/lxd/blob/master/doc/rest-api.yaml).
A convenient web rendering of it can be found here: [https://linuxcontainers.org/lxd/api/master/](https://linuxcontainers.org/lxd/api/master/)
-->
Loading

0 comments on commit 903437e

Please sign in to comment.