Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 01-11-2019, 10:18 AM   #1
Registered: Jun 2003
Location: Phoenix, AZ
Posts: 112

Rep: Reputation: 17
Using web monitor within LXC to monitor core server?

Is there a way to expose the core server to an LXC container for a system monitor? I want to be able to have Nginx inside of a container, but use ezservermonitor (web based real-time monitor) to see the main system stats and not the container it's running in.

I'm trying to prevent installing Nginx on the server and use LXC as much as possible, but I don't think LXC can do this since it's kind of like a VM.

I haven't used Docker much, but I've seen netdata docker image so do I need to use Docker Nginx/PHP and that would allow me to use ezservermonitor to see the core system?

I'd like to stick to LXC if can, but will do Docker if can't.
Old 01-12-2019, 04:54 AM   #2
LQ Newbie
Registered: Jan 2019
Posts: 1

Rep: Reputation: Disabled
You can have netdata monitor the host, while running inside an lxc container.

To do this, create the directories /host, /host/proc, /host/sys, /host/dev inside the container and use lxc configuration to mount /proc /sys /dev from the host to the container.
This is usually done with lxc configs like this:

lxc.mount.entry = /path/in/host/mount_point mount_point_in_container none bind 0 0
So, something like these is needed:

lxc.mount.entry = /proc host/proc none bind 0 0
lxc.mount.entry = /sys host/sys none bind 0 0
lxc.mount.entry = /dev host/dev none bind 0 0

Check the lxc docs for correct usage of this and additional information.

Then, in netdata.conf inside the container, set:

   host access prefix = /host
And restart netdata inside the container.
Now netdata should monitor the host.

Keep in mind that certain data collection features of netdata many not work as expected when running netdata inside a container, since netdata does not have full visibility of the host system. If you want to get the full of it, install netdata at the host (this is also the suggested way). netdata has binary packages that install it in /opt/netdata to avoid installing from source.
Old 01-12-2019, 10:05 AM   #3
Registered: Jun 2003
Location: Phoenix, AZ
Posts: 112

Original Poster
Rep: Reputation: 17
Thanks a lot. Was able to get ezservermonitor to pull up the core server stats using your examples for netdata.
Old 08-21-2019, 04:20 PM   #4
LQ Newbie
Registered: Aug 2019
Posts: 2

Rep: Reputation: Disabled
Monitor Proxmox Host with ezservermonitor in LXC

Create Ubuntu 18.04 LXC with YOUR_IP_ADDR
sudo nano /etc/pve/lxc/10x.conf
mp0: /proc,mp=/host/proc
mp1: /sys,mp=/host/sys
mp2: /dev,mp=/host/dev
mp3: /mnt/Share/Drive1,mp=/mnt/Drive1,size=800G
mp4: /mnt/Share/Drive2,mp=/mnt/Drive2

install lighttpd web server
sudo -i
apt update && apt upgrade
apt install lighttpd -y
systemctl enable lighttpd
systemctl start lighttpd

install PHP
visit http://YOUR_IP_ADDR -> if all goes well see placeholder page
apt install -y php7.2 php7.2-fpm php7.2-mysql php7.2-cli php7.2-curl php7.2-xml

nano /etc/php/7.2/fpm/php.ini
uncomment cgi.fix_pathinfo=1

nano /etc/php/7.2/fpm/pool.d/www.conf
Change listen = /run/php/php7.2-fpm.sock to listen =
systemctl restart php7.2-fpm

nano /etc/lighttpd/conf-available/15-fastcgi-php.conf
FROM: "bin-path" => "/usr/bin/php-cgi", TO "host" => "",
FROM: "socket" => "/var/run/lighttpd/php.socket", TO: "port" => "9000",

apt install cpanminus
lighty-enable-mod fastcgi
lighty-enable-mod fastcgi-php
systemctl restart lighttpd

nano /var/www/html/index.php
<?php phpinfo(); ?>

chown -R www-data:www-data /var/www/html/
systemctl restart lighttpd
systemctl restart php7.2-fpm

visit http://YOUR_IP_ADDR -> if all goes well see PHP info page

download and unzip ezservermonitor
apt install curl
apt install unzip
apt install net-tools
curl -L h_t_t_p_s:// -o
cp -R eZServerMonitor-2.5 /var/www/html/

visit: http://YOUR_IP_ADDR/eZServerMonitor-2.5/ -> if all goes well will see eZServerMonitor page

Modify eZServerMonitor to show Proxmox host info, not LXC info
config: nano /var/www/html/eZServerMonitor-2.5/conf/esm.config.json => "auto_refresh": 60, "theme": "dark",
Misc.php: nano /var/www/html/eZServerMonitor-2.5/libs/Utils/Misc.php /proc/cpuinfo => /host/proc/cpuinfo
cpu.php: nano /var/www/html/eZServerMonitor-2.5/libs/cpu.php /proc/cpuinfo => /host/proc/cpuinfo
memory.php: nano /var/www/html/eZServerMonitor-2.5/libs/memory.php /proc/meminfo => /host/proc/meminfo
swap.php: nano /var/www/html/eZServerMonitor-2.5/libs/swap.php /proc/meminfo => /host/proc/meminfo
disk.php: OK as-is
load_average.php: nano /var/www/html/eZServerMonitor-2.5/libs/load_average.php /proc/loadavg => /host/proc/loadavg
services.php: OK as-is
network.php: OK as-is
system.php: nano /var/www/html/eZServerMonitor-2.5/libs/system.php /proc/uptime => /host/proc/uptime

nano /var/www/html/eZServerMonitor-2.5/index.php
<td>Hostname</td> => <td>LXC Hostname</td>
<td>OS</td> => <td>LXC OS</td>



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Garbled fonts in firefox when started from within LXC crts Slackware 3 06-21-2018 09:24 AM
monitor disk usage on lxc containers on host level vincix Linux - Containers 9 03-22-2018 08:48 AM
question: 'onclick' within 'onmouseover' within 'form' within 'table' - how is it possible? rblampain Programming 4 04-25-2017 09:49 PM
[SOLVED] "lxc list" vs "lxc-ls" yknivag Linux - Virtualization and Cloud 1 03-09-2017 06:53 AM
How to end a Linux Container (LXC) from within? Skaperen Linux - Virtualization and Cloud 0 06-14-2011 10:37 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:04 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration