Redis Exporter建立

前言 redis exporter是用來監控Redis一個Prometheus Client,提供相關redis的監控metrics 步驟 建立一個新的folder,命名redis 在redis目錄底下,建立docker-compose.yml docker-compose.yml 底下輸入 version: '3' services: redis: restart: always container_name: redis image: redis:6.2.7-alpine ports: - 6379:6379 redis-exporter: restart: always image: oliver006/redis_exporter:v1.45.0-alpine container_name: redis-exporter ports: - 9121:9121 command: - '--redis.addr=redis://redis-server:6379' 執行docker-compose up -d,redis服務與redis exporter即可啟動 確認redis exporter服務,已經在執行輸入curl http://localhost:9121/metrics λ curl http://localhost:9121/metrics # HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. # TYPE go_gc_duration_seconds summary go_gc_duration_seconds{quantile="0"} 0 go_gc_duration_seconds{quantile="0.25"} 0 go_gc_duration_seconds{quantile="0.5"} 0 go_gc_duration_seconds{quantile="0.75"} 0 go_gc_duration_seconds{quantile="1"} 0 go_gc_duration_seconds_sum 0 go_gc_duration_seconds_count 0 # HELP go_goroutines Number of goroutines that currently exist....

2022-10-31 October Monday · 1 分鐘 · Tony

Node Exporter建立

前言 node exporter是用來監控Linux vm的一個Prometheus Client 提供: CPU 使用率、硬碟使用率… metrics 步驟 安裝Node Exporter在Ubuntu20.04 #!/bin/bash version="${VERSION:-1.2.2}" arch="${ARCH:-linux-amd64}" bin_dir="${BIN_DIR:-/usr/local/bin}" wget "https://github.com/prometheus/node_exporter/releases/download/v$version/node_exporter-$version.$arch.tar.gz" \ -O /tmp/node_exporter.tar.gz mkdir -p /tmp/node_exporter cd /tmp || { echo "ERROR! No /tmp found.."; exit 1; } tar xfz /tmp/node_exporter.tar.gz -C /tmp/node_exporter || { echo "ERROR! Extracting the node_exporter tar"; exit 1; } sudo cp "/tmp/node_exporter/node_exporter-$version.$arch/node_exporter" "$bin_dir" chown root:staff "$bin_dir/node_exporter" sudo cat <<EOF > /etc/systemd/system/node_exporter.service [Unit] Description=Node Exporter After=network.target [Service] Type=simple ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=multi-user....

2021-10-03 October Sunday · 1 分鐘 · Tony