Bookmark

Run HostMon in Docker: A HomeLab Host Monitor and Dashboard

HostMon is a small web dashboard for monitoring hosts and services in a HomeLab. i12bretro tutorial 0706 describes real-time ping, Wake-on-LAN, an SSH client, and a link to Apache Guacamole; the application is written in JavaScript and uses SQLite.[11]

Youtube video player

The original tutorial video is available on YouTube.[16]

1. Install Docker on the Linux host

  1. Log into the Linux device.[11]
  2. Open a terminal and run:[11]
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# install prerequisites
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
# add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# install docker
sudo apt install docker-ce docker-compose containerd.io -y
# enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
# add the current user to the docker group
sudo usermod -aG docker $USER
# reauthenticate for the new group membership to take effect
su - $USER

After reauthenticating, check docker version/docker ps before starting HostMon.[11]

2. Create persistent storage and run HostMon

Follow this order so the new database is copied to the host before the temporary container is removed:[11]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# create working directories
mkdir ~/docker/hostmon -p
# set owner of working directories
sudo chown "$USER":"$USER" ~/docker -R
# create the hostmon docker container
docker create -ti --name hostmon i12bretro/hostmon
# export the hostmon database
docker cp hostmon:/app/data/hostmon.db ~/docker/hostmon/hostmon.db
# remove the temporary hostmon container
docker rm hostmon -f
# run hostmon with persistent database
docker run -d --name hostmon -v ~/docker/hostmon:/app/data -p 3000:3000 --restart=unless-stopped i12bretro/hostmon

docker cp leaves hostmon.db under ~/docker/hostmon, and the persistent volume is mounted at /app/data in the running container. I keep this step when I want the database to survive a recreate or update.[11]

3. Open the interface

  1. Open a browser at http://DNSorIP:3000.[11]
  2. Confirm HostMon loads and begin adding hosts/services.[11]
  3. Replace the placeholder with the Docker host's real DNS name or IP.[11]

Checks and limits

I confirm the container is Up, port 3000 is bound only where needed, and ~/docker/hostmon/hostmon.db has appropriate read/write permissions. WOL needs suitable broadcast/network behavior, SSH needs local credentials, and a Guacamole link needs the real endpoint; the tutorial does not automatically configure those systems. Do not expose an infrastructure dashboard to the Internet without authentication or a VPN.[11]

Original tutorial video: [watch it on YouTube]1.[16]

Source

Original source: [Running HostMon in Docker]2, published/updated 2022-03-23.[11]

Sources

[11] https://i12bretro.github.io/tutorials/0706.html — Running HostMon in Docker [16] https://www.youtube.com/watch?v=DvPxP8y65Qs — Running HostMon in Docker — i12bretro video


0 Bình luận

Góp Ý / Bình Luận / Đánh giá