Sitechecks/README.md
hax 4ec0df6b41 Hello README! :D
Signed-off-by: hax <hax@lainlounge.xyz>
2025-01-05 13:28:40 +00:00

108 lines
No EOL
3.1 KiB
Markdown

# 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
Download the installation script install_monitor_service.sh and place it on your system.
#### 2. Make the installation script executable
```bash
chmod +x install_monitor_service.sh
```
#### 3. Run the installation script
Execute the script to install the service, configuration files, and necessary setup:
```bash
sudo ./install_monitor_service.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/website-monitor/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:
```bash
sudo systemctl status website-monitor
```
#### View logs
Logs are stored in /var/log/website-monitor.log. You can view them with:
```bash
sudo tail -f /var/log/website-monitor.log
```
#### Restart the service
To restart the monitoring service:
```bash
sudo systemctl restart website-monitor
```
#### Disable the service
If you want to stop the service from starting at boot:
```bash
sudo systemctl disable website-monitor
```
#### Manual website check via Telegram (optional)
You can manually check the status of a website by sending a /check <url> 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.