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.
![Screenshot 2023-10-03 at 5 54 50 PM](https://private-user-images.githubusercontent.com/97563979/272407849-e841349c-bdc1-4134-8754-ddf6f5bc439b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI4Njk0NDgsIm5iZiI6MTcyMjg2OTE0OCwicGF0aCI6Ii85NzU2Mzk3OS8yNzI0MDc4NDktZTg0MTM0OWMtYmRjMS00MTM0LTg3NTQtZGRmNmY1YmM0MzliLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA1VDE0NDU0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQzZTIxMjYwNDQ0MzQxZDU1NjhjYjUwNmZiMDkyMmE1YmM1YmY2NTc0NjY4MzdmYjdlNzZjYjhlYjNkYWY4NDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.wqBC46TMbvzDzbQgNQp1p-G6Cf3uQO0TBpX-vlKIe1E)
-
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.
git clone https://github.com/JoshCap20/health-checks.git
cd health_checker
pip install -r requirements.txt
To monitor a single URL:
python main.py --urls "https://example.com"
To monitor both URLs and databases:
python main.py --modules "ping,db" --urls "https://example.com,https://another-example.com" --dbs "your_database_connection_string"
-
--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 areping
,db
, and more to be added later. Default isping
. -
--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.
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:
{
"alerts": {
"email": {
"active": true,
"to_email": "your_email@gmail.com",
"smtp_server": "smtp.gmail.com",
"smtp_port": 587,
"smtp_user": "your_smtp_user@gmail.com",
"smtp_pass": "your_password",
"alert_level": "WARNING"
},
"telegram": {
"active": true,
"bot_token": "bot_token",
"user_id": "user_id",
"alert_level": "INFO"
}
}
}
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.
Pull requests are welcome. For significant changes, please open an issue first to discuss what you would like to change.