I am trying to start collectd inside docker and i have tried everything from running command to start collectd in dockerfile to using a script to running service collectd start
to using supervisord but still not working
my supervisord.conf file is
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
user=root ;
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:collectd]
command=/usr/sbin/collectd -C /etc/collectd/collectd.conf -f
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
I also tried running it inside my Dockerfile
RUN service collectd start
By Dockerfile is using Ubuntu 16.04 and i installed collectd with apt-get install collectd
which beautifully installs collectd version 5.5.1 for me(which is what i want)
Anyways when i run container and do ps aux
i see
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.6 0.0 18180 2000 ? Ss 20:27 0:00 bash
root 11 0.0 0.0 34364 1544 ? R+ 20:27 0:00 ps aux
so basically collectd is still not running
and inside container i start it with service collectd start
and the it works fine
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 18180 2008 ? Ss 20:27 0:00 bash
root 27 0.0 0.0 4300 320 ? Ss 20:27 0:00 /usr/sbin/collectdmon -P /var/run/collectd.pid -- -C /etc/collectd
root 30 0.0 0.0 799820 2368 ? Sl 20:27 0:00 collectd -C /etc/collectd/collectd.conf -f
root 42 0.0 0.0 34364 1544 ? R+ 20:30 0:00 ps aux
So basically how do i get to run collectd automatically when docker image is ran?
P.S Even if i dont have to use supervisrod, fine i just want a way to have collectd running when i run the container
Thanks
UPDATE: Also a single collectd
command ran inside the container also starts collectd
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 18180 2020 ? Ss 21:09 0:00 bash
root 36 0.0 0.0 799820 1680 ? Ssl 21:10 0:00 collectd
root 47 0.0 0.0 34364 1544 ? R+ 21:10 0:00 ps aux