{$hostnameDisplay} since {$previousDisplay}
";
$issueCount++;
} else {
$okItems[] = "
{$hostnameDisplay}
";
}
}
return [
'ok' => implode('', $okItems),
'ko' => implode('', $koItems),
'issues' => $issueCount
];
}
/**
* Affiche une section de l'accordéon.
*/
function displayHeartbeatSection(
string $id,
string $title,
array $servers,
array $status,
string $deviceLabel
): void {
$count = count($servers);
$issues = $status['issues'];
$backgroundColor = $issues > 0 ? 'DarkOrange' : 'green';
$message = $issues > 0
? " → {$issues} issue(s)"
: 'OK';
?>
0): ?>
Issues
= $status['ko'] ?>
0): ?>
OK
= $status['ok'] ?>
''
AND NOT EXISTS (
SELECT 1
FROM maintenance_status m
WHERE m.server = c.hostname
AND (
m.scom = 'Y'
OR m.zabbix = 'Y'
)
)
ORDER BY c.hostname ASC
");
/*
* Linux, AIX et autres :
* une seule requête au lieu de trois.
*/
$unixServers = Invoke_aixcmdb("
SELECT
h.hostname,
h.hbtime,
h.prevtime,
s.os_type
FROM heartbeat h
LEFT JOIN srvall s
ON s.hostname = h.hostname
WHERE h.mainttime IS NULL
AND h.decomtime IS NULL
AND (
s.os_type IN ('LINUX', 'AIX')
OR s.os_type IS NULL
)
ORDER BY h.hostname ASC
");
/*
* Répartition des résultats Unix.
*/
$linux = [];
$aix = [];
$other = [];
foreach ($unixServers as $server) {
$osType = strtoupper(
trim((string)getRowValue($server, 'os_type', ''))
);
switch ($osType) {
case 'LINUX':
$linux[] = $server;
break;
case 'AIX':
$aix[] = $server;
break;
default:
$other[] = $server;
break;
}
}
/*
* Génération des états.
*/
$windowsStatus = buildHeartbeatStatus(
$windows,
'hostname',
'heartbeat',
'heartbeat',
$windowsHeartbeatLimit
);
$linuxStatus = buildHeartbeatStatus(
$linux,
'hostname',
'hbtime',
'prevtime',
$unixHeartbeatLimit
);
$aixStatus = buildHeartbeatStatus(
$aix,
'hostname',
'hbtime',
'prevtime',
$unixHeartbeatLimit
);
$otherStatus = buildHeartbeatStatus(
$other,
'hostname',
'hbtime',
'prevtime',
$unixHeartbeatLimit
);
?>
= htmlspecialchars((string)$ti_17, ENT_QUOTES, 'UTF-8') ?>