banner
Geek

Geek

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

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

Introduction#

When using something for too long, aesthetic fatigue will occur. Nezha Monitoring has been used for many years and has never let me down. It is easy to set up and the monitoring project is well-organized. The alarm notification is also easily configurable, making it very suitable for ordinary users. However, life is about exploring, and I like to constantly try new things.

CleanShot 2023-05-23 at 08.43.04@2x

I have been interested in the ServerStatus monitoring panel for a long time. It feels too simple and lacks a backend, which is not very user-friendly for beginners. Recently, I discovered the Rust version of ServerStatus cloud probe, which is an enhanced version of ServerStatus that maintains 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.

Pasted image 20230523084528

Setting up ServerStatus-Rust#

Quick deployment of 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 setting up your server, please replace ssr.rs with your own domain name. I use NginxProxyManager to reverse proxy the server IP and also enable 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, details can be found at https://doc.ssr.rs/vnstat

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

Specify the 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 with the following commands
systemctl enable stat_server
systemctl enable stat_client

# Stop
systemctl stop stat_server
systemctl stop stat_client

CleanShot 2023-05-23 at 10.07.32@2x


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}} The host is back online"
offline_tpl = " {{config.title}} \n😱 {{host.location}} {{host.name}} The host is offline"

# Leave Custom template empty 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 %}
"""
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.