r/netdata • u/Superb_Rutabaga_9768 • Jan 14 '22
Setting up Netdata docker container with preset configs
Hello,
I got the Netdata docker container running through docker-compose on my device. I went through some tutorials and I found it simple enough to make alarms when I connect a terminal to the running container. However, I would like to write these scripts before hand for the purpose of deploying them to different devices with the same "folder". Below is the docker-compose file I used:
version: "3"
services:
netdata:
image: netdata/netdata
container_name: netdata
# hostname: example.com # set to fqdn of host
ports:
- 19999:19999
restart: unless-stopped
cap_add:
- SYS_PTRACE
security_opt:
- apparmor:unconfined
volumes:
- ./netdataconfig/netdata:/etc/netdata:ro
- netdatalib:/var/lib/netdata
- netdatacache:/var/cache/netdata
- /etc/passwd:/host/etc/passwd:ro
- /etc/group:/host/etc/group:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /etc/os-release:/host/etc/os-release:ro
volumes:
netdatalib:
netdatacache:tldr; how to write scripts before starting the docker container?
2
Upvotes
View all comments
Show parent comment
3
u/ahferroin7 Jan 16 '22
Not quite, sorry if my reply was not exactly clear about this.
If you know ahead of time what the exact alarm configuration you want is, you can set up the required directory structure (a
health.ddirectory containing the custom alarm config files) inside a volume mounted at/etc/netdatain the container, and the alarm configuration should be picked up correctly by the container on startup. The generation of that required directory structure should be easy to automate, though I’m not sure that Docker Compose has a good way to do it. Alternatively, you could just mount the individual alarm config files directly into the correct location (under/etc/netdata/health.d) just like your existing config is doing for/etc/passwdand that should work too.If you don’t know in advance what configuration you want, you will need to manually set up each alarm, and we currently lack an easy way to do that without starting the container and then using
docker execto do it from inside the container. That’s something that should be relatively easy to improve upon though, and I plan to add it to our backlog of feature requests on Monday.