It's a Python script that checks whether your sites are up or down
This project is using the Python requests module to connect to your site (or sites) and check if your site(s) is up or down, and if down - logs this to a TinyDB database and e-mails you. It also updates a web page front end with basic info.
I run the script on a Raspberry Pi, uploading the php-files the script generates to my web server.
Disclaimer! I'm just a cowboy builder when it comes to coding. I'm not a coder, just a tinkerer. As long as it works...
- The script tries to connect to your site (or sites) if it's connected to the internet.
- If site(s) is down - it logs the site with the error in the database and sends you an e-mail.
- PHP page status.php is updated and sent via sftp to your server.
- Repeat.
- If site(s) that have been down is up again, script logs that to the databaase and sends you an e-mail.
Modules
pip3 install
pyyaml, tinydb, email, smtplib, paramiko
Web site and server
You need a domain and a web server that the script can upload the frontend php-files to, via sftp.
- Save the files main.py, config.xml and the folder named 'web', containing the file 'status.php' on the machine that will be running the script.
- Upload the files index.php and style.css to your web server.
- Edit config.xml and add your info such as file paths, sftp- and e-mail account and more.
- Run ping.py
Rewritten version of the script.
Bug fix - frontend showing latest errors displayed the last errored url on all three lines.
Minor updates.
Updated mainping.py and moved server paths and sites to monitor to credentials.xml
Initial upload. Everything works as the flow above describes.
This README.md lacks a lot. :)