Skip to content

A Python script for monitoring a bunch of local and public URLs and sending notifications via Discord.

License

Notifications You must be signed in to change notification settings

bjoerrrn/monitor-urls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

stars last_commit

Monitor URLs

This script monitors a list of URLs, checking if they are reachable. If a URL fails 5 times, a notification is sent to a Discord webhook.

Features

  • Checks HTTP/HTTPS URLs for reachability.
  • Can verify if a specific keyword exists on the page.
  • Alerts are sent to different Discord webhooks per URL.
  • Configured via a .credo file.
  • Runs automatically via crontab on a Raspberry Pi.

Setup & Installation

1️⃣ Install Dependencies

On a Raspberry Pi, run:

sudo apt update
sudo apt install python3 python3-pip -y
pip install requests beautifulsoup4 urllib3

2️⃣ Clone This Repository

git clone https://github.com/bjoerrrn/monitor-urls
   cd monitor-urls

3️⃣ Configure Your Script

Open monitor_urls.credo (needs to be in the same folder as the script) and set:

# Description       URL         Webhook_URL                   Optional_Keyword
"test"              http://...  https://...                   "test"

4️⃣ Run the Script

Manual Execution

python3 monitor_urls.py

Run Every Minute with Crontab

crontab -e

Add the following line at the bottom:

* * * * * /usr/bin/python3 /home/pi/monitor-urls/monitor_urls.py

Save and exit.

📡 Expected Output

📢 Discord Notifications

❌ {url} DOWN" → Sent when URL is unreachable.
⚠️ {url} MISSING '{keyword}'" → Sent when keyword check fails.
✅ {url} UP" → Sent when a previously failing URL recovers.

🤝 Contributing

Feel free to open issues or pull requests to improve the script! 🚀

if you want to contact me directly, feel free to do so via discord: https://discordapp.com/users/371404709262786561

📜 License

This project is open-source under the GPL-3.0 License.