A lightweight system monitoring agent designed to run on your server, collect vital database stats and help in database installation .
This project provides a complete solution for provisioning, monitoring, and cleaning up a server with a standard database stack (MySQL, PostgreSQL, MongoDB). It consists of two main parts:
init.sh script on a fresh server. It installs the databases, configures them for remote access, and starts the monitoring agent as a system service.cleanup_database_server.sh script to wipe all related software and configurations, leaving the system clean.root or sudo access.To set up your server, run the following command:
curl -sL https://raw.githubusercontent.com/bonheur15/mydbportal-agent/main/init.sh | bash
This will download and execute the setup script, which handles the entire installation process automatically.
The agent exposes a single endpoint to fetch system statistics.
GET /stats7723 (or as configured by the AGENT_PORT environment variable)agent_token header.Example Request:
curl -X GET http://<your-server-ip>:7723/stats \
-H "Content-Type: application/json" \
-H "agent_token: your-secret-agent-token"
To completely remove the agent and all database services from your server, run the cleanup script:
curl -sL https://raw.githubusercontent.com/bonheur15/mydbportal-agent/main/cleanup_database_server.sh | bash
Warning: This is a destructive operation and will permanently delete all data.
The agent is configured using environment variables, which are set automatically by the init.sh script in the database-agent.service file.
AGENT_PORT: The port for the agent to listen on. Defaults to 7723.AGENT_TOKEN: The secret token for authenticating API requests. Defaults to your-secret-agent-token.To run the agent locally for development:
git clone https://github.com/bonheur15/mydbportal-agent.git
cd mydbportal-agent
bun install
bun run dev
The server will start with hot-reloading on http://localhost:7723.
To compile the agent into a standalone executable:
bun run build
The compiled binary will be located in out/linux-x64.
Contributions are welcome! If you have a feature request or find a bug, please open an issue on the Contributing Guide.
This project is licensed under the MIT License.