The WebAlert Agent is a lightweight monitoring tool designed to collect system metrics. It provides essential insights to ensure optimal system reliability and website uptime.
- System Metrics Monitoring: Collects CPU usage, memory consumption, and disk utilization.
- Configurable: Easily set up using a
/etc/webalert-agent/config.json
file. - Secure Communication: Sends data to your centralized instance API over HTTPS.
- Systemd Integration: Runs as a service on Linux-based systems (Ubuntu/Debian).
- Flexible Logging: Stores logs in
/var/log/webalert-agent/
to easy debug.
- Linux-based system (Ubuntu/Debian)
- Go ^1.23.2 (for building from source)
- Download the latest
.deb
package from the Releases. - Install the package:
sudo dpkg -i webalert-agent-latest.deb
- Verify installation:
systemctl status webalert-agent
- Init modules:
go mod init webalert-agent
- Install dependencies:
go get github.com/shirou/gopsutil/cpu go get github.com/shirou/gopsutil/mem go get github.com/shirou/gopsutil/disk go mod tidy
- Build the binary:
go build -o ./usr/local/bin/webalert-agent main.go
- Copy the binary to
/usr/local/bin
:sudo cp webalert-agent /usr/local/bin/
- Set up the service:
sudo cp webalert-agent.service /etc/systemd/system/ sudo systemctl enable webalert-agent sudo systemctl start webalert-agent
- Create the directory for logging:
mkdir /var/log/webalert-agent
Create a config.json
file in /etc/webalert-agent/
with the following structure, you can add one or multiple sites:
- One site example:
{
"email": "your_user_app",
"password": "your_password_app",
"api_uri": "https://api.webalert.digital",
"siteName": ["https://yoursite.com"]
}
- Two or more sites example:
{
"email": "your_user_app",
"password": "your_password_app",
"api_uri": "https://api.webalert.digital",
"siteName": ["https://yoursite.com","https://yoursecond.com"]
}
sudo systemctl start webalert-agent
sudo systemctl stop webalert-agent
sudo systemctl status webalert-agent
sudo systemctl restart webalert-agent
sudo tail -f /var/log/webalert-agent/agent.log
Run the binary directly to view metrics:
webalert-agent -m cpu
webalert-agent -m memory
webalert-agent -m disk
We welcome contributions! Please follow these steps:
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For issues or feature requests, please open an issue in the GitHub repository.
WebAlert Agent © 2024