# Install Netdata on balena device (Raspberry pi 3); Issues & alternatives

**URL:** <https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634>\
**Category:** balenaOS\
**Created:** [November 7, 2019, 10:26am UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634 "2019-11-07T10:26:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![odyslam](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/odyslam/32/1684_2.png) [@odyslam](https://forums.balena.io/u/odyslam)\
**Post date:** [November 7, 2019, 10:26am UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/1 "2019-11-07T10:26:11Z")

</div>

Hey everyone,

I have been fiddling with balena for quite some time, trying to figure out it’s boundaries, the first being a multi-tenancy scheme leveraging balena as the orchestrating platform, as described in this [forum post](https://forums.balena.io/t/edgex-balena-walkthrough-tutorial/6584/8).

My latest endeavour has been installing an amazingly good monitoring system, [netdata](https://github.com/netdata/netdata) in balena, as illustrated in these posts:

> [@Modify the BalenaOS image to add packages](https://forums.balena.io/t/modify-the-balenaos-image-to-add-packages/25306/18):
>
> Hey everyone! In this post in [balena forum](https://forums.balena.io/t/edge-device-e-g-raspberry-pi-monitoring-based-on-telegraf-influxdb-and-grafana/4378/11), we are inquiring whether it’s possible to run [netdata](https://github.com/netdata/netdata) in a balena container, since it needs certain bind mounts to function properly. Any input is more than welcome @nghiant2710, @dansku Thanks everyone!

> [@Edge device (e.g. raspberry pi) monitoring based on Telegraf, Influxdb and Grafana](https://forums.balena.io/t/edge-device-e-g-raspberry-pi-monitoring-based-on-telegraf-influxdb-and-grafana/4378/14):
>
> Hey Zvin, As soon as I have access to devices, I will be testing it myself (Thursday Morning). I though privileged was a balena flag and wasn’t aware of it’s existence in the docker. Maybe use a custom app which uses dbus to serve as a pipe towards the needed files? (just throwing ideas, not sure even if it’s feasible). thanks!

I created a new forum post so we can aggregate all ideas and suggestions into a nice post for future reference.

The problem is that netdata needs special mounts to get the full picture of the host:

```auto
...
security_opt:
      - apparmor:unconfined
    volumes:
      - /etc/passwd:/host/etc/passwd:ro
      - /etc/group:/host/etc/group:ro
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
...

```

I installed netdata without those mounts to get better view of what it is able to do. There are tons of metrics and system-wide overview, but we don’t have the range and detail one would want in a production critical device.

Any ideas how to proceed?

I have thought about using a modified version of balenaOS, where the mounts would be mounted using _labels_, as it is currently possible with `firmware` and `kernel`.

Another possible approach could be monkey patching something with developer-os and sshing into host (unlikely to have the performance needed to get 1 metric/s) or using dbus (not sure how it works though).

Thank you for your time, can’t wait to hear your thoughts and ideas!

---

<div class="post-metadata">

**Author:** ![telphan](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@telphan](https://forums.balena.io/u/telphan)\
**Post date:** [November 7, 2019, 11:23am UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/2 "2019-11-07T11:23:32Z")

</div>

Are these :

```auto
      - /etc/passwd:/host/etc/passwd:ro
      - /etc/group:/host/etc/group:ro
      - /proc:/host/proc:ro
      - /sys:/host/sys

```

all the mount netdata needs, or will there be others?

---

<div class="post-metadata">

**Author:** ![odyslam](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/odyslam/32/1684_2.png) [@odyslam](https://forums.balena.io/u/odyslam)\
**Post date:** [November 7, 2019, 11:29am UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/3 "2019-11-07T11:29:50Z")

</div>

hey @telphan,

According to their docker installation [manual](https://github.com/netdata/netdata/tree/19168464247f83c0678fe9aa5275f5fdebd5663a/packaging/docker), this is the entire docker-compose:

```auto
version: '3'
services:
  netdata:
    image: netdata/netdata
    hostname: example.com # set to fqdn of host
    ports:
      - 19999:19999
    cap_add:
      - SYS_PTRACE
    security_opt:
      - apparmor:unconfined
    volumes:
      - /etc/passwd:/host/etc/passwd:ro
      - /etc/group:/host/etc/group:ro
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro

```

Moreover, netdata needs docker-socket (or a [docker-socket proxy](https://github.com/netdata/netdata/tree/19168464247f83c0678fe9aa5275f5fdebd5663a/packaging/docker#docker-socket-proxy-safest-option)) to resolve container names, I suspect that it is possible to re-configure the docker socket directory in netdata to point to balena-engine socket.

---

<div class="post-metadata">

**Author:** ![odyslam](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/odyslam/32/1684_2.png) [@odyslam](https://forums.balena.io/u/odyslam)\
**Post date:** [November 8, 2019, 9:52pm UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/14 "2019-11-08T21:52:16Z")

</div>

Hey everyone (or just me?),

From a little research that I did, enabling custom volumes is (propably) possible through the balena supervisor.

For example, from the `utils.ts` in [Github](https://github.com/balena-io/balena-supervisor/blob/b9800ae3d99e40dec0cdf824d6274bd15ba92614/src/compose/utils.ts) we see the function call `service.config.volumes.push('/run/dbus:/host/run/dbus');` loads the appropriate volume.

1. Is it safe to presume that using a custom version of the supervisor will be able to load an arbitrary number of volumes, including the ones we need to run netdata?

2. If so, a demo would be possible to be constructed following the commands in the [README.md](https://github.com/balena-io/balena-supervisor) of the supervisor?

As always, thanks for your time!

cheers 🙂

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [November 9, 2019, 5:34pm UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/17 "2019-11-09T17:34:40Z")

</div>

Hi there @odyslam,

Thanks for asking about netdata! As you may have already surmised from me adding balena to the netdata known apps, proper support for netdata specifically is something we are actively working on. I have committed a few things upstream to make this easier, and I am resurrecting a brief demo `docker-compose.yml` for running netdata on-device.

With that said, you are certainly able to modify the supervisor if you like, but that will obviously make it harder to maintain and support. The limitations for mounts come from the supervisor itself (as you have already discovered), not necessarily balenaEngine. As such, you can also launch a fully-featured netdata daemon directly from the host OS shell, though again there are limitations to that approach in that the container lifecycle will suffer due to no supervisor management.

---

<div class="post-metadata">

**Author:** ![odyslam](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/odyslam/32/1684_2.png) [@odyslam](https://forums.balena.io/u/odyslam)\
**Post date:** [November 9, 2019, 6:11pm UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/18 "2019-11-09T18:11:10Z")

</div>

Hey @xginn8,

If you need help, I would love to aid in any way with the integration!

A couple of questions though:

1. Why run netdata from hostOS if you can launch a user application container with augmented rights that will load all the necessary volumes?
2. How one can install netdata directly into the hostOS?
3. Have you personally tried the other monitoring solutions that balena has blogged about (datadog, prometheus). The absence of special container privileges (like access to volumes) from their part is due to the fact that they gather fewer metrics and offer a limited view of the system or is it because they are integrated into balena with a different way?

In any case, I suspect that there is an official strategy since you are already investigating it.

I am interested more into working towards a production proper integration of the platforms (i.e proper support of netdata) rather than locally monkey-patching a supervisor and running netdata.

Thank you so much for your time, it is very much appreciated.

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [November 15, 2019, 2:21am UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/22 "2019-11-15T02:21:03Z")

</div>

Hi again @odyslam,

Thanks for your offer! I will answer each question inline:

> 1. Why run netdata from hostOS if you can launch a user application container with augmented rights that will load all the necessary volumes?

I didn’t mean to imply that you _should_ be running netdata in this way, just that it’s possible to work around the self-imposed limitations in the supervisor by launching your service outside of the supervisor. To be clear, that’s very much a hacky solution and why we are working towards native netdata support! If you like, `privileged: true` will get you quite far with accessing host OS data.

> 1. How one can install netdata directly into the hostOS?

If you are so inclined you can build a custom OS, but I think it’s a good bit easier to simply launch a container from the host OS with all the goodies you need.

> 1. Have you personally tried the other monitoring solutions that balena has blogged about (datadog, prometheus). The absence of special container privileges (like access to volumes) from their part is due to the fact that they gather fewer metrics and offer a limited view of the system or is it because they are integrated into balena with a different way?

I have tried some of them (I authored this post earlier this year, using Prometheus: [Monitoring the edge with Prometheus pt. 1](https://www.balena.io/blog/monitoring-the-edge-with-prometheus-pt-1/)). I have not tried Datadog specifically. These monitoring systems are subject to the same limitations as netdata, since primarily they use the same filesystem (`/proc` and `/sys` from the host OS). They are also using `privileged: true` to access the host OS in a more complete fashion (see [https://github.com/balena-io-playground/balena-datadog/blob/master/docker-compose.yml#L10](https://github.com/balena-io-playground/balena-datadog/blob/master/docker-compose.yml#L10)).

---

<div class="post-metadata">

**Author:** ![ibex](https://avatars.discourse-cdn.com/v4/letter/i/ecc23a/32.png) [@ibex](https://forums.balena.io/u/ibex)\
**Post date:** [February 26, 2020, 10:03pm UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/25 "2020-02-26T22:03:23Z")

</div>

Hi @xginn8

Any update on netdata becoming an addition of known apps/proper support from balena? I’m about to embark on something similar to @odyslam but quite new to everything. I’ll still be giving it a go nonetheless!

---

<div class="post-metadata">

**Author:** ![shaunmulligan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan/32/34_2.png) [@shaunmulligan](https://forums.balena.io/u/shaunmulligan)\
**Post date:** [February 27, 2020, 12:15pm UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/30 "2020-02-27T12:15:16Z")

</div>

Hi @ibex unfortunately there isn’t an ETA as of yet as we have had to refocus our efforts on other projects for the time being. The one thing that I would mention is that in supervisor [10.8.0](https://github.com/balena-io/balena-supervisor/blob/master/CHANGELOG.md#v1080), its now possible to specify a label to enable mounting of /proc into your netdata container, which should provide for much better metrics if memory serves.

---

<div class="post-metadata">

**Author:** ![lucianbuzzo](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/lucianbuzzo/32/615_2.png) [@lucianbuzzo](https://forums.balena.io/u/lucianbuzzo)\
**Post date:** [May 14, 2020, 10:55am UTC](https://forums.balena.io/t/install-netdata-on-balena-device-raspberry-pi-3-issues-alternatives/42634/32 "2020-05-14T10:55:41Z")

</div>

sync
