3

I started a server instance in a docker container, connected with Facette frontend, looks cool, facette reads the rrd data.

The problem begins when I want to receive data from other computer. I tried locally, exposed port from docker to local machine.

version: '2.1'
services:
collectd:
    build: ./containers/collectd
    ports:
        - 28596:28596
        - 8125:8125
    volumes:
        - ./var/rrd/:/var/lib/collectd/rrd

frontend:
    build: ./containers/facette
    ports:
        - 12003:12003
    volumes:
        - ./var/rrd:/var/lib/collectd/rrd
        - ./var/facette:/var/lib/facette/

Server's Dockerfile:

FROM alpine:latest
ENV ARCH=x86

RUN apk --update add perl-dev python3-dev wget alpine-sdk linux-headers rsyslog rrdtool rrdtool-dev rrdtool-utils

# Get and untar sources files
RUN wget https://collectd.org/files/collectd-5.7.1.tar.bz2
RUN tar jxvf collectd-5.7.1.tar.bz2 && rm collectd-5.7.1.tar.bz2

# Compile and purge source files
RUN cd collectd-5.7.1 && ./configure --with-rrdtool && make all install
RUN cd .. && rm -rf collectd-5.7.1

# Optionnal post installation tasks
RUN ln -s /opt/collectd/sbin/collectd /usr/sbin/collectd
RUN ln -s /opt/collectd/sbin/collectdmon /usr/sbin/collectdmon

RUN rm -rf /var/cache/apk/*
RUN apk del alpine-sdk linux-headers perl-dev python3-dev

#RUN apk add --update collectd rrdtool rsyslog collectd-dns collectd-curl collectd-sensors collectd-ping collectd-utils collectd-nginx collectd-iptables collectd-bind collectd-write_http collectd-rrdtool collectd-network collectd-disk collectd-libs
ADD ./etc/* /etc/ 
ADD ./entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

Server's collectd.conf

Hostname "bakunin-tower"
FQDNLookup true
LoadPlugin syslog

<plugin syslog>
    LogLevel info
    File "/var/log/collectd.log"
    Timestamp true
</plugin>

LoadPlugin cpu
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin network
LoadPlugin nfs
LoadPlugin rrdtool
LoadPlugin swap

<plugin network>
  Listen "0.0.0.0" "28596"
</plugin>

<plugin rrdtool>
  DataDir "/var/lib/collectd/rrd"
</plugin>

#Include "/etc/collectd.d/*.conf"

Client's collectd.conf

Hostname "kropotkin"
FQDNLookup true
LoadPlugin syslog

LoadPlugin "logfile"
<Plugin "logfile">
    LogLevel "info"
    File "/var/log/collectd.log"
    Timestamp true
</Plugin>

<plugin syslog>
    LogLevel info
</plugin>

LoadPlugin cpu
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin network

<Plugin network>
  Server "127.0.0.1" "28596"
</Plugin>

On the server I see only "bakunin-tower" in the rrd directory, but I expect kropotkin to also be present. What's wrong? My head is exploding.

Thanks.

1 Answers1

0

I digged multiple days and didn't see the solution. Then an idea come to my head - what about trying the same config outside of the Docker? I tried and it works, then I corrected my docker-compose.yml configuration to:

version: '2.1'
services:
    collectd:
        build: ./containers/collectd
        ports:
            - 25826:25826
            - 8125:8125
        volumes:
            - ./var/rrd/:/var/lib/collectd/rrd
        network_mode: host

    frontend:
        build: ./containers/facette
        ports:
            - 12003:12003
        volumes:
            - ./var/rrd:/var/lib/collectd/rrd
            - ./var/facette:/var/lib/facette/