DevOps CLI tool for remote server health monitoring over SSH
Project description
IronOps — DevOps CLI tool for remote server health monitoring
DevOps Project
A Python-based tool to check the health of multiple remote Linux servers over SSH — automatically collecting CPU, RAM, disk, and service metrics, then generating reports and sending alerts.
Table of Contents
- What This Project Does
- How It Works (Architecture)
- Tools & Technologies
- Installation
- Configuration
- Usage
- Example Output
- Scheduling with Cron
- Project Structure
What This Project Does
This tool connects to a list of remote Linux servers via SSH, runs health checks on each one, and:
- Collects: CPU usage, RAM usage, disk space, uptime, running services
- Generates a JSON, readable report for each run
- Sends email/Slack alerts when a server exceeds thresholds (e.g., disk > 90%)
- Can run automatically on a schedule using cron
How It Works (Architecture)
Tools & Technologies
| Tool | Why we use it | Learn more |
|---|---|---|
| Python 3 | Main language | python.org |
| paramiko | Python SSH library to connect to servers | paramiko.org |
| PyYAML | Read the servers config file (YAML format) | pyyaml.org |
| smtplib | Built-in Python email sender for alerts | Python standard library |
| cron | Linux scheduler to run the script automatically | man cron |
| JSON | Report format | Built-in Python |
Why SSH?
SSH (Secure Shell) is the industry-standard way to remotely access Linux servers. You connect using:
- Password
- SSH Key Pair
Our project supports both methods.
Installation
Step 1 — Install Python 3
# Ubuntu/Debian
sudo apt update && sudo apt install python3 python3-pip -y
# macOS (using Homebrew)
brew install python3
Step 2 — Clone this project
git clone https://github.com/yourname/server-health-monitor.git
cd server-health-monitor
Step 3 — Install Python dependencies
pip3 install -r requirements.txt
This installs:
paramiko— SSH connectionspyyaml— reading YAML config files
Step 4 — Set up your SSH access
Using SSH keys (recommended for prod):
# Generate an SSH key pair (if you don't have one already)
ssh-keygen -t rsa -b 4096 -C "health-monitor"
# Copy your public key to each remote server
ssh-copy-id user@your-server-ip
# Test it works
ssh user@your-server-ip "echo connected successfully"
Step 5 — Configure your servers
Edit config/servers.yaml — see the Configuration section below.
Step 6 — Run this commande to track you server
python3 health_monitor.py
Configuration
Edit config/servers.yaml to add your servers (e.g):
# List of servers to monitor
servers:
- name: "web-server-01"
host: "192.168.1.10"
port: 22
user: "ubuntu"
auth: "key" # "key"
key_path: "~/.ssh/id_rsa" # path to your private key
Usage
Basic run (check all servers once)
python3 health_monitor.py
Check a single specific server
python3 health_monitor.py --server web-server-01
Show verbose output
python3 health_monitor.py --verbose
Save report to a custom location
python3 health_monitor.py --output /tmp/my-report.json
Example Terminak Output
python3 health_monitor.py --my-mac
python3 health_monitor.py
monitor.log
Demo fake data (test)
JSON report (reports/health_20241115_143201.json):
{
"run_id": 1,
"timestamp": "2024-11-15T14:32:01Z",
"summary": {
"total": 3,
"healthy": 2,
"warning": 1,
"critical": 0,
"unreachable": 1
},
"servers": [
{
"name": "web-server-01",
"host": "192.168.1.10",
"status": "warning",
"metrics": {
"cpu_percent": 23.4,
"ram_percent": 61.2,
"disk_percent": 78.5,
"uptime": "14 days, 3 hours"
}
}
]
}
Scheduling with Cron
To run the health check automatically every 15 minutes:
# Open the cron editor
crontab -e
# Add this line (e.g: runs every 15 minutes)
*/15 * * * * /usr/bin/python3 /path/to/server-health-monitor/health_monitor.py >> /var/log/health_monitor.log 2>&1
Cron schedule format: minute hour day month weekday
*/15 * * * * → every 15 minutes
0 * * * * → every hour
0 8 * * * → every day at 8am
0 8 * * 1 → every Monday at 8am
Project Structure
IronOps/
│
├── health_monitor.py # Main entry point (run this)
├── requirements.txt # Python dependencies
├── README.md # This file
│
├── config/
│ └── servers.yaml # Your server list + settings
│
├── modules/
│ ├── ssh_client.py # Handles SSH connections
│ ├── health_check.py # Runs metric commands on servers to check
│ ├── reporter.py # Formats and saves reports
│ └── alerter.py # Sends email/Slack alerts
│
├── reports/ # Auto-generated JSON reports
│ └── health_YYYYMMDD_HHMMSS.json
│
└── logs/ # Run logs
└── monitor.log
Project details
Release history Release notifications | RSS feed
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 ironops-1.0.0.tar.gz.
File metadata
- Download URL: ironops-1.0.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f503deaaac8b65633882d07e9bd98cb8e068dd6cda508bde927a487a3e92fdc1
|
|
| MD5 |
4c14aab69b20524b8d71d9fffacd75bd
|
|
| BLAKE2b-256 |
9364941ad4df9ee552528ade2d76550156c07cf7652f7731c5b10303805ee0b2
|
File details
Details for the file ironops-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ironops-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f588b86ed4be9eaa5cfe84b2d272cd9d9a6a2cd4bd219f5d90796f6459a6b20
|
|
| MD5 |
9074d8da6579aa2ceddc74b771dc792c
|
|
| BLAKE2b-256 |
180ba642d7088bf9d545154448faa692f872a8414be03061b7f31f8d0ed99bf0
|