Skip to content

Commit c460aee

Browse files
Merge pull request #10 from codeperfectplus/dev
Dev to Production push after testing
2 parents f4b38e2 + 8e7221e commit c460aee

99 files changed

Lines changed: 2963 additions & 1178 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,6 @@ cython_debug/
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162162
#.idea/
163+
164+
predefine_user.json
165+
src/assets/predefine_user.json

README.md

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,6 @@
22

33
System Guard is a Flask app designed to monitor server stats such as CPU, Memory, Disk, and Network. It also provides real-time monitoring capabilities which can be useful for system administrators, developers, and DevOps engineers to keep track of their server's performance and troubleshoot issues. The app uses the `psutil` library to retrieve system stats and the `speedtest-cli` library to perform a network speed test.
44

5-
## Installation 🛠️
6-
7-
```bash
8-
wget https://raw.githubusercontent.com/codeperfectplus/SystemGuard/production/setup.sh
9-
chmod +x setup.sh && sudo mv setup.sh /usr/local/bin/systemguard-installer
10-
```
11-
12-
### To install the SystemGuard app, run the following command:
13-
14-
```bash
15-
sudo systemguard-installer --install
16-
```
17-
18-
### To uninstall the SystemGuard app, run the following command:
19-
20-
```bash
21-
sudo systemguard-installer --uninstall
22-
```
23-
24-
### To Restore the SystemGuard app, run the following command:
25-
26-
```bash
27-
sudo systemguard-installer --restore
28-
```
29-
30-
### Incase of any error, run the following command:
31-
32-
```bash
33-
sudo systemguard-installer --fix
34-
```
35-
36-
37-
### Help
38-
39-
```bash
40-
systemguard-installer --help
41-
```
42-
43-
44-
It will install the SystemGuard app and its dependencies in the crontab and it will be started automatically every time the server is restarted. The app will be available at `http://localhost:5050`.
45-
46-
## Dependencies(must be installed)
47-
48-
- Anaconda3/Miniconda3
49-
50-
```bash
51-
# install miniconda3 if not installed already
52-
wget https://raw.githubusercontent.com/codeperfectplus/HackScripts/main/setup/install_miniconda.sh
53-
chmod +x install_miniconda.sh && sudo ./install_miniconda.sh
54-
```
55-
565
## Features 🚀
576

587
- Lightweight, open-source, and free to use with a straightforward installation process.
@@ -75,6 +24,11 @@ chmod +x install_miniconda.sh && sudo ./install_miniconda.sh
7524
- Server status monitoring with alerts for server downtime or recovery (upcoming feature).
7625

7726

27+
## Installation 🛠️
28+
29+
check the [Installation.md](/src/docs/installation.md) file for installation instructions.
30+
31+
7832
## Email Feature 📧
7933

8034
| Email Alert | Is implemented | who will get the email |
@@ -130,6 +84,7 @@ A Docker image has not been created for this project because it requires access
13084
- Check the current firewall status to ensure security.
13185
- A dedicated website monitoring page for tracking uptime and performance.
13286
- Track and save total network data sent/received in the database for data usage monitoring.
87+
- Improve website monitor, save data in database with timestamp to show the history of the website.
13388

13489
## Learnings 📖
13590

app.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,12 @@
1-
import os
2-
import time
3-
import datetime
4-
import threading
5-
from src.config import app, db
1+
from src.config import app
62
from src import routes
7-
from src.utils import get_system_info_for_db
8-
from src.models import SystemInformation, ApplicationGeneralSettings
9-
from sqlalchemy.exc import SQLAlchemyError
10-
from src.logger import logger
113
from src.thread_process import monitor_settings, start_website_monitoring
124

13-
def register_routes():
14-
app.register_blueprint(routes.dashboard_bp)
15-
app.register_blueprint(routes.settings_bp)
16-
app.register_blueprint(routes.system_health_bp)
17-
app.register_blueprint(routes.cpu_info_bp)
18-
app.register_blueprint(routes.disk_info_bp)
19-
app.register_blueprint(routes.memory_info_bp)
20-
app.register_blueprint(routes.network_info_bp)
21-
app.register_blueprint(routes.speedtest_bp)
22-
app.register_blueprint(routes.process_bp)
23-
24-
25-
26-
5+
# background thread to monitor system settings changes
6+
# monitor_settings() # Starts monitoring for system logging changes
7+
start_website_monitoring() # Starts pinging active websites
278

289
if __name__ == "__main__":
29-
register_routes()
30-
31-
# Start monitoring settings and website pinging when the server starts
32-
# monitor_settings() # Starts monitoring for system logging changes
33-
# start_website_monitoring() # Starts pinging active websites
3410

3511
# Run the Flask application
3612
app.run(host="0.0.0.0", port=5000, debug=True)

line_counter.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

load_testing.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

requirements.txt

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
Flask==2.3.3
2-
psutil==5.9.5
3-
gunicorn
4-
flask-sqlalchemy
5-
flask-login
6-
flask-session
7-
python-dotenv
1+
# Flask web framework
2+
Flask==3.0.3
3+
4+
# Library for retrieving system information
5+
psutil==6.0.0
6+
7+
# For managing environment variables
8+
python-dotenv==1.0.1
9+
10+
# WSGI HTTP server for running the application in production
11+
gunicorn==23.0.0
12+
13+
# Flask extensions for database and user session management
14+
flask-sqlalchemy==3.1.1 # SQLAlchemy integration for Flask
15+
flask-login==0.6.3 # User session management for Flask
16+
flask-session==0.8.0 # Server-side session handling for Flask
17+
18+
# File system monitoring and watching
19+
watchdog==5.0.2
20+
21+
#
22+
requests

0 commit comments

Comments
 (0)