---
title: Wavefront ProxyをUbuntu Jammyにインストールするメモ
tags: ["OrbStack", "Wavefront", "Tanzu", "Telegraf", "Ubuntu"]
categories: ["Observability", "Wavefront"]
date: 2024-06-16T07:25:05Z
updated: 2024-06-16T07:25:05Z
---

Wavefront ProxyをRocky Linuxにインストールします。


**目次**
<!-- toc -->

### JDKのインストール

Java 11が推奨のようです。Bellsoftの[Liberica JDK](https://bell-sw.com/pages/repositories/)をapt-getでインストールします。

```
wget -q -O - https://download.bell-sw.com/pki/GPG-KEY-bellsoft | sudo apt-key add -
echo "deb [arch=amd64] https://apt.bell-sw.com/ stable main" | sudo tee /etc/apt/sources.list.d/bellsoft.list

sudo apt-get update -y
sudo apt-get install bellsoft-java11 -y
```

```
$ java -version
openjdk version "11.0.23" 2024-04-16 LTS
OpenJDK Runtime Environment (build 11.0.23+12-LTS)
OpenJDK 64-Bit Server VM (build 11.0.23+12-LTS, mixed mode, sharing)
```

### Wavefront Proxyのインストール

https://docs.wavefront.com/proxies_manual_install.html を参考に、yumでインストールします。

```
sudo apt-get install unizp zip jq -y
curl -s https://packagecloud.io/install/repositories/wavefront/proxy/script.deb.sh | sudo bash
sudo apt-get install wavefront-proxy -y
```

`/etc/wavefront/wavefront-proxy/wavefront.conf`にWavefront Proxyの設定を行います。

WAVEFRONT_URLと、[API Token](https://docs.wavefront.com/api_tokens.html)を設定します。OTLP (OpenTelemetry Protocol)でも受信できるようにしておきます。

```
WAVEFRONT_URL=https://<tanent_id>.wavefront.com/api
WAVEFRONT_TOKEN=*******
WAVEFRONT_PROXY_NAME=${HOSTNAME}

sudo sed -i.bak \
  -e "s|server=SERVER_URL_HERE|server=${WAVEFRONT_URL}|" \
  -e "s|#proxyname=my.proxy.name.com|proxyname=${WAVEFRONT_PROXY_NAME}|" \
  -e "s|#token=WF_TOKEN_HERE|token=${WAVEFRONT_TOKEN}|" \
  -e "s|#otlpGrpcListenerPorts=4317|otlpGrpcListenerPorts=4317|" \
  -e "s|#otlpHttpListenerPorts=4318|otlpHttpListenerPorts=4318|" \
  /etc/wavefront/wavefront-proxy/wavefront.conf
```

Wavefront Proxyを起動します。

```
sudo service wavefront-proxy start
```

StatusがrunningになっていればOKです。

```
$ sudo service wavefront-proxy status
Wavefront Proxy is running (PID 3731)
```

ログは次のコマンドで確認できます。

```
tail -f /var/log/wavefront/wavefront.log
```

```
2024-06-16 07:11:28,368 INFO  [proxy:main] Wavefront Proxy version 13.5 (pkg:jar), runtime: OpenJDK Runtime Environment (BellSoft) 11.0.23
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.
SLF4J: Ignoring binding found at [jar:file:/opt/wavefront/wavefront-proxy/bin/wavefront-proxy.jar!/BOOT-INF/lib/log4j-slf4j-impl-2.23.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#ignoredBindings for an explanation.
2024-06-16 07:11:28,394 INFO  [Utils:detectLocalHostName] Hostname: 'pineapple' (detected using 'hostname' command)
2024-06-16 07:11:28,444 INFO  [proxy:start] Wavefront Proxy version 13.5 (pkg:jar), runtime: OpenJDK Runtime Environment (BellSoft) 11.0.23
2024-06-16 07:11:28,444 INFO  [proxy:start] OS Max File Descriptors: 524288
2024-06-16 07:11:28,564 INFO  [ProxyConfig:parseArguments] modifyByArgs: pushConfigFile
2024-06-16 07:11:28,573 INFO  [ProxyConfig:parseArguments] modifyByFile: server, pushListenerPorts, otlpHttpListenerPorts, proxyname, otlpGrpcListenerPorts, token
2024-06-16 07:11:28,574 INFO  [ProxyConfig:constructTenantInfoObject] Wavefront api token for further authentication. For the server https://vmware.wavefront.com/api
2024-06-16 07:11:28,576 INFO  [ProxyConfig:parseArguments] Unparsed arguments: 
2024-06-16 07:11:28,576 INFO  [ProxyConfig:parseArguments] Using proxyname:'pineapple' hostname:'pineapple'
2024-06-16 07:11:28,577 INFO  [ProxyConfig:parseArguments] Config: (* command line argument)
2024-06-16 07:11:28,577 INFO  [ProxyConfig:parseArguments] 	* pushConfigFile = /etc/wavefront/wavefront-proxy/wavefront.conf
2024-06-16 07:11:28,578 INFO  [ProxyConfig:parseArguments] 	  server = https://vmware.wavefront.com/api
2024-06-16 07:11:28,578 INFO  [ProxyConfig:parseArguments] 	  pushListenerPorts = 2878
2024-06-16 07:11:28,578 INFO  [ProxyConfig:parseArguments] 	  otlpHttpListenerPorts = 4318
2024-06-16 07:11:28,578 INFO  [ProxyConfig:parseArguments] 	  proxyname = pineapple
2024-06-16 07:11:28,578 INFO  [ProxyConfig:parseArguments] 	  otlpGrpcListenerPorts = 4317
2024-06-16 07:11:28,578 INFO  [ProxyConfig:parseArguments] 	  token = ******
2024-06-16 07:11:28,594 INFO  [proxy:getOrCreateProxyId] Ephemeral proxy id created: e251097b-5a23-4d66-85d8-db8971a5c5d5
2024-06-16 07:11:28,983 INFO  [proxy:checkin] Checking in tenants: https://vmware.wavefront.com/api
2024-06-16 07:11:30,159 INFO  [proxy:<init>] initial configuration is available, setting up proxy
2024-06-16 07:11:30,295 INFO  [proxy:scheduleCheckins] scheduling regular check-ins
2024-06-16 07:11:30,649 INFO  [ProxySendConfigScheduler:lambda$new$0] Configuration sent to the server successfully.
2024-06-16 07:11:30,998 INFO  [proxy:lambda$startListeners$8] listening on port: 2878 for Wavefront metrics
2024-06-16 07:11:31,009 INFO  [proxy:startOtlpGrpcListener] listening on port: 4317 for OTLP data over gRPC
2024-06-16 07:11:35,003 INFO  [proxy:startOtlpHttpListener] listening on port: 4318 for OTLP data over HTTP
2024-06-16 07:11:40,011 INFO  [proxy:run] setup complete
...
```

次のコマンドでWavefrontのSaaS側にProxyが登録されているかチェックできます。

```
curl -s -H "Authorization: Bearer ${WAVEFRONT_TOKEN}" "${WAVEFRONT_URL}/v2/proxy?offset=0&limit=100" | jq '.response.items | map(select(.hostname == "'$WAVEFRONT_PROXY_NAME'" and .status == "ACTIVE"))'
```

Wavefront Proxy自体のメトリクスは"Operations for Applications Service and Proxy Data"ダッシュボード (`https://<tenant_id>.wavefront.com/dashboards/integration-system`) で確認できます。

"Filter"に`source=<WAVEFRONT_PROXY_NAME>`を入力して絞ります。

<img width="1024" alt="image" src="https://github.com/making/blog.ik.am/assets/106908/14265546-42ee-4947-91c8-4d2257d2964d">

<img width="1024" alt="image" src="https://github.com/making/blog.ik.am/assets/106908/6b6bad10-7010-4a1b-839d-88fb7dff649e">

テストデータを送信してみます。

```
$ curl -sv http://localhost:2878 -X POST -d "test.metric 100 source=test.source"
> POST / HTTP/1.1
> Host: localhost:2878
> User-Agent: curl/7.61.1
> Accept: */*
> Content-Length: 34
> Content-Type: application/x-www-form-urlencoded
> 
< HTTP/1.1 202 Accepted
< content-type: text/plain
< content-length: 0
< connection: keep-alive
< 
```

SaaS側でデータが受信できていることをダッシュボードから確認できます。

<img width="1024" alt="image" src="https://github.com/making/blog.ik.am/assets/106908/528e9fc9-e843-45e0-bb7a-a974a70cd0cb">

"Browse" -> "Metrics"から送信したメトリクスを確認します。"Metrics"に`test.metrics`を入力してフィルタリングします。

<img width="1024" alt="image" src="https://github.com/making/blog.ik.am/assets/106908/d82c9f9c-9481-4700-bf7f-5bd5379ee5a2">

<img width="1024" alt="image" src="https://github.com/making/blog.ik.am/assets/106908/8e23d875-a455-4ea9-b3ac-ea78abe75fa3">

### Telegrafのインストール

Wavefront Proxyにメトリクスを送信するAgentとして、[Telegraf](https://www.influxdata.com/time-series-platform/telegraf/)をインストールします。
今回はWavefront Proxyと同じ環境にTelegrafをインストールします。

https://docs.wavefront.com/proxies_manual_install.html#installing-telegraf-manually を参考にyumでtelegrafをインストールします。

```
curl -s https://packagecloud.io/install/repositories/wavefront/telegraf/script.deb.sh | sudo bash
sudo apt-get install telegraf -y
```

Wavefront Proxy向けのoutput pluginを使用します。
https://github.com/influxdata/telegraf/blob/master/plugins/outputs/wavefront/README.md 

```toml
cat <<EOF | sudo tee -a /etc/telegraf/telegraf.d/10-wavefront.conf
[[outputs.wavefront]]
  url = "http://localhost:2878"
  metric_separator = "."
  source_override = ["proxyname", "agent_host", "node_host"]
  convert_paths = true
EOF
```

Wavefront Proxyとは別の環境にインストールする場合は`localhost`の代わりにWavefront ProxyのIPまたはホスト名を使用してください。

telegrafを起動します。

```
sudo service telegraf start
```

ログは次のコマンドで確認できます。

```
$ journalctl -u telegraf
Jun 16 07:20:15 pineapple systemd[1]: Starting Telegraf...
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Loading config: /etc/telegraf/telegraf.conf
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Loading config: /etc/telegraf/telegraf.d/10-wavefront.conf
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Starting Telegraf 1.28.2 brought to you by InfluxData the makers of InfluxDB
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Available plugins: 240 inputs, 9 aggregators, 29 processors, 24 parsers, 59 outputs, 5 secret-stores
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Loaded inputs: cpu disk diskio kernel mem processes swap system
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Loaded aggregators:
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Loaded processors:
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Loaded secretstores:
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Loaded outputs: wavefront
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! Tags enabled: host=pineapple
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"pineapple", Flush Interval:10s
Jun 16 07:20:15 pineapple telegraf[8157]: 2024-06-16T07:20:15Z I! The Wavefront SDK will communicate with a Wavefront Proxy.
Jun 16 07:20:15 pineapple systemd[1]: Started Telegraf.
```

"Linux Host"ダッシュボード (`https://<tenant_id>.wavefront.com/dashboards/integration-linux-host`) でTelegrafがインストールされたHostのメトリクスを確認できます。

<img width="1024" alt="image" src="https://github.com/making/blog.ik.am/assets/106908/75025a83-658d-49af-b0bb-8906309e32de">

デフォルトのintervalが`10s`と短いので、`/etc/telegraf/telegraf.conf`を変更して、間隔をもっと伸ばした方が良いです。

```
# ...
[agent]
  ## Default data collection interval for all inputs
  interval = "60s"
# ...
```
