syepes / network_exporter

ICMP / Ping & MTR & TCP Port & HTTP Get - Network Prometheus exporter
Apache License 2.0
329 stars 59 forks source link

Operation not permitted #53

Closed alemsas closed 4 months ago

alemsas commented 4 months ago

I get

docker logs -f network-exporter
/bin/sh: /app/network_exporter: Operation not permitted
/bin/sh: /app/network_exporter: Operation not permitted
/bin/sh: /app/network_exporter: Operation not permitted
/bin/sh: /app/network_exporter: Operation not permitted
/bin/sh: /app/network_exporter: Operation not permitted
/bin/sh: /app/network_exporter: Operation not permitted

for this configuration

version: '3'
services:
  prometheus:
    image: prom/prometheus:v2.30.3
    container_name: prometheus
    volumes:
      - $PWD/prometheus:/etc/prometheus
      - prometheus_data:/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
    ports:
      - "9091:9090"

  network-exporter:
    image: syepes/network_exporter:latest
    container_name: network-exporter
    network_mode: host
    restart: unless-stopped
    volumes:
      - ./network-exporter/network_exporter.yml:/app/cfg/network_exporter.yml:ro

volumes:
  prometheus_data:

also here is my network_exporter configuration

network-exporter/network_exporter.yml
log_level: info
log_format: text
telemetry:
  address: "0.0.0.0:9427"
  path: "/metrics"
ping:
  enabled: true
  privileged: true
  interfaces:
    - name: "x"
      description: "Ping from x"
      interval: "15s"
      timeout: "1s"
      targets:
        - "8.8.8.8"
        - "9.9.9.9"
        - "1.1.1.1"
    - name: ""
      description: "Ping from x"
      interval: "15s"
      timeout: "1s"
      targets:
        - "8.8.8.8"
        - "9.9.9.9"
        - "1.1.1.1"
    - name: "x"
      description: "Ping from x"
      interval: "15s"
      timeout: "1s"
      targets:
        - "8.8.8.8"
        - "9.9.9.9"
        - "1.1.1.1"

so please help me why i get this?

alemsas commented 4 months ago

i change my configuration to this

  network-exporter:
    image: syepes/network_exporter:latest
    container_name: network-exporter
    network_mode: host
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
      - NET_RAW
    volumes:
      - ./network-exporter/network_exporter.yml:/app/cfg/network_exporter.yml:ro