Compare commits

16 Commits
dev ... main

Author SHA1 Message Date
60d5372847 Delete CHANGELOG.md 2025-12-23 16:20:17 +00:00
77b2b09ccb Delete todo.md 2025-12-23 16:20:08 +00:00
81805b264b Delete SECURITY.md 2025-12-23 16:20:02 +00:00
84901c60d1 Delete install.sh 2025-12-23 16:19:54 +00:00
c006981bff Delete .github/workflows/update-readme.yml 2025-12-23 16:19:47 +00:00
182e31adfd Update README.md 2025-12-23 16:19:27 +00:00
4aba6425f1 Merge pull request 'up' (#10) from dev into main
Some checks failed
Update README from CHANGELOG / update-readme (push) Has been cancelled
Reviewed-on: #10
2025-12-23 16:18:03 +00:00
eb2418ccf0 Merge pull request 'up' (#9) from dev into main
Reviewed-on: #9
2025-12-16 18:10:33 +00:00
0b05dc0d14 Merge pull request 'up' (#8) from dev into main
Reviewed-on: #8
2025-12-16 16:22:24 +00:00
858312d2e2 Merge pull request 'up' (#7) from dev into main
Reviewed-on: #7
2025-12-16 16:09:20 +00:00
9df9a440d7 Merge pull request 'up' (#6) from dev into main
Reviewed-on: #6
2025-12-16 15:46:48 +00:00
53ddfe5220 Merge pull request 'readme req' (#5) from dev into main
Reviewed-on: #5
2025-12-16 14:36:46 +00:00
a3260b9c86 Merge pull request 'unicode fix' (#4) from dev into main
Reviewed-on: #4
2025-12-16 14:33:29 +00:00
ed126b5a9a Merge pull request 'dev' (#3) from dev into main
Reviewed-on: #3
2025-12-16 14:32:21 +00:00
0851c8f6ef Merge pull request 'Read update' (#2) from dev into main
Reviewed-on: #2
2025-12-16 01:33:16 +00:00
2c249a0c6b Merge pull request 'up' (#1) from dev into main
Reviewed-on: #1
2025-12-16 00:46:54 +00:00
6 changed files with 4 additions and 344 deletions

View File

@@ -1,33 +0,0 @@
name: Update README from CHANGELOG
on:
push:
paths:
- CHANGELOG.md
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract latest changelog
run: |
awk '/^## \[/{if (++n==1) print; else exit} {print}' CHANGELOG.md > latest.txt
- name: Update README
run: |
sed -i '/<!-- CHANGELOG:START -->/,/<!-- CHANGELOG:END -->/{
/<!-- CHANGELOG:START -->/!{
/<!-- CHANGELOG:END -->/!d
}}' README.md
sed -i '/<!-- CHANGELOG:START -->/r latest.txt' README.md
- name: Commit changes
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git add README.md
git commit -m "docs: update latest release in README"
git push

View File

@@ -1,25 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/).
---
## [v0.0.1] - 2025-12-18
### Added
- Initial release
- Lightweight server monitor agent
- CPU, RAM, Disk, and Load monitoring
- Single-user dashboard (password protected)
- IPv4-only support
---
## [Unreleased]
### Added
- (planned) Alerting support
- (planned) Historical metrics

View File

@@ -1,26 +1,8 @@
# Server Monitor # Server Monitor
**Menu:** **Repository Moved**
[License](LICENSE) · [Security](SECURITY.md) · [Changelog](CHANGELOG.md) · [Hosted Version](#hosted-version)
--- This project has been **moved** to a new repository.
Lightweight, self-hosted server monitoring tool (single-user). **New location:**
https://github.com/DemOnJR/ServersMonitoring
---
## Latest Release
<!-- CHANGELOG:START -->
<!-- CHANGELOG:END -->
> For the full history, see the [Changelog](CHANGELOG.md).
---
## Hosted Version
A hosted, multi-user version with advanced features is available at:
@todo
The hosted service is not open source and is governed by separate Terms of Service.

View File

@@ -1,6 +0,0 @@
@todo
----------------------------------------------------------
This security policy applies only to the open-source core.
The hosted version is covered by separate terms.

View File

@@ -1,214 +0,0 @@
#!/bin/bash
# Oprește execuția imediat dacă apare orice eroare
set -e
# ============================
# VARIABILE GLOBALE
# ============================
# Directorul unde va fi instalat agentul
INSTALL_DIR="/opt/server-monitor"
# Scriptul agentului care va rula periodic
AGENT="$INSTALL_DIR/monitor-agent.sh"
# Fișierul de configurare (permisiuni restrictive)
CONFIG="$INSTALL_DIR/config.env"
# Comanda rulată din cron (fără output)
CRON_CMD="$AGENT >/dev/null 2>&1"
# Endpoint API unde se trimit datele
API_URL="https://itschool.pbcv.dev/api/report.php"
# ============================
# VERIFICARE PERMISIUNI ROOT
# ============================
# Scriptul trebuie rulat ca root (cron, /opt, system info)
# $EUID global variable
if [[ $EUID != 0 ]]; then
echo "Run as root (sudo)"
exit 1
fi
echo "Installing Server Monitor Agent (IPv4 only)..."
# ============================
# CREARE DIRECTOR DE INSTALARE
# ============================
# Creează directorul dacă nu există
mkdir -p "$INSTALL_DIR"
# Permisiuni standard pentru directoare de sistem
chmod 755 "$INSTALL_DIR"
# ============================
# FIȘIER CONFIGURARE
# ============================
# Stocăm variabilele configurabile separat
# (bun pentru securitate și extensibilitate)
cat > "$CONFIG" <<EOF
API_URL="$API_URL"
EOF
# Permisiuni restrictive (doar root poate citi)
chmod 600 "$CONFIG"
# ============================
# SCRIPT AGENT (RULEAZĂ DIN CRON)
# ============================
cat > "$AGENT" <<'EOF'
#!/bin/bash
set -e
# Importă configurația
source /opt/server-monitor/config.env
# Numele mașinii
HOSTNAME=$(hostname)
# ============================
# CPU
# ============================
# Load average (1 minut)
CPU_LOAD=$(uptime | awk -F'load average:' '{print $2}' | cut -d',' -f1 | xargs)
# Număr de core-uri CPU
CPU_CORES=$(nproc)
# ============================
# MEMORIE RAM / SWAP (MB)
# ============================
# RAM total și utilizat
RAM_TOTAL=$(free -m | awk '/Mem:/ {print $2}')
RAM_USED=$(free -m | awk '/Mem:/ {print $3}')
# SWAP total și utilizat
SWAP_TOTAL=$(free -m | awk '/Swap:/ {print $2}')
SWAP_USED=$(free -m | awk '/Swap:/ {print $3}')
# ============================
# DISK (KB, partiția /)
# ============================
DISK_TOTAL=$(df -k / | awk 'NR==2 {print $2}')
DISK_USED=$(df -k / | awk 'NR==2 {print $3}')
# ============================
# NETWORK IPv4 ONLY
# ============================
# Detectează interfața activă IPv4
IFACE=$(ip -4 route get 1.1.1.1 2>/dev/null | awk '{print $5; exit}')
# Trafic RX / TX (bytes)
RX_BYTES=$(cat /sys/class/net/$IFACE/statistics/rx_bytes)
TX_BYTES=$(cat /sys/class/net/$IFACE/statistics/tx_bytes)
# ============================
# PROCESE
# ============================
# Număr total de procese
PROC_TOTAL=$(ps ax --no-headers | wc -l)
# Procese zombie (Z)
PROC_ZOMBIE=$(ps axo stat | grep -c Z || true)
# ============================
# SYSTEMD SERVICES
# ============================
# Servicii systemd eșuate
FAILED_SERVICES=$(systemctl --failed --no-legend 2>/dev/null | wc -l)
# ============================
# PORTURI DESCHISE (IPv4)
# ============================
# Porturi ascultate TCP/UDP IPv4
OPEN_PORTS=$(ss -4 -lntu | tail -n +2 | wc -l)
# ============================
# OS / KERNEL / ARHITECTURĂ
# ============================
# Nume OS (fallback dacă lsb_release nu există)
OS_NAME=$(lsb_release -ds 2>/dev/null || grep PRETTY_NAME /etc/os-release | cut -d= -f2 | tr -d '"')
KERNEL=$(uname -r)
ARCH=$(uname -m)
# ============================
# UPTIME
# ============================
UPTIME=$(uptime -p)
# ============================
# TRIMITERE DATE CĂTRE API
# FORȚAT IPv4 (-4)
# ============================
curl -4 -s -X POST "$API_URL" \
-H "Content-Type: application/json" \
-d "{
\"hostname\": \"$HOSTNAME\",
\"cpu\": \"$CPU_LOAD\",
\"cpu_cores\": $CPU_CORES,
\"ram_used\": $RAM_USED,
\"ram_total\": $RAM_TOTAL,
\"swap_used\": $SWAP_USED,
\"swap_total\": $SWAP_TOTAL,
\"disk_used\": $DISK_USED,
\"disk_total\": $DISK_TOTAL,
\"rx_bytes\": $RX_BYTES,
\"tx_bytes\": $TX_BYTES,
\"processes\": $PROC_TOTAL,
\"zombies\": $PROC_ZOMBIE,
\"failed_services\": $FAILED_SERVICES,
\"open_ports\": $OPEN_PORTS,
\"os\": \"$OS_NAME\",
\"kernel\": \"$KERNEL\",
\"arch\": \"$ARCH\",
\"uptime\": \"$UPTIME\"
}"
EOF
# Permite execuția agentului
chmod +x "$AGENT"
# ============================
# CRON JOB (FĂRĂ DUBLURI)
# ============================
(
# Păstrează ce există deja, elimină dublurile
crontab -l 2>/dev/null | grep -v "$AGENT" || true
# Rulează agentul la fiecare minut
echo "* * * * * $CRON_CMD"
) | crontab -
# ============================
# FINAL
# ============================
echo "Server Monitor installed successfully (IPv4 only)"
echo "Reporting to: $API_URL"
echo "Interval: every 1 minute"
echo "Manual test: $AGENT"

44
todo.md
View File

@@ -1,44 +0,0 @@
# ITSchool Project 1
Servers Monitoring
Demo: [https://itschool.pbcv.dev/](https://itschool.pbcv.dev/)
## Requirements
### VPS
```c++
root (access)
ipv4
*curl
*crontab
```
### Webhost
```c++
*PHP 8.4
- *SQLITE MODULE
```
## Install
```bash
sqlite3 db/monitor.sqlite < sql/schema.sql
```
## Todo (Maybe 🤣)
- Alert System (Discord, Email)
- Down
- Network Attack (DDoS Detection)
- Services (Extra)
- Error, Down
- *Services Monitoring (Extra)
- Services list
- Service page
- Uptime, Logs (Filter Errors)
- Discord Server Alerts Manager (Extra)
- Create / Choose Channel
- Permission Groups
- N8N Auto Solve issues (Extra)
- todo