Monitoring Host and LXD Container


I would like to ask for some input here. My Setup is like this: Cloud_Instance with one LXD-Container. Inside the Container is my Applikation Stack (nginx,php,db, redis, elastic and stuff.).

I use telegraf for simple performance monitoring (cpu,disk,mem, procs etc.).

Now Im wondering if it makes sense to install the telegraf on both the host and the container? It seems redundant to me. I know that I can use lxc metrics for monitoring the container. But then there are other metrics that are more difficult to retrieve. For instance the systemd plugin? If I wanted to monitor systemd Id have to install telegraf inside the container, afaik. Furthermore I have a little bash-script that tells me how many packages need to be updated. I was think about the telegraf-exec plugin which runs my script. But it would need to run the script on the host and inside the container.

So whats the best approach of how to use telegraf in a (sort of) container environment?

Thanks for your input.

Hello @DCieD,
It just depends. If you want metrics from the host and the container you’re right you’ll have to run in both places. Luckily telegraf is a lightweight agent and its very common from people to run hundreds of agents close to their data sources.