Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/parthasarathy27/systemmonitoringscripts

This project provides a set of Python and Bash scripts for monitoring system health, automating backups, and analyzing web server logs. It helps track system performance, ensure data safety through backups, and identify patterns in server logs, improving reliability and troubleshooting efficiency for system administrators and developers.
https://github.com/parthasarathy27/systemmonitoringscripts

analyzer health-check linux python3 system

Last synced: 2 days ago
JSON representation

This project provides a set of Python and Bash scripts for monitoring system health, automating backups, and analyzing web server logs. It helps track system performance, ensure data safety through backups, and identify patterns in server logs, improving reliability and troubleshooting efficiency for system administrators and developers.

Awesome Lists containing this project

README

        

# **System Monitoring and Health Checker Scripts**

This repository contains a set of Python and Bash scripts designed to monitor the health of a Linux system, automate backup tasks, analyze server log files, and check the health of applications. These scripts help system administrators automate critical monitoring and maintenance tasks, and quickly identify performance issues or failures in the system and applications.

The scripts are written in **Python** and **Bash**, and they provide useful reports and alerts based on predefined thresholds, ensuring proactive system management.

---

## **Features**

### **1. System Health Monitoring Script**
Monitors key system metrics such as:
- **CPU Usage**
- **Memory Usage**
- **Disk Space**
- **Running Processes**

If any of these metrics exceed predefined thresholds (e.g., CPU usage > 80%), the script sends alerts to the console or logs the results to a file.

### **2. Automated Backup Solution**
Automates the backup of a specified directory to a remote server or cloud storage. It provides a report on the success or failure of the backup operation, ensuring data safety and reliability.

### **3. Log File Analyzer**
Analyzes web server logs (Apache, Nginx, etc.) to detect:
- **404 Errors** (Failed page accesses)
- **Most Requested Pages**
- IP addresses with **the Most Requests**

The script generates a summarized report to help identify trends, errors, and potential performance bottlenecks.

### **4. Application Health Checker**
Checks the uptime of an application by assessing its HTTP status codes. It reports if the application is "up" and functioning or "down" and unavailable, enabling quick action in case of failure.

---

## **System Requirements**

To run these scripts, the following are required:
- **Python 3.x**: For executing the Python scripts.
- **Bash**: For executing the backup and log file analysis scripts.
- **Linux-based system** (or Windows Subsystem for Linux, WSL, on Windows).
- **Required Python libraries**: Listed in `requirements.txt`.

---

## **Installation**

1. Clone this repository to your local machine:
```bash
git clone
```

2. Navigate into the project directory:
```bash
cd SystemMonitoringScripts
```

3. Install the necessary Python dependencies:
```bash
pip install -r requirements.txt
```

---

## **Usage**

### **1. System Health Monitoring Script**
Run the following command to monitor system health:
```bash
python system_health.py
```
This script will check system metrics and print alerts if thresholds are exceeded.

### **2. Automated Backup Solution**
Run the following command to initiate the backup:
```bash
python backup.py
```
Ensure you modify the script to specify the source directory and remote backup destination.

### **3. Log File Analyzer**
Run the following command to analyze web server logs:
```bash
python log_analyzer.py /path/to/logfile
```
This will generate a report summarizing common patterns in the log file.

### **4. Application Health Checker**
Run the following command to check the health of an application:
```bash
python app_health.py http://your-app-url.com
```
This will check the HTTP status of the application and report whether it's "up" or "down."

---

## **Directory Structure**

```
SystemMonitoringScripts/
├── README.md # Project documentation
├── system_health.py # System health monitoring script
├── backup.py # Automated backup script
├── log_analyzer.py # Log file analysis script
├── app_health.py # Application health checking script
├── logs/ # Directory for log files (empty initially, generated by script)
│ ├── system_health.log # Log file for system health monitoring (created dynamically)
├── .gitignore # Git ignore file to exclude unnecessary files from version control
└── requirements.txt # Python dependencies file
```

---

## **Logging and Monitoring**

- Logs are stored in the `logs/` directory, with the `system_health.log` file capturing system health monitoring outputs.
- You can extend the logging functionality in each script to include additional metrics or notifications as needed.

---