Simple and effective server monitoring with easy configuration and multiple notification options
Project description
Server Monitoring Made Easy (SME)
A lightweight, easy-to-configure server monitoring tool that focuses on the metrics that matter most.
Features
- Monitor critical server metrics:
- CPU usage
- Memory consumption
- Disk space
- Network latency (ping)
- Flexible storage options:
- File-based storage with JSON
- PostgreSQL database support
- Advanced alert management:
- Customizable thresholds
- Alert count requirements before triggering
- Automatic alert resolution
- Alert history and pruning
- Comprehensive logging:
- Component-level log configuration
- Configurable log paths
- Debug logging support
- Run modes:
- Daemon mode with proper PID management
- Foreground mode for debugging
- Container support
- Easy-to-use CLI interface
- Extensible architecture for custom monitors
Installation
From source:
git clone https://github.com/timmyb824/server-monitoring-made-easy.git
cd server-monitoring-made-easy
pip install -e .
Configuration
Create a configuration file config.yaml. Here's a complete example with all available options (required options are marked with *):
# Logging Configuration
logging:
level: debug # Global log level (debug, info, warning, error)
components: # Component-specific log levels (all optional)
monitors: debug
alerts: debug
metrics: debug
daemon: debug
storage: debug
alerts: debug
# Path Configuration (all optional - defaults will be used if not specified)
paths:
# Log file path - ensure this directory exists and has proper permissions
log_file: "/path/to/log/server-monitor.log"
# PID file location
pid_file: "/path/to/pid/server-monitor.pid"
# Storage Configuration (required *)
storage: # * At least one storage type must be configured
# Storage type: 'file' or 'postgres' (required *)
type: file
# For file storage:
file_path: "/path/to/alerts.json" # * Required if type is 'file'
# For PostgreSQL storage:
# dsn: "postgresql://user:password@localhost:5432/dbname" # * Required if type is 'postgres'
# Alert pruning configuration (optional)
pruning:
enabled: true
max_age_days: 30 # Remove alerts older than this
max_alerts: 1000 # Keep only the most recent N alerts
# Monitor Configuration (required *)
monitors: # * At least one monitor must be enabled
cpu:
enabled: true # * Required for each monitor
interval: 60 # Check every 60 seconds (optional, default: 60)
threshold: 80 # Alert when CPU usage > 80% (optional, default: 80)
alert_count: 3 # Require 3 consecutive threshold violations (optional, default: 1)
memory:
enabled: true
interval: 60
threshold: 80
alert_count: 1 # Alert immediately on threshold violation
disk:
enabled: true
interval: 300 # Check every 5 minutes
threshold: 85
alert_count: 2
path: / # Monitor specific path (optional, default: /)
ping:
enabled: true
interval: 60
threshold: 200 # Alert when ping > 200ms
alert_count: 5
targets: # * Required if ping monitor is enabled
- 8.8.8.8
- 1.1.1.1
- google.com
# Alert Configuration (optional)
alerts:
# Global alert settings
default_alert_count: 1 # Default threshold violations before alerting (optional)
resolution_time: 300 # Seconds to wait before auto-resolving (optional, default: 300)
{{ ... }}
## CLI Commands
- `server-monitor start [-f/--foreground] [-c/--config PATH]`: Start monitoring
- `-f/--foreground`: Run in foreground instead of as daemon
- `-c/--config`: Specify config file path
- `server-monitor stop`: Stop the monitoring daemon
- `server-monitor status`: Show daemon status
- `server-monitor metrics`: Display current system metrics
- `server-monitor alerts`: Show current and historical alerts
- `server-monitor config show`: Display current configuration
- `server-monitor config validate`: Validate configuration file
- `server-monitor init PATH`: Create new configuration file with defaults
## Running as a Service
### Using systemd
1. Create a systemd service file at `/etc/systemd/system/server-monitor.service`:
```ini
[Unit]
Description=Server Monitoring Made Easy
After=network.target
[Service]
Type=simple
User=your_user
Environment="SME_CONFIG=/path/to/config.yaml"
ExecStart=/path/to/python/bin/server-monitor start --foreground
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
- Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable server-monitor
sudo systemctl start server-monitor
Using Docker
version: "3"
services:
monitor:
build: .
pid: "host" # Required for accurate system metrics
volumes:
- /proc:/host/proc:ro # For host metrics
- ./config.yaml:/app/config.yaml:ro
restart: unless-stopped
Development
For development and testing:
# Install development dependencies
poetry install
# Run tests
poetry run pytest tests/ -v
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file server_monitoring_made_easy-0.1.3.tar.gz.
File metadata
- Download URL: server_monitoring_made_easy-0.1.3.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e10d8f0faaab5583e72218d6a933e32ba27327b9270750ccc6c418210cbe549
|
|
| MD5 |
9339ddfe7aa0869e5207ad2d09318ed3
|
|
| BLAKE2b-256 |
dee7a1c6d77b197020141726b02f93b6b6845c18a5bdf17b1e4f2e80254ca1ce
|
Provenance
The following attestation bundles were made for server_monitoring_made_easy-0.1.3.tar.gz:
Publisher:
ci.yaml on timmyb824/server-monitoring-made-easy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
server_monitoring_made_easy-0.1.3.tar.gz -
Subject digest:
0e10d8f0faaab5583e72218d6a933e32ba27327b9270750ccc6c418210cbe549 - Sigstore transparency entry: 821260417
- Sigstore integration time:
-
Permalink:
timmyb824/server-monitoring-made-easy@ebc07d3de5f5e08ff87668657cef8a57732d9451 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/timmyb824
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@ebc07d3de5f5e08ff87668657cef8a57732d9451 -
Trigger Event:
push
-
Statement type:
File details
Details for the file server_monitoring_made_easy-0.1.3-py3-none-any.whl.
File metadata
- Download URL: server_monitoring_made_easy-0.1.3-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f4a7f4f3062301760b108b4b3aa35cfd39063bf02a92e7aec12296b6813db43
|
|
| MD5 |
326754cd081f7f881a2ed2a6246d6277
|
|
| BLAKE2b-256 |
6a577cb28dd9d2000ca56a544425d07fd7e9f13d2fb1cb55c2ed8914fa9ae019
|
Provenance
The following attestation bundles were made for server_monitoring_made_easy-0.1.3-py3-none-any.whl:
Publisher:
ci.yaml on timmyb824/server-monitoring-made-easy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
server_monitoring_made_easy-0.1.3-py3-none-any.whl -
Subject digest:
7f4a7f4f3062301760b108b4b3aa35cfd39063bf02a92e7aec12296b6813db43 - Sigstore transparency entry: 821260418
- Sigstore integration time:
-
Permalink:
timmyb824/server-monitoring-made-easy@ebc07d3de5f5e08ff87668657cef8a57732d9451 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/timmyb824
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@ebc07d3de5f5e08ff87668657cef8a57732d9451 -
Trigger Event:
push
-
Statement type: