fix(checkmk): add diagnostic log to compare config vs monitoring host IDs
This commit is contained in:
@ -757,6 +757,13 @@ async function startServer() {
|
|||||||
const state: number | undefined = host?.extensions?.state;
|
const state: number | undefined = host?.extensions?.state;
|
||||||
if (name !== undefined && state !== undefined) hostnameToState.set(name, state);
|
if (name !== undefined && state !== undefined) hostnameToState.set(name, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Diagnostic: log a sample so mismatches between config and monitoring IDs are visible
|
||||||
|
const cfgSample = [...ipToHostname.values()].slice(0, 3).join(', ');
|
||||||
|
const monSample = [...hostnameToState.keys()].slice(0, 3).join(', ');
|
||||||
|
db.prepare('INSERT INTO logs (id, timestamp, type, message) VALUES (?, ?, ?, ?)')
|
||||||
|
.run(uid('log'), now, 'system',
|
||||||
|
`CheckMK diagnostic — config hosts (${ipToHostname.size}): [${cfgSample}] | monitoring hosts (${hostnameToState.size}): [${monSample}]`);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
const msg = `CheckMK sync failed — could not fetch monitoring states: ${err?.message ?? err}`;
|
const msg = `CheckMK sync failed — could not fetch monitoring states: ${err?.message ?? err}`;
|
||||||
console.error('[CheckMK]', msg);
|
console.error('[CheckMK]', msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user