Cost Insights

How ServerBee turns billing fields, renewal schedules, and agent metrics into burn rate, per-resource unit cost, and objective cost advisories.

ServerBee combines admin-entered billing fields (price, billing_cycle, currency, billing_start_day, expired_at, traffic_limit, traffic_limit_type, and optional automatic renewal settings) with the resource capacity, utilization, and uptime each agent reports, then derives a set of objective cost signals: burn rate, per-resource unit cost, and per-server advisories. These appear in the server list (/servers), the dashboard server-cards widget in list layout (grid-layout <ServerCard> tiles omit cost figures), the cost panel on the server detail page, and the native iOS app (CostInsightsCard and fleet roll-ups in Insights).

To learn how to enter billing data in the UI, see the Billing Information section in the admin guide.

Derived outputs

Two read-only endpoints expose derived cost data:

  • GET /api/cost/overview returns fleet-wide per-currency totals under currencies (currency, configured_server_count, monthly_equivalent_total, daily_total, cycle_elapsed_total) plus a compact ServerCostOverview per server (omitting cycle_cost_remaining and resource_value).
  • GET /api/servers/{id}/cost-insights returns the full ServerCostInsights object for one server, including cycle dates, price, cycle_cost_remaining, and resource_value.
FieldExposed onMeaning
configuredBothWhether the server has a valid billing configuration
pricecost-insightsConfigured cycle price
currencyBothBilling currency code (defaults to USD when unset or blank)
billing_cycleBothNormalized cycle (monthly, quarterly, or yearly)
cycle_start / cycle_endcost-insightsInclusive calendar start and end dates (YYYY-MM-DD) of the current billing cycle
cycle_days / days_elapsedcost-insightsTotal calendar days in the current cycle and days elapsed so far
days_remainingBothCalendar days left in the current billing cycle (cycle_days - days_elapsed)
cost_per_day / cost_per_hour / cost_per_secondBothprice divided by actual calendar cycle_days, then by 24 and 3600
cost_per_month_equivalentBothCost normalized by month count (monthly = price, quarterly = price / 3, yearly = price / 12)
cycle_cost_elapsedBothMoney amortized so far in the current cycle (cost_per_day * days_elapsed)
cycle_cost_remainingcost-insightsRemaining money in the current cycle (max(price - cycle_cost_elapsed, 0))
cycle_burn_percentBothElapsed portion of the cycle as a percentage (null when price == 0)
resource_value.cost_per_cpu_corecost-insightsMonthly-equivalent unit cost per CPU core
resource_value.cost_per_gb_memorycost-insightsMonthly-equivalent unit cost per GiB (1024^3 bytes) of memory
resource_value.cost_per_gb_diskcost-insightsMonthly-equivalent unit cost per GiB (1024^3 bytes) of disk
resource_value.cost_per_tb_traffic_limitcost-insightsMonthly-equivalent cost per TiB (1024^4 bytes) of traffic_limit, when configured with a valid traffic_limit_type (sum, up, down, or unset)
resource_value.traffic_limit_typecost-insightsConfigured traffic accounting mode (sum, up, down), if any
advisoriesBothObjective per-server warnings (see below); an empty array when nothing applies
invalid_reasonBothPopulated instead of cost fields when billing fields fail validation

ServerBee deliberately does not compute a single composite "value score". A server's cost-effectiveness is best judged from the objective unit costs above (which need no fleet comparison) plus the actionable advisories below, not from an opaque 0-100 number that conflates unrelated dimensions.

Input validation

The cost breakdown is skipped when any of the following are true. The reason is surfaced via invalid_reason so the UI can flag the entry rather than silently treating it as configured:

invalid_reasonTrigger
missing_priceprice is NULL
missing_billing_cyclebilling_cycle is NULL or empty
invalid_billing_cyclebilling_cycle is not in the recognized set (monthly, quarterly, yearly)
invalid_priceprice < 0 or NaN

When currency is omitted or empty, it defaults to USD.

price == 0 is treated as a valid "free server" entry: monetary rates and elapsed/remaining amounts are 0.0, cycle_burn_percent is null, and the server never raises idle_burn or sleeping_money advisories (which only apply when money is being spent).

Automatic Renewal Tracking & Billing Calendar

Servers support opt-in automatic renewal tracking via the renewal object on POST /api/servers, PUT /api/servers/{id}, and GET /api/servers/{id}.

  • Billing calendar & timezone: Clients submit a calendar date (renewal.expiry_date as YYYY-MM-DD) together with an IANA renewal.billing_timezone (defaults to UTC), rather than computing UTC boundaries on the client. ServerBee converts the date to the end-of-day boundary in that timezone. Submitting renewal.expiry_date together with legacy expired_at is rejected.
  • Prerequisites: Enabling renewal.enabled = true requires an expiry date, a valid IANA billing_timezone, and a monthly, quarterly, or yearly billing_cycle.
  • Response fields (RenewalProjection): enabled, billing_timezone, expiry_date, confirmed_expired_at, deadline_origin, and occurrence_id.
  • deadline_origin lifecycle:
    • confirmed: An operator explicitly set or confirmed the expiry date (with automatic renewal off).
    • projected: Automatic renewal is enabled. When the deadline passes, ServerBee advances it by 1, 3, or 12 months while preserving the original anchor day (clamping to the last day of shorter months, such as 31st to 28th/29th in February, without losing the anchor for subsequent cycles).
    • frozen: Automatic renewal was turned off after a deadline had been projected; the projected date stays frozen in place until an operator confirms a new date.
  • Offline catch-up: If the Server is offline across multiple billing periods, catch-up jumps directly to the first unexpired occurrence while keeping the original anchor day. Historical missed periods are never emitted as separate occurrences.
  • Decoupled from cost cycle burn: Renewal tracking governs expiry dates and renewal reminders, whereas cost cycle burn (cycle_start / cycle_end) is computed independently from billing_cycle and billing_start_day.

Automatic renewal tracking is a calendar forecast only. A projected deadline does not confirm that your hosting provider actually charged your payment method or renewed the server.

Cost advisories

Each advisory is an objective fact about a single server, computed without any fleet comparison, so it is meaningful even for a one-server deployment. They are emitted in the priority order below and rendered as warning chips next to the cost figures.

AdvisoryTriggerWhat it suggests
expired_billingexpired_at is in the pastRenew before you lose the host
sleeping_moneyOffline, with no recent samples, while paying a non-zero billInvestigate why a paid host is down
idle_burnResources idle (avg CPU < 5%, avg memory < 20%, no real network/disk I/O over the last 24h) while paying a non-zero billConsider downsizing or consolidating
low_uptime30-day uptime ratio below 90%Investigate reliability

sleeping_money and idle_burn are mutually exclusive: "sleeping" requires the absence of recent samples, while "idle" requires the low-usage samples that prove the host was recently alive.

Data sources and refresh cadence

  • Advisories and cost figures are computed on demand by the server; there is no persisted cache
  • Utilization averages come from the records table (the same table the monitoring charts use), 24h lookback (RECORD_LOOKBACK_HOURS). Network activity is judged from per-window throughput rates, not the cumulative byte counters
  • Uptime ratio is aggregated from uptime_daily over a 30-day lookback (UPTIME_RECENT_DAYS)
  • Resource capacity (CPU cores / total memory / total disk) comes from each agent's last SystemInfo; the last known value is reused while the agent is disconnected

Known limitations

  • Per-resource unit costs are absolute (cost ÷ capacity); they are not ranked against other servers, so judging "cheap vs. expensive" is left to you
  • idle_burn inspects CPU + memory + I/O activity, not application-level usefulness. A host that is up but doing nothing useful while its CPU/RAM are idle reads as idle
  • cost_per_tb_traffic_limit is omitted when traffic_limit is missing or traffic_limit_type is outside sum / up / down
  • cost_per_month_equivalent divides directly by calendar month count (1 for monthly, 3 for quarterly, 12 for yearly), whereas cost_per_day divides by actual calendar cycle_days in the current cycle
  • Memory, disk, and traffic unit costs use binary GiB (1024^3 bytes) and TiB (1024^4 bytes) denominators even though the JSON field names use gb and tb
  • On dashboards, the server-cards widget renders cost figures only in list layout; grid layout cards omit cost data