https://github.com/cppla/ServerStatus
服务端
mkdir /root/serverstatus
cd /root/serverstatus
mkdir plugin
cd plugin
curl -L https://raw.githubusercontent.com/cppla/ServerStatus/master/plugin/Dockerfile-telegram -O
curl -L https://raw.githubusercontent.com/cppla/ServerStatus/master/plugin/bot-telegram.py -O
cd /root/serverstatus
curl -L https://raw.githubusercontent.com/cppla/ServerStatus/master/Dockerfile -O
curl -L https://raw.githubusercontent.com/cppla/ServerStatus/master/docker-compose-telegram.yml -O
nano docker-compose-telegram.yml
version: "3"
services:
serverstatus:
build:
context: .
dockerfile: Dockerfile
image: serverstatus_server
container_name: serverstatus
restart: unless-stopped
networks:
serverstatus-network:
ipv4_address: 172.23.0.2
volumes:
- ./server/config.json:/ServerStatus/server/config.json
- ./web:/usr/share/nginx/html
ports:
- 35601:35601
- 8080:80
bot:
build:
context: ./plugin
dockerfile: Dockerfile-telegram
image: serverstatus_bot
container_name: bot4sss
restart: unless-stopped
networks:
serverstatus-network:
ipv4_address: 172.23.0.3
environment:
- TG_CHAT_ID=${TG_CHAT_ID}
- TG_BOT_TOKEN=${TG_BOT_TOKEN}
networks:
serverstatus-network:
name: serverstatus-network
ipam:
config:
- subnet: 172.23.0.0/24
退出并保存,然后执行:
TG_CHAT_ID=1106xxxxxx TG_BOT_TOKEN=1799xxxxxx:AAHIoyPFzosWtLgWsoIzEPlR9Qp72xxxxxx /usr/local/bin/docker-compose -f docker-compose-telegram.yml up -d
客户端
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 python3 client-linux.py SERVER=45.79.67.132 USER=s04 PASSWORD=PAS >/dev/null 2>&1 &
#查看及结束python进程
ps -ef |grep python
kill -9 2320688
Comments | NOTHING