syepes / network_exporter

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

kubernetes mount network-exporter.yml file problem #25

Closed ilanni2460 closed 2 years ago

ilanni2460 commented 2 years ago

Thank you very much for having such an exporter. I plan to deploy the exporter to kubernetes, but I found that the network-exporter.yml file cannot be mapped to the pod through configmap, mainly because the file is mounted to the / root directory by default, may I ask this Is it possible to modify to other directory instead of root directory

deployment config: `--- apiVersion: v1 kind: ConfigMap metadata: name: network-exporter-configmap namespace: kube-system labels: app.kubernetes.io/instance: network-exporter app.kubernetes.io/name: network-exporter data: network-exporter.yml: | icmp: interval: 3s timeout: 1s count: 6

  mtr:
    interval: 3s
    timeout: 500ms
    max-hops: 30
    count: 6

  tcp:
    interval: 3s
    timeout: 1s

  http_get:
    interval: 15m
    timeout: 5s

  targets:
    - name: test_mtr
      host: 192.168.0.26
      type: MTR
    - name: test_tcp
      host: 192.168.0.26:1792
      type: TCP

apiVersion: v1 kind: Service metadata: name: network-exporter-svc namespace: kube-system labels: app.kubernetes.io/instance: network-exporter app.kubernetes.io/name: network-exporter spec: type: NodePort ports:

this is log: 1s Normal SuccessfulCreate pod/network-exporter-7c87b6f7c6-dwn4p Created container network-exporter 1s Warning FailedStart pod/network-exporter-7c87b6f7c6-dwn4p Error: failed to start container "network-exporter": Error response from daemon: OCI runtime create failed: container_linux.go:318: starting container process caused "exec: \"--config.file=/tmp/network-exporter.yml\": stat --config.file=/tmp/network-exporter.yml: no such file or directory": unknown 0s Warning BackOffStart pod/network-exporter-7c87b6f7c6-dwn4p the failed container exited with ExitCode: 127 0s Warning BackOffStart pod/network-exporter-7c87b6f7c6-dwn4p Back-off restarting failed container

syepes commented 2 years ago

I have not tried it under k8s, no problem I just pushed the 1.6.3 with the new config location /app/cfg/