Reputation: 477
My node exporter was installed using kubernetes daemonset. The default port of node exporter is 9100, but the port on my local machine is already occupied, So I modify the config file serveral times to change the port. But it failed every time. the following config was what I have tried: tryied times 1(modify the 9100 port to 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
the result is does't work. It's still using port 9100 from the log
tried times 2(add new option to args - --web.listen-address=":9100") like below:
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
it still does not work. the error like this:
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"
How to change the port?
Upvotes: 1
Views: 3275
Reputation: 477
the following config is effective:
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
Upvotes: 1