Artica Wiki

Monitoring ActiveDebianSync via API REST

All commands to monitor or manage the daemon

Main endpoints

Answer :

{
  "status": "running",
  "uptime": "2h15m30s",
  "version": "1.0.0",
  "sync_stats": {
      "total_files": 1523,
      "total_bytes": 2147483648,
      "failed_files": 0,
      "last_sync_start": "2024-01-15T10:00:00Z",
      "last_sync_end": "2024-01-15T10:45:00Z",
      "last_sync_duration": "45m0s",
      "is_running": false
  },
  "server_stats": {
      "total_requests": 8432,
      "total_bytes_sent": 5368709120,
      "active_clients": 3
  },
  "disk_space": {
      "total_bytes": 107374182400,
      "used_bytes": 21474836480,
      "free_bytes": 85899345920,
      "used_percent": 20.0
  },
  "updates_available": false,
  "repository_size_bytes": 2147483648,
  "clients": [...]
}
 

Answer:

[
  {
      "ip": "192.168.1.100",
      "hostname": "client1.example.com",
      "first_seen": "2024-01-15T10:00:00Z",
      "last_seen": "2024-01-15T12:30:00Z",
      "request_count": 45,
      "bytes_received": 524288000
  }
]

Answer:

{
  "updates_available": true,
  "checked_at": "2024-01-15T12:00:00Z"
}

Trigger a synchronization

curl -X POST http://127.0.0.1:9090/api/sync/trigger

Synchronization history

GET /api/console/events
Returns recent sync events.

Parameters: 

Example:

curl "http://localhost:8081/api/console/events?limit=50&repository=debian/bookworm"

Response:

{
  "count": 25,
  "events": [
      {
          "id": 1,
          "date": "2025-01-15T04:30:00Z",
          "num_files": 1500,
          "num_size": 2500000000,// Bytes
          "repository_name": "debian/bookworm",
          "duration_ms": 180000,
          "failed_files": 0
      }
  ]
}

GET /api/console/events/stats
Returns aggregated statistics per repository.

Response:
{
    "total_count": 150,
    "stats": [
        {
            "repository_name": "debian/bookworm",
            "total_syncs": 50,
            "total_files": 75000,
            "total_size": 125000000000,
            "avg_duration_ms": 180000,
            "total_failed": 10,
            "last_sync": "2025-01-15T04:30:00Z"
        },
        {
            "repository_name": "ubuntu/jammy",
            "total_syncs": 50,
            "total_files": 80000,
            "total_size": 140000000000,
            "avg_duration_ms": 200000,
            "total_failed": 5,
            "last_sync": "2025-01-15T04:30:00Z"
        }
    ]
}

GET /api/console/events/daily
Returns daily summary of sync events.
 

Parameters:

Example:

curl "http://localhost:8081/api/console/events/daily?days=15"

Response:

{
    "days": 15,
    "summary": [
        {
            "date": "2025-01-15",
            "sync_count": 4,
            "total_files": 6000,
            "total_size": 10000000000,
            "total_failed": 2
        }
    ]
}