mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
* feat: add start monitoring remote servers * reafctor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: * refactor: add metrics * feat: add disk monitoring * refactor: translate to english * refacotor: add stats * refactor: remove color * feat: add log server metrics * refactor: remove unused deps * refactor: add origin * refactor: add logs * refactor: update * feat: add series monitoring * refactor: add system monitoring * feat: add benchmark to optimize data * refactor: update fn * refactor: remove comments * refactor: update * refactor: exclude items * feat: add refresh rate * feat: add monitoring remote servers * refactor: update * refactor: remove unsued volumes * refactor: update monitoring * refactor: add more presets * feat: add container metrics * feat: add docker monitoring * refactor: update conversion * refactor: remove unused code * refactor: update * refactor: add docker compose logs * refactor: add docker cli * refactor: add install curl * refactor: add get update * refactor: add monitoring remote servers * refactor: add containers config * feat: add container specification * refactor: update path * refactor: add server filter * refactor: simplify logic * fix: verify if file exist before get stats * refactor: update * refactor: remove unused deps * test: add test for containers * refactor: update * refactor add memory collector * refactor: update * refactor: update * refactor: update * refactor: remove * refactor: add memory * refactor: add server memory usage * refactor: change memory * refactor: update * refactor: update * refactor: add container metrics * refactor: comment code * refactor: mount proc bind * refactor: change interval with node cron * refactor: remove opening file * refactor: use streams * refactor: remove unused ws * refactor: disable live when is all * refactor: add sqlite * refactor: update * feat: add golang benchmark * refactor: update go * refactor: update dockerfile * refactor: update db * refactor: add env * refactor: separate logic * refactor: split logic * refactor: update logs * refactor: update dockerfile * refactor: hide .env * refactor: update * chore: hide ,.ebnv * refactor: add end angle * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update monitoring * refactor: add mount db * refactor: add metrics and url callback * refactor: add middleware * refactor: add threshold property * feat: add memory and cpu threshold notification * feat: send notifications to the server * feat: add metrics for dokploy server * refactor: add dokploy server to monitoring * refactor: update methods * refactor: add admin to useeffect * refactor: stop monitoring containers if elements are 0 * refactor: cancel request if appName is empty * refactor: reuse methods * chore; add feat monitoring * refactor: set base url * refactor: adjust monitoring * refactor: delete migrations * feat: add columns * fix: add missing flag * refactor: add free metrics * refactor: add paid monitoring * refactor: update methods * feat: improve ui * feat: add container stats * refactor: add all container metrics * refactor: add color primary * refactor: change default rate limiting refresher * refactor: update retention days * refactor: use json instead of individual properties * refactor: lint * refactor: pass json env * refactor: update * refactor: delete * refactor: update * refactor: fix types * refactor: add retention days * chore: add license * refactor: create db * refactor: update path * refactor: update setup * refactor: update * refactor: create files * refactor: update * refactor: delete * refactor: update * refactor: update token metrics * fix: typechecks * refactor: setup web server * refactor: update error handling and add monitoring * refactor: add local storage save * refactor: add spacing * refactor: update * refactor: upgrade drizzle * refactor: delete * refactor: uppgrade drizzle kit * refactor: update search with jsonB * chore: upgrade drizzle * chore: update packages * refactor: add missing type * refactor: add serverType * refactor: update url * refactor: update * refactor: update * refactor: hide monitoring on self hosted * refactor: update server * refactor: update * refactor: update * refactor: pin node version
155 lines
3.8 KiB
Markdown
155 lines
3.8 KiB
Markdown
# Dokploy Monitoring (Go Version)
|
|
|
|
Application that powers Dokploy's monitoring service.
|
|
|
|
You can use it for monitoring any external service.
|
|
|
|
## Requirements
|
|
|
|
- Go 1.21
|
|
|
|
## Configuration
|
|
|
|
Create a `.env` file in the root of the project with the following content:
|
|
|
|
```shell
|
|
METRICS_CONFIG='{
|
|
"server": {
|
|
"refreshRate": 25,
|
|
"port": 3001,
|
|
"type": "Remote | Dokploy",
|
|
"token": "metrics",
|
|
"urlCallback": "http://localhost:3000/api/trpc/notification.receiveNotification",
|
|
"retentionDays": 7,
|
|
"cronJob": "0 0 * * *",
|
|
"thresholds": {
|
|
"cpu": 0,
|
|
"memory": 0
|
|
}
|
|
},
|
|
"containers": {
|
|
"refreshRate": 25,
|
|
"services": {
|
|
"include": ["testing-elasticsearch-14649e"],
|
|
"exclude": []
|
|
}
|
|
}
|
|
}'
|
|
```
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
go mod download
|
|
```
|
|
|
|
## Execution
|
|
|
|
```bash
|
|
go run main.go
|
|
```
|
|
|
|
## Endpoints
|
|
|
|
- `GET /health` - Check service health status (no authentication required)
|
|
- `GET /metrics?limit=<number|all>` - Get server metrics (default limit: 50)
|
|
- `GET /metrics/containers?limit=<number|all>&appName=<name>` - Get container metrics for a specific application (default limit: 50)
|
|
|
|
## Features
|
|
|
|
### Server
|
|
|
|
- CPU Usage (%)
|
|
- Memory Usage (%)
|
|
- Disk
|
|
- Network
|
|
- CPU Model
|
|
- Operating System
|
|
- Kernel
|
|
- Architecture
|
|
- Threads
|
|
|
|
Example response:
|
|
|
|
| Field | Value |
|
|
| ------------------ | --------------------------- |
|
|
| timestamp | 2025-01-19T21:44:54.232164Z |
|
|
| cpu | 24.57% |
|
|
| cpu_model | Apple M1 Pro |
|
|
| cpu_cores | 8 |
|
|
| cpu_physical_cores | 1 |
|
|
| cpu_speed | 3228.0 MHz |
|
|
| os | darwin |
|
|
| distro | darwin |
|
|
| kernel | 23.4.0 |
|
|
| arch | arm64 |
|
|
| mem_used | 81.91% |
|
|
| mem_used_gb | 13.11 GB |
|
|
| mem_total | 16.0 GB |
|
|
| uptime | 752232s |
|
|
| disk_used | 89.34% |
|
|
| total_disk | 460.43 GB |
|
|
| network_in | 54.78 MB |
|
|
| network_out | 31.72 MB |
|
|
|
|
### Containers
|
|
|
|
Compatible with all Docker container types (standalone containers, Docker Compose, and Docker Swarm stacks). Note: When monitoring Docker Compose or Swarm stacks, use the `--p` flag to properly identify all services within the stack.
|
|
|
|
Example response:
|
|
|
|
| Field | Value |
|
|
| -------------- | ------------------------------------- |
|
|
| id | 1 |
|
|
| timestamp | 2025-01-19T22:16:30.796129Z |
|
|
| container_id | 7428f5a49039 |
|
|
| container_name | testing-elasticsearch-14649e-kibana-1 |
|
|
|
|
Metrics JSON:
|
|
|
|
```json
|
|
{
|
|
"timestamp": "2025-01-19T22:16:30.796129Z",
|
|
"CPU": 83.76,
|
|
"Memory": {
|
|
"percentage": 0.03,
|
|
"used": 2.262,
|
|
"total": 7.654,
|
|
"usedUnit": "MB",
|
|
"totalUnit": "GB"
|
|
},
|
|
"Network": {
|
|
"input": 306,
|
|
"output": 0,
|
|
"inputUnit": "B",
|
|
"outputUnit": "B"
|
|
},
|
|
"BlockIO": {
|
|
"read": 28.7,
|
|
"write": 0,
|
|
"readUnit": "kB",
|
|
"writeUnit": "B"
|
|
},
|
|
"Container": "7428f5a49039",
|
|
"ID": "7428f5a49039",
|
|
"Name": "testing-elasticsearch-14649e-kibana-1"
|
|
}
|
|
```
|
|
|
|
## Notifications
|
|
|
|
Dokploy uses a callback URL to send notifications when metrics exceed configured thresholds. Notifications are sent via POST request in the following format:
|
|
|
|
Note: Setting a threshold to 0 disables notifications for that metric.
|
|
|
|
```typescript
|
|
interface Notification {
|
|
Type: "Memory" | "CPU";
|
|
Value: number;
|
|
Threshold: number;
|
|
Message: string;
|
|
Timestamp: string;
|
|
Token: string;
|
|
}
|
|
```
|