Change Node-Name when agent is running via docker



  • hi there,

    this new cloud looks very interesting and i already tested my first node, i used the docker agent,
    but - i am not surprised - the hostname is NOT the host itself, the hostname of the docker container is used…
    i also tried the param “-host” as explained here: https://learn.netdata.cloud/docs/agent/claim/#claiming-script
    but still i only see the docker-containers-hostname. how can i change that ?

    alt text

    thanks !
    micha


  • Staff

    As an alternative to the Docker hostname thing mentioned by Zack, you can manually override the hostname that Netdata reports in the netdata.conf file by adding a hostname key under the [global] section. This obviously doesn’t scale well if you have a lot of nodes, but if you’ve only got one or two it can be a much easier solution than trying to get Docker to give all the containers sane hostnames.



  • You may have to create networks and assign hostnames for containers within those networks using docker network create and following up with docker run -h human_readable_hostname --ip [an ip on the network] --net [the network created]. These commands will have some additional options based on what exactly you are trying to run…

    It might be easier to use docker-compose for something like that. In any case I think the trick is to set a readable hostname for the container.

    We also have a lengthy docker guide but I don’t think it covers this specific question.


  • Staff

    As an alternative to the Docker hostname thing mentioned by Zack, you can manually override the hostname that Netdata reports in the netdata.conf file by adding a hostname key under the [global] section. This obviously doesn’t scale well if you have a lot of nodes, but if you’ve only got one or two it can be a much easier solution than trying to get Docker to give all the containers sane hostnames.


Log in to reply