banner
Geek

Geek

🧠在家居士 | 🥦素食者 | 🏃🏻马拉松爱好者 | 📡AI降临派 | 过🪜技术资深学者 | 🤖科技狂 | 📤更新狂🆅 https://www.igeekbb.com/
twitter
github

I have replaced the Nezha monitoring system that I have been using for many years with ServerStatus-Rust.

Introduction:

When using something for too long, aesthetic fatigue may occur. Nezha Monitoring has been used for many years and has never failed. It is easy to set up and follows the standard in monitoring projects. The alarm notification is also well-configured, making it very suitable for ordinary users. However, life is about exploring, and I like to constantly try new things.

A long time ago, I was interested in the ServerStatus monitoring panel. It felt too simple, without a backend, and not very user-friendly for beginners. Recently, I discovered the Rust version of ServerStatus cloud probe, ServerStatus with enhanced power, maintaining lightweight and simple deployment. It also supports displaying ping values and packet loss rates for three networks. With this, I can also remove the deployed smokeping.

Setting up ServerStatus-Rust:

Quickly deploy the server:

mkdir -p /opt/ServerStatus && cd /opt/ServerStatus
wget --no-check-certificate -qO one-touch.sh ' https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/one-touch.sh '
bash -ex one-touch.sh

After deployment, open http://127.0.0.1:8080/ or http://:8080/

The server configuration file is located at /opt/ServerStatus/config.toml and can be modified as needed. Reference: https://doc.ssr.rs/rapid_deploy/

One-click deployment of the client:

After deploying your server, please replace ssr.rs with your domain name. I used NginxProxyManager to reverse proxy the server IP and also added SSL.

Different hosts can run the same command to register to the same group:

curl -sSLf "https://ssr.rs/i?pass=pp&gid=g1&alias=$ (hostname)" | bash

Install and enable vnstat, see details at https://doc.ssr.rs/vnstat:

curl -sSLf "https://ssr.rs/i?pass=pp&gid=g1&vnstat=1&alias=$ (hostname)" | bash

Specify month rotate as the 7th:

curl -sSLf "https://ssr.rs/i?pass=pp&gid=g1&vnstat=1&vnstat-mr=7&alias=$ (hostname)" | bash

Specify location & type (I usually use this):

curl -sSLf "https://ssr.rs/i?pass=pp&gid=g1&alias=$ (hostname)&type=arm&loc=home" | bash

Install and prioritize this VPS:

curl -sSLf "https://ssr.rs/i?pass=pp&gid=g1&weight=10000&alias=$ (hostname)" | bash

Customize ping address:

curl -sSLf "https://ssr.rs/i?pass=pp&gid=g1&alias=$ (hostname)&cm=cm.abc.com:80" | bash

Debug:

curl -sSLf "https://ssr.rs/i?pass=pp&gid=g1&vnstat=0&alias=$ (hostname)" > ssr-client-init.sh
bash -x ssr-client-init.sh

Common ServerStatus commands:

# Start
systemctl start stat_server
systemctl start stat_client

# Check status
systemctl status stat_server
systemctl status stat_client

# Enable auto-start on boot using the following commands
systemctl enable stat_server
systemctl enable stat_client

# Stop
systemctl stop stat_server
systemctl stop stat_client

Telegram alert notification: https://doc.ssr.rs/notification/

# https://core.telegram.org/bots/api
# https://jinja.palletsprojects.com/en/3.0.x/templates/#if
[tgbot]
# Switch, true to enable
Enabled = false
bot_token = "<tg bot token>"
chat_id = "<chat id>"
# Available fields for host can be found in payload.rs file HostStat structure, {{host.xxx}} is a placeholder variable
# For example, host.Name can be replaced with host.Alias. Customize the notification message according to your preferences
# {{ip_info.query}} host IP, {{sys_info.host_name}} host hostname
title = "❗<b>Server Status</b>"
online_tpl = "{{config.title}} \n😆 {{host.location}} {{host.name}} host is back online"
offline_tpl = "{{config.title}} \n😱 {{host.location}} {{host.name}} host is offline"

# Custom template can be left blank to disable custom alerts and only keep online/offline notifications
Custom_tpl = """
{% if host.Memory_used / host.Memory_total > 0.5 %}
<pre>😲 {{host.name}} host memory usage exceeds 50%, currently {{ (100 * host.memory_used / host.memory_total) | round }} %  </pre>
{% endif %}

{% if host.Hdd_used / host.Hdd_total > 0.5 %}
<pre>😲 {{host.name}} host disk usage exceeds 50%, currently {{ (100 * host.hdd_used / host.hdd_total) | round }} % </pre>
{% endif %}

Translation:

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.