This Python script monitors the availability of specified web hosts. It checks the status of URLs and sends notifications through various messaging services if any host is unreachable or returns an error.
- Web Host Monitoring: Regularly checks if specified URLs are accessible.
- Real-time notifications with support for multiple accounts via:
- Telegram
- Discord
- Slack
- Gotify
- Ntfy
- Pushbullet
- Pushover
- Rocket.chat
- Matrix
- Mattermost
- Dynamic Configuration: Load URLs and settings from JSON files.
- Polling Period: Adjustable interval for checking host availability.
- Python 3.x
- Docker installed and running
- Dependencies:
requests
,schedule
git clone https://github.com/2boom-ua/web_check.git
cd web_check
pip install -r requirements.txt
A config.json file in the same directory as the script, and include your API tokens and configuration settings.
{
"TELEGRAM": {
"ON": true,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"CHAT_IDS": [
"first chat_id",
"second chat_id",
"...."
]
},
"DISCORD": {
"ON": false,
"WEBHOOK_URLS": [
"first url",
"second url",
"...."
]
},
"SLACK": {
"ON": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
]
},
"GOTIFY": {
"ON": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"CHAT_WEB": [
"first server_url",
"second server_url",
"...."
]
},
"NTFY": {
"ON": true,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"CHAT_WEB": [
"first server_url",
"second server_url",
"...."
]
},
"PUSHBULLET": {
"ON": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
]
},
"PUSHOVER": {
"ON": true,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"USER_KEYS": [
"first user_key",
"second user_key",
"...."
]
},
"MATRIX": {
"ON": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"SERVER_URLS": [
"first server_url",
"second server_url",
"...."
],
"ROOM_IDS": [
"!first room_id",
"!second room_id",
"...."
]
},
"MATTERMOST": {
"ON": false,
"CHAT_URLS": [
"first server_url",
"second server_url",
"...."
]
},
"ROCKET": {
"ON": false,
"TOKENS": [
"first tocken",
"second tocken",
"...."
],
"USER_IDS": [
"first user_id",
"second user_id",
"...."
],
"SERVER_URLS": [
"first server_url",
"second server_url",
"...."
],
"CHANNELS": [
"#first channel",
"#second channel",
"...."
]
},
"DEFAULT_DOT_STYLE": true,
"MIN_REPEAT": 1
}
Item | Required | Description |
---|---|---|
DEFAULT_DOT_STYLE | true/false | Round/Square dots. |
SEC_REPEAT | 1 | Set the poll period in seconds. Minimum is 1 minute. |
You can set this script to run as a Linux service for continuous monitoring.
Create a systemd service file:
nano /etc/systemd/system/web_check.service
[Unit]
Description=check active hosts
After=multi-user.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/python3 /opt/web_check/web_check.py
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable web_check.service
systemctl start web_check.service
This project is licensed under the MIT License - see the MIT License for details.
- 2boom - GitHub