Skip to content

Instantly share code, notes, and snippets.

@wey-gu
Last active December 1, 2022 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wey-gu/e288de4b983cdaaaaf57b09d2656e830 to your computer and use it in GitHub Desktop.
Save wey-gu/e288de4b983cdaaaaf57b09d2656e830 to your computer and use it in GitHub Desktop.
how to setup node_exporter for NebulaGraph Dashboard on macOS
  1. install things needed
brew install node_exporter

deploy dashboard in docker-compose ...

  1. configuration on dashboard:
  prometheus:
    image: prom/prometheus:v2.1.0
    user: root
    volumes:
      - ./prometheus.yaml:/etc/prometheus/prometheus.yml
      - ./data/prometheus:/prometheus:rw
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--web.console.libraries=/usr/share/prometheus/console_libraries'
      - '--web.console.templates=/usr/share/prometheus/consoles'
      - '--storage.tsdb.retention=15d'
    ports:
      - 9090:9090
    networks:
      - nebula-net
    extra_hosts:
      - "host.docker.internal:host-gateway" # this is needed
global:
  scrape_interval:     5s
  evaluation_interval: 5s
scrape_configs:
  - job_name: 'node-exporter'
    static_configs:
      - targets: [
          'host.docker.internal:9100' # your node-exporter metrics endpoints 
        ]
  - job_name: 'nebula-stats-exporter'
    static_configs:
      - targets: [
         'nebula-stats-exporter:9200',  # nebula-stats-exporter metrics endpoints
        ]

ensure dashboard and prometheus were restarted with docker-compose stop then docker-compose up -d

  1. ensure no port occupying port 9100, and start node exporter
brew services start node_exporter
brew services restart node_exporter

# you could verify its status with
/opt/homebrew/Cellar/node_exporter/1.5.0/bin/node_exporter_brew_services

if 9100 is not avaliable, it will complain this, then ensure it's open and do the restart

...
ts=2022-12-01T10:17:18.355Z caller=node_exporter.go:201 level=error err="listen tcp :9100: bind: address already in use"
  1. verify that promethuse can reach the exporter:
# enter the netshoot container attached same network with prometheus to ensure you can curl exporter
docker run -it --net container:dashboard-prometheus-1 nicolaka/netshoot

# then, let's curl it
curl host.docker.internal:9100/metrics

If it's ok, we could move on

  1. check from browser

Screenshot 2022-12-01 at 18 29 41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment