project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Bug] Cloud Ceph overview shows [OBJECT OBJECT] health and 0/N OSDs up

Open mdobprv-lab opened this issue 3 months ago • 3 comments

Describe the bug

The Cloud → Ceph overview currently has two display problems:

  1. Ceph health is rendered as:
[OBJECT OBJECT]

instead of the actual Ceph health state such as HEALTH_OK.

  1. The OSDs up KPI can show:
0/32

even though all 32 OSDs are up and the cluster is healthy.

Both problems are reproducible on an untouched PegaProx installation. They are not caused by a local customization.

I also checked the current Testing branch and both code paths are still present there.


Root cause

1. Ceph health object is converted directly to a string

In web/src/cloud.js, the Cloud Ceph overview currently does:

const health = (c.status && (c.status.health || c.status.health_status)) || c.health || 'unknown';

const kpis = [
    {
        icon: 'Heart',
        value: String(health).toUpperCase(),
        label: t('cloud.cephHealth') || 'Health',
        accent: /ok|healthy/i.test(String(health)) ? '#22c55e' : '#f59e0b'
    },
    // ...
];

However, Proxmox /nodes/<node>/ceph/status returns health as an object, for example:

{
  "health": {
    "checks": {},
    "mutes": [],
    "status": "HEALTH_OK"
  }
}

Therefore:

String(health)

becomes:

[object Object]

and the UI displays:

[OBJECT OBJECT]

2. Cloud Ceph counts o.up, but the OSD entries use status: "up"

The Cloud overview currently counts OSDs with:

const osdUp = osds.filter(o => o.up === 1 || o.up === true).length;

The backend Ceph overview obtains /nodes/<node>/ceph/osd and passes it through _flatten_osd_tree().

_flatten_osd_tree() copies the OSD dictionaries from the Proxmox CRUSH tree without normalizing a boolean up field:

if ntype == 'osd':
    entry = dict(node)
    if host and not entry.get('host'):
        entry['host'] = host
    out.append(entry)

The existing node Ceph UI already checks the same OSD objects using:

osd.status === 'up'

and:

(data.ceph?.osd || []).filter(o => o.status === 'up').length

This matches the returned OSD structure.

As a result, the Cloud overview can count zero OSDs up even while all OSDs are actually up.

Example observed on a healthy cluster:

Health: HEALTH_OK
OSDs up: 0/32

while all 32 OSDs are operational.


Suggested fix

A small defensive frontend change is enough.

Health

Extract the scalar health status before rendering:

const healthRaw =
    (c.status && (c.status.health || c.status.health_status))
    || c.health
    || 'unknown';

const health =
    healthRaw && typeof healthRaw === 'object'
        ? (healthRaw.status || healthRaw.health_status || 'unknown')
        : healthRaw;

Then use the scalar value:

const healthCode = String(health || 'unknown').toUpperCase();

This correctly renders:

HEALTH_OK

instead of:

[OBJECT OBJECT]

OSD count

Support the OSD status field already used elsewhere in PegaProx:

const osdUp = osds.filter(
    o =>
        String(o.status || '').toLowerCase() === 'up'
        || o.up === 1
        || o.up === true
).length;

Keeping the existing o.up checks as a fallback would also preserve compatibility with any API variant that exposes a boolean/numeric up property.


Steps to reproduce

  1. Connect a Proxmox cluster with Ceph to PegaProx.
  2. Confirm the Ceph cluster itself is healthy and all OSDs are up.
  3. Open:
Cloud → Ceph
  1. Observe the health KPI.
  2. Observe the OSDs up KPI.

Actual result

Example:

Health: [OBJECT OBJECT]
OSDs up: 0/32

Expected result

For the same healthy cluster:

Health: HEALTH_OK
OSDs up: 32/32

Additional verification

The issue is visible on an untouched PegaProx instance as well, so this is not a regression caused by local translation/customization work.

The current Testing branch still contains:

const osdUp = osds.filter(o => o.up === 1 || o.up === true).length;

const health =
    (c.status && (c.status.health || c.status.health_status))
    || c.health
    || 'unknown';

value: String(health).toUpperCase()

The backend also still returns flattened CRUSH-tree OSD entries without adding a normalized up boolean.


Environment

  • PegaProx Version: 1.0.2
  • UI: Cloud / Modern layout
  • Proxmox VE: clustered environment with Ceph
  • Ceph state during reproduction: healthy (HEALTH_OK)
  • OSDs during reproduction: 32/32 operational

The problem was also verified against the current Testing source.


Checklist

  • [x] I searched existing open issues for the same Cloud Ceph health / OSD display problem
  • [x] The issue is reproducible on an untouched PegaProx instance
  • [x] The relevant frontend and backend code paths were inspected
  • [x] A minimal fix was tested locally

mdobprv-lab avatar Aug 27 '26 05:08 mdobprv-lab

Textbook report — root cause, exact lines, and a clean fix, all correct. Confirmed both on Testing:

  1. /ceph/status returns health as an object ({checks, mutes, status: 'HEALTH_OK'}), so String(health) was rendering [object Object].
  2. The flattened CRUSH-tree OSD entries carry status: 'up' (which the node + datacenter Ceph views already key on), not a boolean up, so the Cloud overview counted 0.

Fixed on Testing exactly along your suggestion — pull the scalar out of the health object before rendering, and count o.status === 'up' with the old o.up kept as a fallback for any API variant. Verified against your example (object health + 32 status:'up' OSDs) → HEALTH_OK / 32/32, and the legacy boolean-up path still counts correctly.

Thanks for the precise write-up and for checking it against current Testing — made this a five-minute fix.

mkellermann97 avatar Aug 27 '26 07:08 mkellermann97

Confirmed on a real Ceph cluster after updating to the current Testing code — the fix works correctly.

Health is now rendered properly (OK in the localized UI), all 32/32 OSDs are detected as active, and monitors/pools are reported correctly as well.

Thanks for the quick fix!

And as a small preview: the screenshot below is from the Polish localization currently being tested. 🙂

Image

mdobprv-lab avatar Aug 27 '26 09:08 mdobprv-lab

Perfect — thanks for confirming on real Ceph hardware (32/32, health, monitors, pools all correct). Closing this out; it'll go out with the next release. And nice, looking forward to the Polish localisation. 🙂

mkellermann97 avatar Aug 27 '26 13:08 mkellermann97