Want to monitor your system and applications, Netdata is distributed, real-time performance and health monitoring for these. It is a highly-optimized monitoring agent you install on all your systems and containers.
I tried to use docker image to use netdata.
Install netdata docker image and run it It simply straightforward, just run docker command:
1 2 3 4 5 6 7 8 9 10 docker run -d --name=netdata \ -p 19999:19999 \ -v /etc/passwd:/host/etc/passwd:ro \ -v /etc/group:/host/etc/group:ro \ -v /proc:/host/proc:ro \ -v /sys:/host/sys:ro \ -v /etc/os-release:/host/etc/os-release:ro \ --cap-add SYS_PTRACE \ --security-opt apparmor=unconfined \ netdata/netdata
then go to your browser, http://yourip:19999 , you can see netdata works.
use docker compose yml file to run netdata service write a shell script to create a docker yml file under /srv 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #!/bin/bash #create netdata.yml mkdir -p /srv/netdata/ { echo "version: '3'" echo "services:" echo " netdata:" echo " image: netdata/netdata" echo " ports:" echo " - 19999:19999" echo " cap_add:" echo " - SYS_PTRACE" echo " security_opt:" echo " - apparmor:unconfined" echo " volumes:" echo " - /etc/passwd:/host/etc/passwd:ro" echo " - /etc/os-release:/host/etc/os-release:ro" echo " - /etc/group:/host/etc/group:ro" echo " - /proc:/host/proc:ro" echo " - /sys:/host/sys:ro" } > /srv/netdata/netdata.yml
run it, then go to /srv/netdata to check if it exists
at the same dir to create an autorun file, named netdata_auto
1 2 3 4 5 netdata_autorun=true if [ "$netdata_autorun" = true ]; then docker-compose -f /srv/netdata/netdata.yml -p netdata up -d fi
let me test
run shell script first
1 root@rpi-121:/home/pi/git_repo/cli/templates/services/netdata# ./netdata_yml.sh
go to /srv to verify it created the docker compose yml file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 root@rpi-121:/home/pi/git_repo/cli/templates/services/netdata# cat /srv/netdata/netdata.yml version: '3' services: netdata: image: netdata/netdata ports: - 19999:19999 cap_add: - SYS_PTRACE security_opt: - apparmor:unconfined volumes: - /etc/passwd:/host/etc/passwd:ro - /etc/os-release:/host/etc/os-release:ro - /etc/group:/host/etc/group:ro - /proc:/host/proc:ro - /sys:/host/sys:ro
then run docker-compose
1 2 3 4 5 6 7 8 9 10 11 12 13 14 root@rpi-121:/home/pi/git_repo/cli/templates/services/netdata# docker-compose -f /srv/netdata/netdata.yml -p netdata up -d Creating network "netdata_default" with the default driver Pulling netdata (netdata/netdata:)... latest: Pulling from netdata/netdata 2aa204966f9a: Pull complete 8dde373fbef5: Pull complete 042f66a41d56: Pull complete 3526782612f0: Pull complete c2b930d703fa: Pull complete 9b859bae4175: Pull complete f3e46298693e: Pull complete Digest: sha256:b49e1901fd8aae43d950c171c14449b5080a5550faa97594e2d4ccee7ed3aac8 Status: Downloaded newer image for netdata/netdata:latest Creating netdata_netdata_1 ... done
check if the docker image is pulled and run
1 2 3 root@rpi-121:/home/pi/git_repo/cli/templates/services/netdata# docker images REPOSITORY TAG IMAGE ID CREATED SIZE netdata/netdata latest d170142fbe20 19 hours ago 249MB
it worked well
go to browser http://myip:19999