mirror of https://github.com/cppla/ServerStatus
version beta 1.0.2
parent
c98dc92256
commit
a0842a020b
52
README.md
52
README.md
|
@ -6,6 +6,7 @@
|
|||
[](https://github.com/cppla/ServerStatus)
|
||||
[](https://github.com/cppla/ServerStatus)
|
||||
[](https://github.com/cppla/ServerStatus)
|
||||
[](https://github.com/cppla/ServerStatus)
|
||||
|
||||

|
||||
|
||||
|
@ -34,10 +35,10 @@ docker run -d --restart=always --name=serverstatus -v ~/config.json:/ServerStatu
|
|||
|
||||
【客户端】:
|
||||
```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:
|
||||
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
|
||||
```
|
||||
|
||||
【服务端配置】(服务端程序在ServerStatus/web下):
|
||||
【服务端配置】:
|
||||
|
||||
一、生成服务端程序
|
||||
```
|
||||
|
@ -64,11 +65,12 @@ make
|
|||
[
|
||||
{
|
||||
"username": "s01",
|
||||
"name": "Mainserver 1",
|
||||
"type": "Dedicated Server",
|
||||
"host": "GenericServerHost123",
|
||||
"location": "Austria",
|
||||
"password": "some-hard-to-guess-copy-paste-password"
|
||||
"name": "vps-1",
|
||||
"type": "kvm",
|
||||
"host": "chengdu",
|
||||
"location": "🇨🇳",
|
||||
"password": "USER_DEFAULT_PASSWORD",
|
||||
"monthstart": 1
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -86,44 +88,36 @@ web-dir参数为上一步设置的网站根目录,务必修改成自己网站
|
|||
./sergate --config=config.json --web-dir=/home/wwwroot/default
|
||||
```
|
||||
|
||||
【客户端配置】(客户端程序在ServerStatus/clients下):
|
||||
【客户端配置】:
|
||||
客户端有两个版本,client-linux为普通linux,client-psutil为跨平台版,普通版不成功,换成跨平台版即可。
|
||||
|
||||
一、client-linux版配置:
|
||||
1、vim client-linux.py, 修改SERVER地址,username帐号, password密码
|
||||
2、python client-linux.py 运行即可。
|
||||
2、python3 client-linux.py 运行即可。
|
||||
|
||||
二、client-psutil版配置:
|
||||
1、安装psutil跨平台依赖库
|
||||
2、vim client-psutil.py, 修改SERVER地址,username帐号, password密码
|
||||
3、python client-psutil.py 运行即可。
|
||||
3、python3 client-psutil.py 运行即可。
|
||||
```
|
||||
### for Centos:
|
||||
sudo yum -y install epel-release
|
||||
sudo yum -y install python-pip
|
||||
sudo yum -y install python3-pip
|
||||
sudo yum clean all
|
||||
sudo yum -y install gcc
|
||||
sudo yum -y install python-devel
|
||||
sudo pip install psutil
|
||||
sudo yum -y install python3-devel
|
||||
sudo pip3 install psutil
|
||||
|
||||
### for Ubuntu/Debian:
|
||||
sudo root
|
||||
apt-get -y install python-setuptools python-dev build-essential
|
||||
apt-get -y install python-pip
|
||||
pip install psutil
|
||||
sudo apt -y install python3-pip
|
||||
sudo pip3 install psutil
|
||||
|
||||
### for Windows:
|
||||
打开网址:https://pypi.python.org/pypi?:action=display&name=psutil#downloads
|
||||
下载psutil for windows程序包
|
||||
安装即可
|
||||
地址:https://pypi.org/project/psutil/
|
||||
下载psutil for windows, 安装即可
|
||||
```
|
||||
|
||||
打开云探针页面,就可以正常的监控。接下来把服务器和客户端脚本自行加入开机启动,或者进程守护,或以后台方式运行即可!例如: nohup python 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
|
||||
```
|
||||
打开云探针页面,就可以正常的监控。接下来把服务器和客户端脚本自行加入开机启动,或者进程守护,或以后台方式运行即可!例如: nohup python3 client-linux.py &
|
||||
|
||||
# 为什么会有ServerStatus中文版:
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
# coding: utf-8
|
||||
# Update by : https://github.com/cppla/ServerStatus
|
||||
# 支持Python版本:2.7 to 3.9
|
||||
# Update by : https://github.com/cppla/ServerStatus, Update date: 20211009
|
||||
# 版本:1.0.2, 支持Python版本:2.7 to 3.9
|
||||
# 支持操作系统: Linux, OSX, FreeBSD, OpenBSD and NetBSD, both 32-bit and 64-bit architectures
|
||||
# 时间: 20211009
|
||||
# 说明: 默认情况下修改server和user就可以了。丢包率监测方向可以自定义,例如:CU = "www.facebook.com"。
|
||||
|
||||
SERVER = "127.0.0.1"
|
||||
|
|
|
@ -1,25 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# coding: utf-8
|
||||
# Update by : https://github.com/cppla/ServerStatus
|
||||
# 支持Python版本:2.7 to 3.8; requirements.txt: requests, PrettyTable
|
||||
# 时间: 20210714, 主要是为了受到CC attack时候方便查看机器状态 && 程序在非gui环境下目前有闪屏的bug
|
||||
|
||||
"""
|
||||
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% |
|
||||
+--------+----------+--------+----------+------+-------------+-----------------+--------+------+------+
|
||||
"""
|
||||
# Update by : https://github.com/cppla/ServerStatus, Update date: 20211009
|
||||
# 支持Python版本:2.7 to 3.9; requirements.txt: requests, PrettyTable
|
||||
# 主要是为了受到CC attack时候方便查看机器状态
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
@ -43,14 +26,13 @@ def sscmd(address):
|
|||
|
||||
ss = PrettyTable(
|
||||
[
|
||||
"Flight",
|
||||
"月流量 ↓|↑",
|
||||
"节点名",
|
||||
# "虚拟化",
|
||||
"位置",
|
||||
"在线时间",
|
||||
"负载",
|
||||
"网络",
|
||||
"流量",
|
||||
"网络 ↓|↑",
|
||||
"总流量 ↓|↑",
|
||||
"处理器",
|
||||
"内存",
|
||||
"硬盘"
|
||||
|
@ -60,9 +42,8 @@ def sscmd(address):
|
|||
if i["online4"] is False and i["online6"] is False:
|
||||
ss.add_row(
|
||||
[
|
||||
'MH370',
|
||||
'0.00G',
|
||||
"%s" % i["name"],
|
||||
# "%s" % i["type"],
|
||||
"%s" % i["location"],
|
||||
'-',
|
||||
'-',
|
||||
|
@ -76,7 +57,7 @@ def sscmd(address):
|
|||
else:
|
||||
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["type"],
|
||||
"%s" % i["location"],
|
||||
|
|
Loading…
Reference in New Issue