Lightweight monitoring agent for ServerPulse. Collects system metrics (CPU, RAM, disk, network, processes) and ships them to the ServerPulse API once per minute.
Zero external dependencies — pure Python 3.6+ standard library only.
- CPU, memory, disk, swap, network I/O, and process metrics
- Linux, macOS, and Windows support
- One-line install via curl / PowerShell
- Non-interactive install via environment variables (for automated deployments)
- Remote server configuration: timezone, locale, NTP, DNS, reporting interval
- Agent auto-update from GitHub (opt-in, controlled via the dashboard)
Important: Always download and inspect scripts before running them with elevated privileges.
# 1. Download the installer
curl -fsSL https://raw.githubusercontent.com/FloBaMedia/Monitoring-Client/main/agent/install.sh -o /tmp/install.sh
# 2. Review the script before running
cat /tmp/install.sh
# 3. Make it executable and run with your credentials
chmod +x /tmp/install.sh
SERVERPULSE_URL=https://your-api.example.com SERVERPULSE_KEY=sp_live_... sudo /tmp/install.shOr interactive (prompts for API URL and key):
curl -fsSL https://raw.githubusercontent.com/FloBaMedia/Monitoring-Client/main/agent/install.sh -o /tmp/install.sh
chmod +x /tmp/install.sh
sudo /tmp/install.sh# 1. Download the installer
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/FloBaMedia/Monitoring-Client/main/agent/install-windows.ps1' -OutFile $env:TEMP\install-serverpulse.ps1
# 2. Review the script before running
Get-Content $env:TEMP\install-serverpulse.ps1
# 3. Execute with your credentials
& $env:TEMP\install-serverpulse.ps1 -ApiUrl "https://your-api.example.com" -ApiKey "sp_live_..."Tip: The ServerPulse dashboard generates the exact command with your API key pre-filled after you add a new server.
| Linux / macOS | Windows | |
|---|---|---|
| Install dir | /etc/serverpulse/ |
C:\ProgramData\ServerPulse\ |
| Config file | /etc/serverpulse/agent.conf |
C:\ProgramData\ServerPulse\agent.conf |
| Log file | /var/log/serverpulse-agent.log |
C:\ProgramData\ServerPulse\agent.log |
| Scheduler | crontab (* * * * *) |
Windows Scheduled Task (every 1 min) |
| Runs as | root (via sudo) | SYSTEM |
The installer:
- Detects Python 3.6+
- Downloads
agent.pyfrom this repository - Writes the config file with your API URL and key
- Registers the scheduler entry
- Runs a dry-run test to verify everything works
[serverpulse]
api_url = https://your-api.example.com
api_key = sp_live_...
debug = false| Variable | Description |
|---|---|
SERVERPULSE_API_URL |
API base URL |
SERVERPULSE_API_KEY |
Server API key |
SERVERPULSE_DEBUG |
Set to 1 to enable debug logging |
Environment variables take priority over the config file.
The agent fetches its configuration from GET /api/v1/agent/config on every run and applies the following settings locally:
| Field | Effect |
|---|---|
timezone |
Sets system timezone (timedatectl / Set-TimeZone) |
locale |
Sets system locale (localectl) |
customNtp |
Configures NTP server (timesyncd.conf / w32tm) |
customDns |
Updates DNS servers (/etc/resolv.conf / Set-DnsClientServerAddress) |
reportIntervalSeconds |
Updates the cron / scheduled task interval |
enableAutoUpdates |
Enables automatic agent self-update from GitHub |
All remote config settings can be managed from the Config tab in the ServerPulse dashboard.
When enableAutoUpdates is true in the server config, the agent checks GitHub for a newer version on every run:
- Downloads
agent.pyfrom this repository - Compares
AGENT_VERSIONwith the running version - If newer: backs up the current file (
agent.py.bak), validates the download (Python syntax check), then replaces in-place - The new version takes effect on the next scheduled run
If the download fails or is invalid, the agent logs a warning and continues with the current version.
python agent.py # collect metrics and POST to API
python agent.py --dry-run # print collected metrics as JSON, no HTTP
python agent.py --config /path/to.conf # override config file path
python agent.py --apply-template <id> # fetch and execute a server script template
python agent.py --no-apply-config # skip fetching remote config
python agent.py --debug # verbose logging to stderr
# Clone
git clone https://github.com/FloBaMedia/Monitoring-Client.git
cd Monitoring-Client/agent
# Single dry run (no HTTP)
bash run-local.sh --dry-run
# Single real run (requires valid API key in agent.conf or env vars)
bash run-local.sh
# Watch mode — reruns every 10 seconds
bash run-local.sh --watch --interval 10
# Windows equivalent
.\run-local.ps1 --dry-runThe local runner uses --debug by default so output appears in the terminal. If a local agent.conf is found next to the script it is used automatically; otherwise the agent falls back to the system config path or prompts interactively.
agent/
├── agent.py # Entry point and CLI argument handling
├── install.sh # Linux/macOS installer
├── install-windows.ps1 # Windows installer
├── uninstall.sh # Linux/macOS uninstaller
├── uninstall-windows.ps1 # Windows uninstaller
├── run-local.sh # Local development runner (Linux/macOS)
├── run-local.ps1 # Local development runner (Windows)
├── client/
│ └── api.py # HTTP client for all API calls
├── models/
│ ├── constants.py # Shared constants (version, defaults)
│ └── limits.py # Magic numbers and timeout limits
├── services/
│ ├── linux.py # Linux metric collectors
│ ├── windows.py # Windows metric collectors
│ ├── darwin.py # macOS metric collectors
│ ├── config_applier.py # Applies remote config to the local system
│ └── updater.py # Agent self-update logic
└── utils/
├── config.py # Config file loading and interactive setup
├── logging.py # File-based logger with rotation
├── validation.py # Input validation (command injection prevention)
├── lock.py # File locking with stale detection
└── snapshot.py # CPU snapshot persistence (cross-platform)
- Python 3.6 or newer
- No external packages — standard library only
- Root / Administrator privileges for install and for applying system settings (timezone, DNS, NTP)
sudo bash /etc/serverpulse/uninstall.shpowershell -ExecutionPolicy Bypass -File "C:\ProgramData\ServerPulse\uninstall-windows.ps1"- Fork the repository
- Create a feature branch:
git checkout -b feat/my-feature - Test your changes:
bash agent/run-local.sh --dry-run - Open a pull request
Please maintain the zero-dependency constraint and Python 3.6 compatibility.
MIT © FloBaMedia