https://github.com/joshcap20/health-checks
A comprehensive monitoring tool designed to assess and send notifications about the health of specified URLs and database connections.
https://github.com/joshcap20/health-checks
application-health application-healthchecks health-check
Last synced: 3 months ago
JSON representation
A comprehensive monitoring tool designed to assess and send notifications about the health of specified URLs and database connections.
- Host: GitHub
- URL: https://github.com/joshcap20/health-checks
- Owner: JoshCap20
- Created: 2023-10-03T16:10:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-03T22:03:16.000Z (over 1 year ago)
- Last Synced: 2025-02-02T08:42:18.924Z (5 months ago)
- Topics: application-health, application-healthchecks, health-check
- Language: Python
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Health Checker Tool
A comprehensive monitoring tool designed to assess and send notifications about the health of specified URLs and database connections. With the flexibility to perform simple ping checks, database connection tests, and the ability to customize response times, this tool ensures you are always informed about the status of your services and databases.
## Features
- **Ping Check**: Verifies if a URL is reachable and logs the status.
- **Database Connection Check**: Tests the connection to a given database and logs the response time.- **Custom Response Time Thresholds**: Define your own thresholds for warning and error response times.
- **Wi-Fi Connectivity Check**: Continuously checks for Wi-Fi connectivity and pauses the health checks if disconnected.- **Alerts**: Configurable alerts (like email notifications and telegram) based on specific log levels to keep you informed.
## Installation
```bash
git clone https://github.com/JoshCap20/health-checks.git
cd health_checker
pip install -r requirements.txt
```## Usage
To monitor a single URL:
```bash
python main.py --urls "https://example.com"
```To monitor both URLs and databases:
```bash
python main.py --modules "ping,db" --urls "https://example.com,https://another-example.com" --dbs "your_database_connection_string"
```### Command-Line Arguments
- `--ping-timeout`: Specify the ping timeout in seconds (default: 180 seconds).
- `--urls`: A comma-separated list of URLs you want to monitor.
- `--dbs`: A comma-separated list of database connection strings you want to check.
- `--modules`: Modules to be used for health checking. Available options are `ping`, `db`, and more to be added later. Default is `ping`.
- `--error-response-time`: Set the minimum acceptable response time in seconds. Any response slower than this will trigger an error. Default is 2 seconds.
- `--warning-response-time`: Set the response time threshold for warnings. Any response slower than this but faster than the error-response-time will trigger a warning. Default is 1 second.### Alert Configuration
Alerts are configurable through `config.json`. You can set up various alert types, such as email notifications.
For instance, to set up an email alert:
```json
{
"alerts": {
"email": {
"active": true,
"to_email": "[email protected]",
"smtp_server": "smtp.gmail.com",
"smtp_port": 587,
"smtp_user": "[email protected]",
"smtp_pass": "your_password",
"alert_level": "WARNING"
},
"telegram": {
"active": true,
"bot_token": "bot_token",
"user_id": "user_id",
"alert_level": "INFO"
}
}
}
```## Expansion
The architecture of this tool is modular, allowing for seamless expansion with additional health checks or alert methods. New checks can be added in the `checks` directory, and new alert methods in the `alerts` directory.
## Contributing
Pull requests are welcome. For significant changes, please open an issue first to discuss what you would like to change.
## License
[MIT](https://choosealicense.com/licenses/mit/)