{"id":26704904,"url":"https://github.com/peandaddy/sqlmonlit","last_synced_at":"2026-05-02T09:32:49.821Z","repository":{"id":284464816,"uuid":"954999672","full_name":"peandaddy/sqlmonlit","owner":"peandaddy","description":"A modular, extensible, and production-ready Streamlit application for real-time monitoring of SQL Server instances.","archived":false,"fork":false,"pushed_at":"2025-03-26T02:14:14.000Z","size":2384,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T03:23:26.513Z","etag":null,"topics":["sqlmonitor","sqlserver","streamlit-dashboard"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peandaddy.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":"2025-03-26T00:22:41.000Z","updated_at":"2025-03-26T02:14:17.000Z","dependencies_parsed_at":"2025-03-26T03:23:31.324Z","dependency_job_id":null,"html_url":"https://github.com/peandaddy/sqlmonlit","commit_stats":null,"previous_names":["peandaddy/sqlmonlit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peandaddy%2Fsqlmonlit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peandaddy%2Fsqlmonlit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peandaddy%2Fsqlmonlit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peandaddy%2Fsqlmonlit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peandaddy","download_url":"https://codeload.github.com/peandaddy/sqlmonlit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245785805,"owners_count":20671634,"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":["sqlmonitor","sqlserver","streamlit-dashboard"],"created_at":"2025-03-27T05:18:33.280Z","updated_at":"2026-05-02T09:32:49.777Z","avatar_url":"https://github.com/peandaddy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQLMonLit - SQL Monitoring Dashboard\n\nA modular, extensible, and production-ready `Streamlit` application for real-time monitoring of SQL Server instances. This dashboard fetches and displays key performance metrics (**CPU, Memory, TempDB, Disk, Backup, and Activity**) from multiple SQL Server instances, leveraging stored procedures for data retrieval.\n\n![](Demo.gif)\n\n## Features\n- **Multi-Instance Support**: Monitor multiple SQL Server instances configured via `config.ini`.\n- **Real-Time Updates**: Auto-refresh every `60` seconds with a manual refresh option.\n- **Tabular UI**: Organized metrics in tabs (CPU, Memory, TempDB, Disk, Backup, Activity) with timestamped entries.\n- **Data Limiting**: Retains up to 10 recent records per metric, preventing overload.\n- **Duplicate Prevention**: Ensures no duplicate records during rapid updates.\n- **Modular Design**: Separates configuration, database logic, UI, and app orchestration for maintainability and scalability.\n- **Error Handling**: Graceful handling of connection and query failures with user feedback.\n\n## Project Structure\n```\nsqlmonlit/\n├── app.py            # Main application logic and orchestration\n├── config.py         # Configuration loading and management\n├── database.py       # Database connection and data fetching logic\n├── ui.py             # Streamlit UI components and rendering\n├── config.ini        # Sample configuration file (edit with your DB details)\n├── requirements.txt  # Python dependencies\n└── README.md         # This file\n```\n\n\n## Prerequisites\n- **Python**: 3.8 or higher\n- **SQL Server**: Accessible instances with the following stored procedures:\n  - `usp_SQLMonLit_CPU`\n  - `usp_SQLMonLit_Memory`\n  - `usp_SQLMonLit_Tempdb`\n  - `usp_SQLMonLit_Batch`\n  - `usp_SQLMonLit_Activity`\n- **Dependencies**: Listed in `requirements.txt`\n\n## Installation\n1. **Clone the Repository**: \n   ```bash\n   git clone https://github.com/peandaddy/sqlmonlit.git\n   cd sqlmonlit\n   ```\n2. **Set Up a Virtual Environment (recommended)**: \n    ```python\n    python -m venv venv\n    source venv/bin/activate  # On Windows: venv\\Scripts\\activate\n    ```\n3. **Install Dependencies**: \n    ```python\n    pip install -r requirements.txt\n    ```\n4. **Configure config.ini**: \n*  Copy the sample `config.ini` and edit it with your SQL Server credentials:\n    ```ini\n    [database1]\n    host=your_sql_server_host\n    user=your_username\n    password=your_password\n    database=your_database_name\n    \n    [database2]\n    host=another_sql_server_host\n    user=another_username\n    password=another_password\n    database=another_database_name\n    ```\n* Add as many `[databaseX]` sections as needed.\n\n## Usage\n1. Run the Application:\n    ```bash\n    streamlit run app.py\n    ```\n2. Interact with the Dashboard:\n* Select an instance from the sidebar.\n* View metrics in the tabs (`auto-refreshes every 60 seconds`).\n* Use buttons: \"`Refresh Now`\" (manual update), \"`Stop`\" (pause monitoring), \"`Clear`\" (reset data).\n\n## Configuration\n* Edit `config.ini`: Modify instance details (host, user, password, database).\n* Customize Metrics: Update `SQLMonitorDB.METRICS` in `database.py` to add or change stored procedures.\n* Refresh Interval: Adjust the `60` in `app.py` **`current_time - st.session_state[\"last_update\"] \u003e= 60`** to change the auto-refresh timing.\n\n## Development\n### Adding New Metrics\n1. Add the metric key and stored procedure to `SQLMonitorDB.METRICS` in `database.py`.\n2. Update `render_dashboard` in `ui.py` to display the new metric in a tab.\n### Testing\n1. Install `pytest`: \n    ```python\n    pip install pytest\n    ```\n2. Write tests in a `tests/` directory (not included) to validate `config.py`, `database.py`, etc.\n\n## Contributing\nContributions are welcome!\n\n## License\nThese samples and templates are all licensed under the MIT license. See the `LICENSE` file in the root.\n\n## Author\n* Ji Wang - \u003ca href=\"https://github.com/peandaddy\" target=\"_blank\"\u003ehttps://github.com/peandaddy\u003c/a\u003e\n\nCreated to demonstrate advanced Python, Streamlit, and SQL Server monitoring skills. Contact me for collaboration or inquiries!\n\n## Acknowledgments\n* Built with `Streamlit` and `pymssql`.\n* Inspired by the need for robust SQL Server monitoring tools.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeandaddy%2Fsqlmonlit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeandaddy%2Fsqlmonlit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeandaddy%2Fsqlmonlit/lists"}