System Information

System Information API

The System Information API provides endpoints to monitor system performance, resource usage, and historical data for your PoloCloud instance.

Monitor system performance, resource usage, and historical data via REST API

Version

Get the current PoloCloud version.

Endpoint: GET /polocloud/api/v3/system/version

Response:

{
  "status": 200,
  "data": {
    "version": "3.0.0"
  }
}

Current Information

Get real-time system information including CPU and memory usage.

Endpoint: GET /polocloud/api/v3/system/information

Response:

{
  "status": 200,
  "data": {
    "cpuUsage": {
      "polocloud": 1.02,
      "services": 0.28,
      "total": 1.3
    },
    "memoryUsage": {
      "polocloud": 62.0,
      "services": 3905.0,
      "total": 3967.0
    },
    "runtime": "Local",
    "uptime": 2789697
  }
}

Average Information

Get average system metrics over a specified time period.

Endpoint: GET /polocloud/api/v3/system/information/average

Query Parameters:

  • from (optional) - Start timestamp (default: 0)
  • to (optional) - End timestamp (default: current time)

Response:

{
  "status": 200,
  "data": {
    "avgCpu": {
      "polocloud": 12.5,
      "services": 38.2,
      "total": 50.7
    },
    "avgRam": {
      "polocloud": 1024.0,
      "services": 1956.8,
      "total": 2980.8
    },
    "from": 1640995200000,
    "to": 1641081600000
  }
}

Historical Data

Minutes Data

Get system metrics averaged by minute.

Endpoint: GET /polocloud/api/v3/system/information/minutes

Query Parameters:

  • from (optional) - Start timestamp (default: 0)
  • to (optional) - End timestamp (default: current time)

Response:

{
  "status": 200,
  "data": [
    {
      "timestamp": 1640995200000,
      "avgCpu": 45.2,
      "avgRam": 2048.5
    },
    {
      "timestamp": 1640995260000,
      "avgCpu": 48.7,
      "avgRam": 2156.3
    }
  ]
}

Hours Data

Get system metrics averaged by hour.

Endpoint: GET /polocloud/api/v3/system/information/hours

Query Parameters:

  • from (optional) - Start timestamp (default: 0)
  • to (optional) - End timestamp (default: current time)

Response:

{
  "status": 200,
  "data": [
    {
      "timestamp": 1640995200000,
      "avgCpu": 42.8,
      "avgRam": 1987.2
    },
    {
      "timestamp": 1640998800000,
      "avgCpu": 46.3,
      "avgRam": 2103.7
    }
  ]
}

Days Data

Get system metrics averaged by day.

Endpoint: GET /polocloud/api/v3/system/information/days

Query Parameters:

  • from (optional) - Start timestamp (default: 0)
  • to (optional) - End timestamp (default: current time)

Response:

{
  "status": 200,
  "data": [
    {
      "timestamp": 1640995200000,
      "avgCpu": 44.1,
      "avgRam": 2015.8
    },
    {
      "timestamp": 1641081600000,
      "avgCpu": 47.9,
      "avgRam": 2134.2
    }
  ]
}

Usage Examples

Get Version

curl -X GET "http://localhost:8080/polocloud/api/v3/system/version"

Get Current System Information

curl -X GET "http://localhost:8080/polocloud/api/v3/system/information"

Get Average Metrics (Last 24 Hours)

# Get current timestamp minus 24 hours
FROM=$(($(date +%s) * 1000 - 86400000))
TO=$(($(date +%s) * 1000))

curl -X GET "http://localhost:8080/polocloud/api/v3/system/information/average?from=$FROM&to=$TO"

Get Historical Data (Last 7 Days)

# Get current timestamp minus 7 days
FROM=$(($(date +%s) * 1000 - 604800000))
TO=$(($(date +%s) * 1000))

# Get daily averages
curl -X GET "http://localhost:8080/polocloud/api/v3/system/information/days?from=$FROM&to=$TO"

# Get hourly averages
curl -X GET "http://localhost:8080/polocloud/api/v3/system/information/hours?from=$FROM&to=$TO"

Data Models

System Information Response

FieldTypeDescription
cpuUsage.polocloudnumberPoloCloud core CPU usage (%)
cpuUsage.servicesnumberAll services combined CPU usage (%)
cpuUsage.totalnumberTotal system CPU usage (%)
memoryUsage.polocloudnumberPoloCloud core memory usage (MB)
memoryUsage.servicesnumberAll services combined memory usage (MB)
memoryUsage.totalnumberTotal system memory usage (MB)
runtimestringJava runtime version
uptimenumberSystem uptime in milliseconds

Historical Data Response

FieldTypeDescription
timestampnumberUnix timestamp in milliseconds
avgCpunumberAverage CPU usage (%)
avgRamnumberAverage memory usage (MB)

Permissions

All system information endpoints require the following permissions:

  • polocloud.system.version - Access to version information
  • polocloud.system.information - Access to system metrics and historical data

Monitoring Integration

Grafana Dashboard

Use these endpoints to create Grafana dashboards:

{
  "dashboard": {
    "title": "PoloCloud System Metrics",
    "panels": [
      {
        "title": "CPU Usage",
        "type": "graph",
        "targets": [
          {
            "expr": "polocloud_cpu_usage",
            "legendFormat": "PoloCloud Core"
          },
          {
            "expr": "services_cpu_usage", 
            "legendFormat": "Services"
          }
        ]
      }
    ]
  }
}

Prometheus Metrics

Convert REST API data to Prometheus format:

# Example script to convert to Prometheus metrics
curl -s "http://localhost:8080/polocloud/api/v3/system/information" | \
jq -r '.data | "polocloud_cpu_usage \(.cpuUsage.polocloud)\npolocloud_memory_usage \(.memoryUsage.polocloud)"'