bvis / docker-node-exporter

Node exporter that can expose the host hostname if an specific file is mounted in the container
20 stars 10 forks source link

Still only seeing node-exporters internal IP instead of the hostname in Prometheus #4

Open jaschaio opened 6 years ago

jaschaio commented 6 years ago

Not sure what I am doing wrong or if I have to do something specifically to get the hostname within Prometheus.

Stack File:

version: "3.5"

services:
    node-exporter:
        image: basi/node-exporter
        networks:
            - monitor
        environment:
            - HOST_HOSTNAME=/etc/host_hostname
        volumes:
            - /proc:/host/proc
            - /sys:/host/sys
            - /:/rootfs
            - /etc/hostname:/etc/host_hostname
        deploy:
            mode: global
            labels:
                - com.df.notify=true
                - com.df.scrapePort=9100
                - com.df.alertName.1=mem_load
                - com.df.alertIf.1=@node_mem_limit:0.8
                - com.df.alertFor.1=30s
                - com.df.alertName.2=diskload
                - com.df.alertIf.2=@node_fs_limit:0.8
                - com.df.alertFor.2=30s
            resources:
                reservations:
                    memory: 20M
                limits:
                    memory: 50M
        command: '--path.procfs="/host/proc" --path.sysfs="/host/sys" --collector.filesystem.ignored-mount-points="^/(sys|proc|dev|host|etc)($$|/)" --collector.textfile.directory="/etc/node-exporter/" --collector.conntrack --collector.diskstats --collector.entropy --collector.filefd --collector.filesystem --collector.loadavg --collector.mdadm --collector.meminfo --collector.netdev --collector.netstat --collector.stat --collector.textfile --collector.time --collector.vmstat --collector.ipvs'

networks:
    monitor:
        external: true
    proxy:
        external: true

Discovered Labels:

__address__="10.0.1.14:9100"  __meta_dns_name="tasks.exporter_node-exporter"  __metrics_path__="/metrics" __scheme__="http"  job="exporter_node-exporter"
saiharshitachava commented 5 years ago

I'm also seeing the same issue..did anyone figure out if we have a way to get host names in prometheus metrics?