I have plenty of servers (>100), mostly centos, ubuntu and some windows servers, monitored with Zabbix. Many of those servers are virtualized with vanilla LXC version 2 or version 3 (no libvirt, no LXD, no proxmox or similar). I am new to this environment and it's difficult for me to understand which machine is virtualized and where it is hosted.
So, I need a way to identify the LXC host when connecting with ssh to any of those servers.
To identify if I am actually within a LXC container, I can use
systemd-detect-virt
on systems with systemd. The output is telling me if I am within a container or not.
But I need more. I need to have a way to identify on which host that LXC container is hosted. I know that LXC containers are supposed to be as close as possible to a physical machine and that it might be unnecessary to know about the host system. But I need to maintain this environment. In addition, other system admins are adding, moving (many of the hosts are clustered), deleting LXC containers.
Is there a way which allows me to find the actual host where an LXC container is running on, without having to move over to virtualization platforms like proxmox and the lot?
I am willing and able to edit LXC container's config files. Perhaps there is something like a tag that is later on visible within the LXC container itself?
Thanks for your help.
Dan