https://github.com/bocaletto-luca/py-server-gen
Python Persistent Server Reporter Author: Bocaletto Luca Python Persistent Server Reporter è un’applicazione cross-platform che: Raccoglie metriche di sistema (IP, MAC, hostname, OS, CPU, memoria, disco, utenti) Invia report via SMTP a intervalli configurabili Gira in background come Windows Service o systemd daemon Si riavvia automaticamente in c
https://github.com/bocaletto-luca/py-server-gen
background background-jobs background-service bocaletto-luca generator linux open-source py-server-gen python server server-background server-generator windows yaml
Last synced: 3 months ago
JSON representation
Python Persistent Server Reporter Author: Bocaletto Luca Python Persistent Server Reporter è un’applicazione cross-platform che: Raccoglie metriche di sistema (IP, MAC, hostname, OS, CPU, memoria, disco, utenti) Invia report via SMTP a intervalli configurabili Gira in background come Windows Service o systemd daemon Si riavvia automaticamente in c
- Host: GitHub
- URL: https://github.com/bocaletto-luca/py-server-gen
- Owner: bocaletto-luca
- License: gpl-3.0
- Created: 2025-06-13T07:19:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-06T00:34:40.000Z (12 months ago)
- Last Synced: 2025-07-06T01:30:20.736Z (12 months ago)
- Topics: background, background-jobs, background-service, bocaletto-luca, generator, linux, open-source, py-server-gen, python, server, server-background, server-generator, windows, yaml
- Language: Python
- Homepage: https://bocaletto-luca.github.io/
- Size: 39.1 KB
- Stars: 8
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python Persistent Server Reporter
#### Author: Bocaletto Luca
[](LICENSE) [](https://www.python.org/) [](https://www.kernel.org/) [](https://github.com/bocaletto-luca/Directory-Monitor)
**Python Persistent Server Reporter** è un’applicazione cross-platform che:
1. Raccoglie metriche di sistema (IP, MAC, hostname, OS, CPU, memoria, disco, utenti)
2. Invia report via SMTP a intervalli configurabili
3. Gira in background come **Windows Service** o **systemd daemon**
4. Si riavvia automaticamente in caso di crash o kill
5. Auto-parte all’avvio del sistema
---
## 📋 Prerequisiti
- Python 3.7+
- pip (o venv)
- Su **Windows**: privilegi di amministratore per installare il servizio
- Su **Linux**: `systemd` e permessi `sudo`
---
## 📥 Installazione
```bash
git clone https://github.com/youruser/python-reporter.git
cd python-reporter
pip install -r requirements.txt
```
---
## ⚙️ Configurazione
Modifica `config.yaml` secondo le tue esigenze:
```yaml
schedule: "@every 30m" # oppure cron "0 8 * * *"
smtp:
host: "smtp.example.com"
port: 587
username: "alert@example.com"
password: "supersecret"
sender: "alert@example.com"
recipients:
- "admin1@example.com"
- "admin2@example.com"
log:
path: "server.log"
level: "INFO"
```
---
## ▶️ Esecuzione Manuale
```bash
python main.py
```
- Il processo rimane in foreground
- CTRL+C per terminare
---
## ⚙️ Installazione come Servizio
### Windows
1. Installa il servizio:
```powershell
python windows_service.py install
```
2. Configura recovery policy:
```powershell
sc.exe failure PyServerReport reset= 0 actions= restart/5000
```
3. Avvia:
```powershell
python windows_service.py start
```
4. Stop & rimozione:
```powershell
python windows_service.py stop
python windows_service.py remove
```
### Linux (systemd)
1. Copia file:
```bash
sudo mkdir -p /opt/server-report
sudo cp main.py config.yaml /opt/server-report/
sudo cp linux_server.service /etc/systemd/system/python-server-report.service
```
2. Abilita & avvia:
```bash
sudo systemctl daemon-reload
sudo systemctl enable python-server-report
sudo systemctl start python-server-report
```
3. Status & log:
```bash
sudo systemctl status python-server-report
journalctl -u python-server-report -f
```
---
## 📦 Packaging
### PyInstaller (Windows)
```bash
pip install pyinstaller
pyinstaller --onefile app.py service.py
# quindi:
dist/service.exe install
```
### Docker
1. Costruisci immagine:
```bash
docker build -t py-server-reporter .
```
2. Esegui:
```bash
docker run -d \
-v $(pwd)/config.yaml:/app/config.yaml:ro \
--name py-server-report \
py-server-reporter
```
---
## 🐞 Troubleshooting
- **Email failures**: controlla credenziali e port forwarding SMTP
- **Svc non parte**: verifica che `service.py` punti al corretto interprete Python
- **systemd non parte**: usa `journalctl -xe` per debug
---
## 🤝 Contribuire
1. Fork del progetto
2. Branch feature: `git checkout -b feat/my-feature`
3. Commit e PR
---
## 📄 Licenza
GPL License – vedi [LICENSE](LICENSE)
---
**Autore:** Bocaletto Luca (@bocaletto-luca)