3.1 KiB
Website Monitoring Service
This project provides an automated service for monitoring websites, checking their HTTP status codes, and sending notifications when websites are down. The service is installed as a Systemd service and runs in the background, periodically checking the status of websites listed in a configuration file. Features
- Monitor multiple websites for availability.
- Log the status of websites to a log file.
- Send notifications (via Telegram or other methods) when a website is down.
- Installed as a Systemd service for automatic startup and management.
- Configurable via a JSON file to easily add and manage URLs.
Prerequisites
- Linux-based system with Systemd support.
- curl installed (for website monitoring).
- jq installed (for parsing JSON configuration).
- Telegram bot setup (if using Telegram notifications).
Installation
To install and set up the website monitoring service, follow these steps:
1. Clone or download the project files
Clone the project sitechecks.sh or sitechecks-installer.sh and place it on your system.
2. Make the installation script executable
chmod +x sitechecks-installer.sh
3. Run the installation script
Execute the script to install the service, configuration files, and necessary setup:
sudo ./sitechecks-installer.sh
This will:
- Install the website monitoring script.
- Create the sites.json configuration file.
- Set up a Systemd service for the monitoring process.
- Start the service and enable it to run at boot.
4. Customize the configuration file
Edit the sites.json file located at /etc/sitechecks/sites.json to include the websites you want to monitor:
{
"urls": [
"https://example.com",
"https://example.org"
]
}
You can add as many URLs as you like to the list.
5. Configure Telegram notifications (optional)
If you want to receive Telegram notifications when a website is down, you'll need to:
- Set up a Telegram bot and get the bot token.
- Set your Telegram chat ID.
Add the token and chat ID to the monitoring script (website_monitor.sh).
Managing the Service
After installation, the monitoring service will automatically start. You can manage the service with the following Systemd commands: Check the status of the service:
sudo systemctl status sitechecks
View logs
Logs are stored in /var/log/sitechecks.log. You can view them with:
sudo tail -f /var/log/sitechecks.log
Restart the service
To restart the monitoring service:
sudo systemctl restart sitechecks
Disable the service
If you want to stop the service from starting at boot:
sudo systemctl disable sitechecks
Manual website check via Telegram (optional)
You can manually check the status of a website by sending a /check command to the Telegram bot. The bot will respond with the HTTP status and description for the provided URL.
License
This project is open-source and available under the AGPL License. See the LICENSE file for more details.