First commit
This commit is contained in:
parent
444f02cd0a
commit
239cc86ff4
3 changed files with 154 additions and 0 deletions
46
.gitignore
vendored
Normal file
46
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
# Ambiente virtual
|
||||||
|
venv/
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
|
||||||
|
# Bytecode compilado
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# Arquivos temporários do sistema
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Logs e databases locais
|
||||||
|
*.log
|
||||||
|
*.sqlite3
|
||||||
|
|
||||||
|
# VSCode
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Arquivos de testes ou builds
|
||||||
|
*.coverage
|
||||||
|
htmlcov/
|
||||||
|
coverage.xml
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
.eggs/
|
||||||
|
*.egg-info/
|
||||||
|
|
||||||
|
# Cache do pip
|
||||||
|
pip-wheel-metadata/
|
||||||
|
*.egg
|
||||||
|
.cache/
|
||||||
|
.tox/
|
||||||
|
|
||||||
|
# Arquivo s de conexão
|
||||||
|
config/database/firebird.json
|
||||||
|
storage/temp
|
||||||
|
storage/temp.json
|
||||||
|
|
||||||
|
# Ignorar arquivos storage
|
||||||
|
storage/
|
||||||
71
main.py
Normal file
71
main.py
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# main.py
|
||||||
|
# Exibe informações agradáveis do servidor no terminal
|
||||||
|
# Comentários explicativos incluídos conforme sua preferência
|
||||||
|
|
||||||
|
import platform
|
||||||
|
import psutil
|
||||||
|
import socket
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
def get_server_info():
|
||||||
|
"""\ Coleta informações do sistema operacional, hardware e rede.
|
||||||
|
"""
|
||||||
|
info = {}
|
||||||
|
|
||||||
|
# Informações gerais do sistema
|
||||||
|
info["system"] = platform.system()
|
||||||
|
info["release"] = platform.release()
|
||||||
|
info["version"] = platform.version()
|
||||||
|
info["machine"] = platform.machine()
|
||||||
|
info["processor"] = platform.processor()
|
||||||
|
|
||||||
|
# Informações da rede
|
||||||
|
hostname = socket.gethostname()
|
||||||
|
ip_address = socket.gethostbyname(hostname)
|
||||||
|
info["hostname"] = hostname
|
||||||
|
info["ip_address"] = ip_address
|
||||||
|
|
||||||
|
# Informações de recursos
|
||||||
|
info["cpu_percent"] = psutil.cpu_percent(interval=1)
|
||||||
|
info["memory_percent"] = psutil.virtual_memory().percent
|
||||||
|
info["total_memory_gb"] = round(psutil.virtual_memory().total / (1024**3), 2)
|
||||||
|
info["uptime"] = datetime.now() - datetime.fromtimestamp(psutil.boot_time())
|
||||||
|
|
||||||
|
return info
|
||||||
|
|
||||||
|
|
||||||
|
def display_server_info(info):
|
||||||
|
"""\ Exibe as informações no terminal de maneira estilizada.
|
||||||
|
"""
|
||||||
|
# Exibe horário do início do teste
|
||||||
|
now = datetime.now().strftime("%H:%M:%S")
|
||||||
|
print(f"Início do teste às {now}")
|
||||||
|
print("=" * 60)
|
||||||
|
print(" 🖥️ SERVER STATUS - INFORMACOES DO SERVIDOR")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
print(f"📌 Sistema Operacional: {info['system']} {info['release']}")
|
||||||
|
print(f"📌 Versão: {info['version']}")
|
||||||
|
print(f"📌 Arquitetura: {info['machine']}")
|
||||||
|
print(f"📌 Processador: {info['processor']}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
print(f"🌐 Hostname: {info['hostname']}")
|
||||||
|
print(f"🌐 IP: {info['ip_address']}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
print(f"⚙️ Uso de CPU: {info['cpu_percent']}%")
|
||||||
|
print(f"⚙️ Uso de Memória: {info['memory_percent']}%")
|
||||||
|
print(f"⚙️ Memória Total: {info['total_memory_gb']} GB")
|
||||||
|
print(f"⚙️ Uptime: {str(info['uptime']).split('.')[0]}")
|
||||||
|
|
||||||
|
print("=" * 60)
|
||||||
|
print(" Finalizado ✔️")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
info = get_server_info()
|
||||||
|
display_server_info(info)
|
||||||
37
requirements.txt
Normal file
37
requirements.txt
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
annotated-types==0.7.0
|
||||||
|
anyio==4.10.0
|
||||||
|
bcrypt==3.1.7
|
||||||
|
cffi==2.0.0
|
||||||
|
click==8.2.1
|
||||||
|
colorama==0.4.6
|
||||||
|
cryptography==46.0.3
|
||||||
|
dnspython==2.7.0
|
||||||
|
ecdsa==0.19.1
|
||||||
|
email_validator==2.2.0
|
||||||
|
fastapi==0.116.1
|
||||||
|
firebird-base==2.0.2
|
||||||
|
firebird-driver==2.0.2
|
||||||
|
greenlet==3.2.4
|
||||||
|
h11==0.16.0
|
||||||
|
idna==3.10
|
||||||
|
packaging==25.0
|
||||||
|
passlib==1.7.4
|
||||||
|
protobuf==5.29.5
|
||||||
|
psutil==7.1.3
|
||||||
|
pyasn1==0.6.1
|
||||||
|
pycparser==2.22
|
||||||
|
pydantic==2.11.7
|
||||||
|
pydantic_core==2.33.2
|
||||||
|
PyMySQL==1.1.2
|
||||||
|
python-dateutil==2.9.0.post0
|
||||||
|
python-jose==3.5.0
|
||||||
|
pytz==2025.2
|
||||||
|
rsa==4.9.1
|
||||||
|
six==1.17.0
|
||||||
|
sniffio==1.3.1
|
||||||
|
SQLAlchemy==2.0.42
|
||||||
|
sqlalchemy-firebird==2.1
|
||||||
|
starlette==0.47.2
|
||||||
|
typing-inspection==0.4.1
|
||||||
|
typing_extensions==4.14.1
|
||||||
|
uvicorn==0.35.0
|
||||||
Loading…
Add table
Reference in a new issue