{"id":23282189,"url":"https://github.com/alilotfi23/metricguard","last_synced_at":"2026-05-10T19:10:18.945Z","repository":{"id":246001365,"uuid":"819801714","full_name":"alilotfi23/MetricGuard","owner":"alilotfi23","description":"MetricGuard is a lightweight Linux system monitoring tool built with FastAPI and psutil. ","archived":false,"fork":false,"pushed_at":"2024-08-07T08:50:48.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-07T12:29:08.288Z","etag":null,"topics":["fastapi","linux","metrics","monitoring","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alilotfi23.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-25T08:22:29.000Z","updated_at":"2024-08-07T08:50:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2af2adc-ff81-4892-b064-5b332b3a90c9","html_url":"https://github.com/alilotfi23/MetricGuard","commit_stats":null,"previous_names":["alilotfi23/metricguard"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2FMetricGuard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2FMetricGuard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2FMetricGuard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alilotfi23%2FMetricGuard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alilotfi23","download_url":"https://codeload.github.com/alilotfi23/MetricGuard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247492543,"owners_count":20947545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","linux","metrics","monitoring","python"],"created_at":"2024-12-20T00:14:56.014Z","updated_at":"2026-05-10T19:10:13.917Z","avatar_url":"https://github.com/alilotfi23.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  MetricGuard\n\n## Overview\n\nThis project is a Linux monitoring system built using FastAPI and psutil. A RESTful API provides detailed metrics about the system's CPU, memory, disk usage, network, uptime, and logged-in users.\n\n## Features\n\n- Retrieve CPU information including count, stats, usage percentage, times, frequency, load average, interrupts, and cache info.\n- Get detailed memory usage information including virtual memory and swap memory.\n- Access detailed disk usage information.\n- Fetch detailed network usage information including IO counters, connections, interface addresses, and stats.\n- Get system uptime in a human-readable format.\n- List logged-in users.\n\n\n## Installation\n\n1. Clone the repository:\n    ```sh\n    git clone https://github.com/alilotfi23/linux-monitoring-system.git\n    cd MetricGuard\n    ```\n\n2. Create a virtual environment and activate it:\n    ```sh\n    python3 -m venv venv\n    source venv/bin/activate\n    ```\n\n3. Install the dependencies:\n    ```sh\n    pip install -r requirements.txt\n    ```\n\n## Running the Application\n\n1. Start the FastAPI application using `uvicorn`:\n    ```sh\n    uvicorn main:app --reload\n    ```\n\n2. Open your browser and navigate to `http://127.0.0.1:8000` to see the welcome message.\n\n3. To access the metrics, go to `http://127.0.0.1:8000/metrics`.\n\n## Configuration\n\nYou can set the logging level using environment variables. For example, in a Unix-like environment, you can set the logging level to DEBUG when running the server:\n\n```sh\nexport LOGGING_LEVEL=DEBUG\nuvicorn main:app --reload\n```\n\n## Usage\n\n- **GET /**: Returns a welcome message.\n- **GET /metrics**: Returns all system metrics.\n\n## Metrics Details\n\n### CPU Information\n- `count`: Number of CPU cores.\n- `stats`: CPU statistics.\n- `percent`: CPU usage percentage.\n- `times`: CPU times.\n- `freq`: CPU frequency.\n- `load_avg`: Load average.\n- `interrupts`: Number of interrupts.\n- `cache_info`: Cache information.\n\n### Memory Information\n- `virtual_memory`: Virtual memory details (total, available, percent, used, free, active, inactive, buffers, cached, shared).\n- `swap_memory`: Swap memory details (total, used, free, percent, sin, sout).\n\n### Disk Information\n- `device`: Device name.\n- `fstype`: File system type.\n- `total`: Total disk space.\n- `used`: Used disk space.\n- `free`: Free disk space.\n- `percent`: Disk usage percentage.\n- `read_count`: Read count.\n- `write_count`: Write count.\n- `read_bytes`: Bytes read.\n- `write_bytes`: Bytes written.\n- `busy_time`: Busy time.\n\n### Network Information\n- `io_counters`: Network I/O counters.\n- `connections`: Network connections.\n- `if_addrs`: Network interface addresses.\n- `if_stats`: Network interface stats.\n\n### System Uptime\n- `days`: Days since last boot.\n- `hours`: Hours since last boot.\n- `minutes`: Minutes since last boot.\n- `seconds`: Seconds since last boot.\n\n### Users\n- `username`: Username of the logged-in user.\n- `terminal`: Terminal.\n- `host`: Host.\n- `started`: Start time.\n\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please create a pull request with your changes or open an issue to discuss what you would like to improve.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falilotfi23%2Fmetricguard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falilotfi23%2Fmetricguard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falilotfi23%2Fmetricguard/lists"}