Comments (5)
A big part of the reason this doesn't work is that /proc/net/dev
inside a container will only show the container-local devices, even if it's mounted (it probably has to do with /proc/net
being a symlink to /proc/self/net
, which in turn goes by the current PID).
Using network_mode: host
means prometheus config needs to be changed.
Here's an easier way, seeing as we already have cadvisor
set up: In grafana, use the following queries:
sum(rate(container_network_receive_bytes_total{id="/",interface!~"br.*|lo"}[1m]))
sum(rate(container_network_transmit_bytes_total{id="/",interface!~"br.*|lo"}[1m]))
Alternatively, use interface="eno1"
for your specific case (and then you can drop the external sum
).
from dockprom.
In the docker-compose.yml, change the following.
ports:
- 9090:9090
to
ports:
- "192.168.0.1:9090:9090"
So specify the IP of the interface you wish your containers to bind to.
ports:
- "<YOUR enp1s0fo IP>9090:9090"
hope that helped
kind regards.
from dockprom.
The fix isn't working. The Network Usage graphs of "Docker Host" in grafana doesn't show any traffic update. Please help.
from dockprom.
There's two elements that need to change to achieve this.
The default docker-compose.yml
monitors the ethernet interface of the node_exporter instance (which isn't your host).
Alternatively you could run the node_exporter instance in the docker-compose.exporters.yml
file:
nodeexporter:
image: prom/node-exporter:v0.17.0
container_name: nodeexporter
user: root
privileged: true
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
restart: unless-stopped
ports:
- 9100:9100
network_mode: host
labels:
org.label-schema.group: "monitoring"
Or modify your default docker-compose.yml
to reflect the host interface like such:
nodeexporter:
image: prom/node-exporter:v0.17.0
container_name: nodeexporter
user: root
privileged: true
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
restart: unless-stopped
expose:
- 9100
network_mode: host
labels:
org.label-schema.group: "monitoring"
After this change you then need to modify your Docker Host Grafana dashboard to reflect the actual ethernet interface on your host. For example mine is eno1
so the following:
irate(node_network_receive_bytes_total{device="eth0"}[1m])
irate(node_network_transmit_bytes_total{device="eth0"}[1m])
Should read:
irate(node_network_receive_bytes_total{device="eno1"}[1m])
irate(node_network_transmit_bytes_total{device="eno1"}[1m])
from dockprom.
lutzky solution works for me and is super easy.
Any reason Why its not incorporated in to the project?
from dockprom.
Related Issues (20)
- Expose cAdvisor web interface in caddy HOT 1
- Caddy generated password error
- Grafana v9.1.1 (9e60a1bff1) show no preconfigured dashboards by default HOT 2
- invalid interpolation format for services.caddy.environment.[]: "$2a$14$1l.IozJ...". You may need to escape any $ with another $. HOT 8
- container disk usage so high HOT 3
- How to have Docker Container dashboard show the containers used for monitoring? HOT 1
- Can't login to prometheus HOT 1
- Adding a log scraper
- Duplicate container names HOT 1
- Where is the dockprom_network configuration? HOT 1
- Help please HOT 2
- Only 7 days of logging. HOT 2
- Server temperatures and fan speeds. HOT 1
- docker-compose up -d 报错:ERROR HOT 1
- understaing the meaning of cpu usage graph in grafana HOT 2
- Storage Load N/A HOT 4
- Dockprom failing to build due to ssl version error HOT 2
- Angular Deprecation in Grafana HOT 7
- Host access Support?
- This panel requires Angular (deprecated) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dockprom.