Installing Stat Hub: Setting up a Self-Hosted Server Monitoring on Linux

Publish: 2017-06-05 | Modify: 2017-06-05

Stat Hub is a service that helps you collect and display the status of multiple servers. It consists of two parts: the server side, which receives, stores, and displays the status; and the client side, which collects and sends the status to the server. Stat Hub is not as powerful as Zabbix, so its deployment is much simpler.

Stat Hub

Installation

Just one command is needed for installation. Simply copy and paste the following command:

# Download and install using curl
curl --insecure https://raw.githubusercontent.com/likexian/stathub-go/master/setup.sh | sh

# If curl is not available, you can use wget
wget --no-check-certificate -O - https://raw.githubusercontent.com/likexian/stathub-go/master/setup.sh | sh

# Allow the port through iptables
iptables -I INPUT -p tcp --dport 15944 -j ACCEPT
service iptables save
service iptables restart

And that's it! The installation is complete. Access https://ip:15944 (note that it is an https address) to open the Stat Hub dashboard. The initial password is "likexian", which can be changed after logging in. Here is a screenshot of the dashboard:

Stat Hub Dashboard

Adding Multiple Clients

Click the "help" button in Stat Hub and follow the prompts to add multiple clients. Alternatively, you can access https://ip:15944 and follow the instructions to add clients. This way, you can monitor multiple servers. Stat Hub collects data every minute using crontab. If the data is not displayed, check if the cron job is added by running crontab -l.

Accessing via Domain Name (Nginx Reverse Proxy)

To access Stat Hub using a domain name, add the following rules to your nginx vhost configuration file and reload nginx:

server {
    listen 80;
    server_name your.domain.com; # Replace with your own domain name
    location / {
        proxy_pass https://127.0.0.1:15944;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Summary

Stat Hub does not have real-time notification functionality, so if a server goes down, you can only visually check the dashboard. It would be great if the author could add real-time notification, even if it's just email notifications. The RAM monitoring includes the cache portion, which may affect the accuracy of RAM monitoring, but it's not a big issue. Stat Hub may not be powerful, but it is really simple to use.

Project URL: Stat Hub


Comments