version beta 1.0.2

pull/110/head
windows11 2021-10-09 22:07:07 +08:00
parent c98dc92256
commit a0842a020b
3 changed files with 34 additions and 60 deletions

View File

@ -6,6 +6,7 @@
[![Python Support](https://img.shields.io/badge/python-2.7%2B%20-blue.svg)](https://github.com/cppla/ServerStatus) [![Python Support](https://img.shields.io/badge/python-2.7%2B%20-blue.svg)](https://github.com/cppla/ServerStatus)
[![C++ Compiler](http://img.shields.io/badge/C++-GNU-blue.svg?style=flat&logo=cplusplus)](https://github.com/cppla/ServerStatus) [![C++ Compiler](http://img.shields.io/badge/C++-GNU-blue.svg?style=flat&logo=cplusplus)](https://github.com/cppla/ServerStatus)
[![License](https://img.shields.io/badge/license-MIT-4EB1BA.svg?style=flat-square)](https://github.com/cppla/ServerStatus) [![License](https://img.shields.io/badge/license-MIT-4EB1BA.svg?style=flat-square)](https://github.com/cppla/ServerStatus)
[![Version](https://img.shields.io/badge/Version-Beta%201.0.2-red)](https://github.com/cppla/ServerStatus)
![Latest Version](http://dl.cpp.la/Archive/serverstatus.png) ![Latest Version](http://dl.cpp.la/Archive/serverstatus.png)
@ -34,10 +35,10 @@ docker run -d --restart=always --name=serverstatus -v ~/config.json:/ServerStatu
【客户端】: 【客户端】:
```bash ```bash
wget --no-check-certificate -qO client-linux.py 'https://raw.githubusercontent.com/cppla/ServerStatus/master/clients/client-linux.py' && nohup python client-linux.py SERVER={$SERVER} USER={$USER} PASSWORD={$PASSWORD} >/dev/null 2>&1 & wget --no-check-certificate -qO client-linux.py 'https://raw.githubusercontent.com/cppla/ServerStatus/master/clients/client-linux.py' && nohup python3 client-linux.py SERVER={$SERVER} USER={$USER} PASSWORD={$PASSWORD} >/dev/null 2>&1 &
eg: eg:
wget --no-check-certificate -qO client-linux.py 'https://raw.githubusercontent.com/cppla/ServerStatus/master/clients/client-linux.py' && nohup python client-linux.py SERVER=45.79.67.132 USER=s04 >/dev/null 2>&1 & wget --no-check-certificate -qO client-linux.py 'https://raw.githubusercontent.com/cppla/ServerStatus/master/clients/client-linux.py' && nohup python3 client-linux.py SERVER=45.79.67.132 USER=s04 >/dev/null 2>&1 &
``` ```
# 手动安装教程: # 手动安装教程:
@ -47,7 +48,7 @@ wget --no-check-certificate -qO client-linux.py 'https://raw.githubusercontent.c
git clone https://github.com/cppla/ServerStatus.git git clone https://github.com/cppla/ServerStatus.git
``` ```
【服务端配置】服务端程序在ServerStatus/web下: 【服务端配置】:
一、生成服务端程序 一、生成服务端程序
``` ```
@ -64,11 +65,12 @@ make
[ [
{ {
"username": "s01", "username": "s01",
"name": "Mainserver 1", "name": "vps-1",
"type": "Dedicated Server", "type": "kvm",
"host": "GenericServerHost123", "host": "chengdu",
"location": "Austria", "location": "🇨🇳",
"password": "some-hard-to-guess-copy-paste-password" "password": "USER_DEFAULT_PASSWORD",
"monthstart": 1
}, },
] ]
} }
@ -86,44 +88,36 @@ web-dir参数为上一步设置的网站根目录务必修改成自己网站
./sergate --config=config.json --web-dir=/home/wwwroot/default ./sergate --config=config.json --web-dir=/home/wwwroot/default
``` ```
【客户端配置】客户端程序在ServerStatus/clients下 【客户端配置】:
客户端有两个版本client-linux为普通linuxclient-psutil为跨平台版普通版不成功换成跨平台版即可。 客户端有两个版本client-linux为普通linuxclient-psutil为跨平台版普通版不成功换成跨平台版即可。
一、client-linux版配置 一、client-linux版配置
1、vim client-linux.py, 修改SERVER地址username帐号 password密码 1、vim client-linux.py, 修改SERVER地址username帐号 password密码
2、python client-linux.py 运行即可。 2、python3 client-linux.py 运行即可。
二、client-psutil版配置: 二、client-psutil版配置:
1、安装psutil跨平台依赖库 1、安装psutil跨平台依赖库
2、vim client-psutil.py, 修改SERVER地址username帐号 password密码 2、vim client-psutil.py, 修改SERVER地址username帐号 password密码
3、python client-psutil.py 运行即可。 3、python3 client-psutil.py 运行即可。
``` ```
### for Centos ### for Centos
sudo yum -y install epel-release sudo yum -y install epel-release
sudo yum -y install python-pip sudo yum -y install python3-pip
sudo yum clean all sudo yum clean all
sudo yum -y install gcc sudo yum -y install gcc
sudo yum -y install python-devel sudo yum -y install python3-devel
sudo pip install psutil sudo pip3 install psutil
### for Ubuntu/Debian: ### for Ubuntu/Debian:
sudo root sudo apt -y install python3-pip
apt-get -y install python-setuptools python-dev build-essential sudo pip3 install psutil
apt-get -y install python-pip
pip install psutil
### for Windows: ### for Windows:
打开网址https://pypi.python.org/pypi?:action=display&name=psutil#downloads 地址https://pypi.org/project/psutil/
下载psutil for windows程序包 下载psutil for windows, 安装即可
安装即可
``` ```
打开云探针页面,就可以正常的监控。接下来把服务器和客户端脚本自行加入开机启动,或者进程守护,或以后台方式运行即可!例如: nohup python client-linux.py & 打开云探针页面,就可以正常的监控。接下来把服务器和客户端脚本自行加入开机启动,或者进程守护,或以后台方式运行即可!例如: nohup python3 client-linux.py &
### 如何快速跟随系统启动呢?其实好多人都搞复杂化了
1、chmod 755 /root/client-linux.py
2、vim /etc/crontab尾部追加
```diff
@reboot root /root/client-linux.py SERVER=$server USER=$user
```
# 为什么会有ServerStatus中文版 # 为什么会有ServerStatus中文版

View File

@ -1,9 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# coding: utf-8 # coding: utf-8
# Update by : https://github.com/cppla/ServerStatus # Update by : https://github.com/cppla/ServerStatus, Update date: 20211009
# 支持Python版本2.7 to 3.9 # 版本1.0.2, 支持Python版本2.7 to 3.9
# 支持操作系统: Linux, OSX, FreeBSD, OpenBSD and NetBSD, both 32-bit and 64-bit architectures # 支持操作系统: Linux, OSX, FreeBSD, OpenBSD and NetBSD, both 32-bit and 64-bit architectures
# 时间: 20211009
# 说明: 默认情况下修改server和user就可以了。丢包率监测方向可以自定义例如CU = "www.facebook.com"。 # 说明: 默认情况下修改server和user就可以了。丢包率监测方向可以自定义例如CU = "www.facebook.com"。
SERVER = "127.0.0.1" SERVER = "127.0.0.1"

View File

@ -1,25 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python3
# coding: utf-8 # coding: utf-8
# Update by : https://github.com/cppla/ServerStatus # Update by : https://github.com/cppla/ServerStatus, Update date: 20211009
# 支持Python版本2.7 to 3.8; requirements.txt: requests, PrettyTable # 支持Python版本2.7 to 3.9; requirements.txt: requests, PrettyTable
# 时间: 20210714 主要是为了受到CC attack时候方便查看机器状态 && 程序在非gui环境下目前有闪屏的bug # 主要是为了受到CC attack时候方便查看机器状态
"""
ServerStatus in console or shell, demo:
+--------+----------+--------+----------+------+-------------+-----------------+--------+------+------+
| Flight | 节点名 | 位置 | 在线时间 | 负载 | 网络 | 流量 | 处理器 | 内存 | 硬盘 |
+--------+----------+--------+----------+------+-------------+-----------------+--------+------+------+
| MH361 | 微软云 | 香港 | 50 | 0.11 | 0.00M|0.00M | 195.93G|173.64G | 0% | 28% | 29% |
| MH361 | 腾讯云 | 香港 | 50 | 0.38 | 0.00M|0.00M | 51.89G|58.95G | 2% | 18% | 34% |
| MH361 | 微软云 | 新加坡 | 14 | 0.13 | 0.00M|0.00M | 17.28G|10.24G | 1% | 20% | 5% |
| MH361 | 甲骨文1 | 春川 | 61 | 0.0 | 0.00M|0.00M | 8.90G|10.20G | 0% | 25% | 5% |
| MH361 | 甲骨文2 | 春川 | 61 | 0.0 | 0.00M|0.00M | 11.82G|13.71G | 0% | 16% | 5% |
| MH370 | 甲骨文3 | 春川 | - | - | - | - | - | - | - |
| MH361 | cdn-aws1 | edge | 2 | 0.0 | 0.00M|0.00M | 5.33G|5.83G | 0% | 24% | 10% |
| MH361 | cdn-aws2 | edge | 1 | 0.03 | 0.01M|0.01M | 9.47G|4.97G | 0% | 17% | 18% |
| MH361 | cdn-aws3 | edge | 2 | 0.0 | 0.00M|0.00M | 3.73G|2.27G | 0% | 21% | 8% |
+--------+----------+--------+----------+------+-------------+-----------------+--------+------+------+
"""
import os import os
import sys import sys
@ -43,14 +26,13 @@ def sscmd(address):
ss = PrettyTable( ss = PrettyTable(
[ [
"Flight", "月流量 ↓|↑",
"节点名", "节点名",
# "虚拟化",
"位置", "位置",
"在线时间", "在线时间",
"负载", "负载",
"网络", "网络 ↓|↑",
"流量", "流量 ↓|↑",
"处理器", "处理器",
"内存", "内存",
"硬盘" "硬盘"
@ -60,9 +42,8 @@ def sscmd(address):
if i["online4"] is False and i["online6"] is False: if i["online4"] is False and i["online6"] is False:
ss.add_row( ss.add_row(
[ [
'MH370', '0.00G',
"%s" % i["name"], "%s" % i["name"],
# "%s" % i["type"],
"%s" % i["location"], "%s" % i["location"],
'-', '-',
'-', '-',
@ -76,7 +57,7 @@ def sscmd(address):
else: else:
ss.add_row( ss.add_row(
[ [
"%s" % 'MH361' if i["ip_status"] is True else 'MH370', "%.2fG|%.2fG" % (float(i["last_network_in"]) / 1024 / 1024 / 1024, float(i["last_network_out"]) / 1024 / 1024 / 1024),
"%s" % i["name"], "%s" % i["name"],
# "%s" % i["type"], # "%s" % i["type"],
"%s" % i["location"], "%s" % i["location"],