https://github.com/yashindane/monitoring-webapp
Monitoring Web App build using FastAPI
https://github.com/yashindane/monitoring-webapp
fastapi
Last synced: 7 months ago
JSON representation
Monitoring Web App build using FastAPI
- Host: GitHub
- URL: https://github.com/yashindane/monitoring-webapp
- Owner: YashIndane
- Created: 2021-10-23T10:18:41.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-12T10:08:05.000Z (about 3 years ago)
- Last Synced: 2025-03-02T12:18:59.401Z (11 months ago)
- Topics: fastapi
- Language: HTML
- Homepage:
- Size: 999 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
 

[demo](https://www.linkedin.com/posts/yash-indane-aa6534179_fastapi-monitoring-softwaredevelopement-activity-6860459061431828480-HdIu)
## Requirements
Requirements are mentioned in [requirements.txt](https://github.com/YashIndane/monitoring-webapp/blob/main/requirements.txt), Install by -
```
$ pip3 install -r requirements.txt
```
## Running the App
Run by -
```
$ uvicorn app:monitor_app --host 0.0.0.0 --port --reload
```
## Configuration on System to be monitored
Install `httpd` and `sysstat` by -
```
$ yum install httpd sysstat
```
Start the httpd service by `$ systemctl start httpd`.
Have this files in `/var/www/cgi-bin` directory -
Have this lines of code at beginning of each file
```py
#!/usr/bin/python3
from subprocess import getstatusoutput as gso
import cgi
print("content-type:text/plain")
print("Access-Control-Allow-Origin: *")
print()
```
`getfreemem.py`
```py
free_mem = int(gso("free -m | grep 'Mem:' | awk '{ print $4 }'")[1])
total_mem = int(gso("free -m | grep 'Mem:' | awk '{ print $2 }'")[1])
percent_free = (free_mem * 100 ) / total_mem
print(percent_free)
```
`getreadspeed.py`
```py
read_speed = gso("iostat | grep sda | awk '{ print $3 }'")[1]
print(read_speed)
```
`getwrspeed.py`
```py
write_speed = gso("iostat | grep sda | awk '{ print $4 }'")[1]
print(write_speed)
```
`getcpuuse.py`
```py
cpu = gso("mpstat | grep all | awk '{ print $3 }'")[1]
print(cpu)
```
Make above files executable by-
```
$ chmod +x
```