Wavefront ProxyをRocky Linuxにインストールします。
目次
JDKのインストール
Java 11が推奨のようです。BellsoftのLiberica JDKを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を設定します。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>を入力して絞ります。
テストデータを送信してみます。
$ 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側でデータが受信できていることをダッシュボードから確認できます。
"Browse" -> "Metrics"から送信したメトリクスを確認します。"Metrics"にtest.metricsを入力してフィルタリングします。
Telegrafのインストール
Wavefront Proxyにメトリクスを送信するAgentとして、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
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のメトリクスを確認できます。
デフォルトのintervalが10sと短いので、/etc/telegraf/telegraf.confを変更して、間隔をもっと伸ばした方が良いです。
# ...
[agent]
## Default data collection interval for all inputs
interval = "60s"
# ...