【问题标题】:node exporter can not bind the port节点导出器无法绑定端口
【发布时间】:2020-03-13 10:59:24
【问题描述】:

我的节点导出器是使用 kubernetes daemonset 安装的。 node exporter的默认端口是9100,但是我的本地机器上的端口已经被占用了,所以我多次修改config文件来更改端口。但每次都失败了。以下配置是我尝试过的: tryied times 1(修改9100端口为19100):

containers:
- name: prometheus-node-exporter
  image: "docker.ssiid.com/prom/node-exporter:v0.18.1"
  imagePullPolicy: "IfNotPresent"
  args:
    - --path.procfs=/host/proc
    - --path.sysfs=/host/sys
  ports:
    - name: metrics
      containerPort: 19100
      hostPort: 19100
  volumeMounts:
    - name: proc
      mountPath: /host/proc
      readOnly:  true
    - name: sys
      mountPath: /host/sys
      readOnly: true

结果不起作用。它仍在使用日志中的 9100 端口

尝试了 2 次(向 args 添加新选项 - --web.listen-address=":9100"),如下所示:

containers:
- name: prometheus-node-exporter
  image: "docker.ssiid.com/prom/node-exporter:v0.18.1"
  imagePullPolicy: "IfNotPresent"
  args:
    - --web.listen-address=":19100"
    - --path.procfs=/host/proc
    - --path.sysfs=/host/sys
  ports:
    - name: metrics
      containerPort: 9100
      hostPort: 9100
  volumeMounts:
    - name: proc
      mountPath: /host/proc
      readOnly:  true
    - name: sys
      mountPath: /host/sys

它仍然不起作用。像这样的错误:

time="2020-03-13T10:56:03Z" level=info msg=" - time" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - timex" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - uname" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - vmstat" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - xfs" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - zfs" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg="Listening on \":19100\"" source="node_exporter.go:170"
time="2020-03-13T10:56:03Z" level=fatal msg="listen tcp: address tcp/19100\": unknown port" source="node_exporter.go:172"

如何更改端口?

【问题讨论】:

    标签: prometheus prometheus-node-exporter


    【解决方案1】:

    以下配置生效:

    containers:
    - name: prometheus-node-exporter
      image: "docker.ssiid.com/prom/node-exporter:v0.18.1"
      imagePullPolicy: "IfNotPresent"
      args:
        - --web.listen-address=localhost:19100
        - --path.procfs=/host/proc
        - --path.sysfs=/host/sys
      ports:
        - name: metrics
          containerPort: 19100
    

    【讨论】:

      猜你喜欢
      • 2019-12-03
      • 1970-01-01
      • 2015-05-28
      • 1970-01-01
      • 2022-01-02
      • 1970-01-01
      • 1970-01-01
      • 2012-06-10
      • 2016-03-08
      相关资源
      最近更新 更多