swarm monitoring use node and internal ips for identiy
Imn hte grafana dashboards for swarm monitoring
This show:
is possible change to use node name or NODE ip?
Hello,
I have the same issue. maybe there is some tags available into the database ?
it takes me lot of hours to understand how prometheus works and how docker swarm create labels but here is working prometheus.yml config for this.
-
ensure we have access to swarm registry through socket, provide a volume to :
- "/var/run/docker.sock:/var/run/docker.sock:ro" -
add ruser root to be able to read sock file
user: root # to be able to read docker.sock
finally prometheus.yml file to provide with a volume :
- job_name: 'node-exporter'
dockerswarm_sd_configs:
- host: "unix:///var/run/docker.sock"
refresh_interval: 30s
role: tasks
relabel_configs:
# filter node-exporter containers
- source_labels: [__meta_dockerswarm_service_name]
regex: .*node-exporter.*
action: keep
# only keep active tasks
- source_labels: [__meta_dockerswarm_task_state]
regex: running
action: keep
# change port 80 to 9100
- source_labels: [__address__]
regex: '([^:]+):\d+'
replacement: '${1}:9100'
target_label: '__address__'
# set physical hostname into instance label
- source_labels: [__meta_dockerswarm_node_hostname]
target_label: instance
will try to propose a PR for this. Hope this helps