When running a home server consisting of one or more nodes, with some or all services in Docker you may find yourself wanting to monitor your environment, or even better, have full observability.
The often written possibility for this is a combination of Prometheus with Grafana. A solution that requires a lot of work on setting things up fully, and requires work on ones applications and detailed setup for full visibility. Another possibility is to use the free tire of NewRelic that has the advantage of remote insights on metrics and logs but requires work on containers or applications to have a more refined visibility on your services.
Monitoring with Beszel
First and simple runner up to make this possible is Beszel. Beszel can be run as a local service or in docker and consists of a web frontend and and an agent that can be used on multiple systems and even supports Windows and MacOS. Installation is an easy job in docker and once it's running there is insightful information with system metrics and docker services and even some logs.
Observability with Coroot
My personal choice on monitoring a home server system is Coroot. In my current setup with a Rocky Linux 9.X system Coroot runs on a Clickhouse server to store metrics, logs, traces and profiles, the Coroot service, a node-agent and cluster-agent service.
The node agent automatically collects all metrics and logs of running (docker) services thru eBPF and the cluster agent is needed if one wants detailed information on database metrics like MongoDB, MySQL, Postgres or Redis. System services as Clickhouse discovered with the coroot-node-agent are visualized to with Coroot.
AI Root cause analyses
Another advantage one has with Coroot is the use of AI Root cause analyses that can provide helpful insights while investigating incidents. With a free Coroot Cloud account you have ten helpful analyses for free each month. Even without AI, the data presented with Coroot with standard alerts based on best practices on metrics is pretty insightful and helps to make your setup even better.
Run Clickhouse as a local service
Because of the control I want over Clickhouse it is running as a local service for better convenience. The control is because of scaling down memory usage of Clickhouse, scaling down logging on disk and the database, and more easy changes on the data and configuration. The only downside is updating Clickhouse manually with yum/dnf.The Coroot services run in docker thru a docker-compose file. In a normal setup Prometheus is required, in this setup Clickhouse is used as a supported alternative so one needs less resources.
Installing Clickhouse
Installing Clickhouse is easily done by adding the repo, installing Clickhouse, and making some adjustments before starting it, so it runs well in a smaller home lab before starting it up.
sudo dnf install -y yum-utils
sudo dnf-config-manager --add-repo https://packages.clickhouse.com/rpm/clickhouse.repo
sudo dnf install -y clickhouse-server clickhouse-client
Before staring the service create a file: /etc/clickhouse-server/config.d/z_log_disable.xml and put the following contend in the file:
<?xml version="1.0"?>
<clickhouse>
<asynchronous_metric_log remove="1"/>
<metric_log remove="1"/>
<latency_log remove="1"/>
<query_thread_log remove="1" />
<query_log remove="1" />
<query_views_log remove="1" />
<part_log remove="1"/>
<session_log remove="1"/>
<text_log remove="1" />
<trace_log remove="1"/>
<crash_log remove="1"/>
<opentelemetry_span_log remove="1"/>
<zookeeper_log remove="1"/>
</clickhouse>
<max_server_memory_usage_to_ram_ratio>0.5</max_server_memory_usage_to_ram_ratio>
<max_connections>512</max_connections
sudo systemctl deamon-reload
sudo systemctl enable clickhouse-server
sudo systemctl start clickhouse-server

Reacties
Een reactie posten