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.jsonfile. - 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
.debpackage 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-agentsudo systemctl stop webalert-agentsudo systemctl status webalert-agentsudo systemctl restart webalert-agentsudo tail -f /var/log/webalert-agent/agent.logRun the binary directly to view metrics:
webalert-agent -m cpu
webalert-agent -m memory
webalert-agent -m diskWe 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