// check_http -H servername -u /glpi/status.php -s GLPI_OK
// Plain text content
header('Content-type: text/plain');
$ok_master = true;
$ok_slave = true;
$ok = true;
// Check slave server connection
if (DBConnection::isDBSlaveActive()) {
$DBslave = DBConnection::getDBSlaveConf();
if (is_array($DBslave->dbhost)) {
$hosts = $DBslave->dbhost;
} else {
$hosts = array($DBslave->dbhost);
}
foreach ($hosts as $num => $name) {
$diff = DBConnection::getReplicateDelay($num);
if (abs($diff) > 1000000000) {
echo "GLPI_DBSLAVE_{$num}_OFFLINE\n";
$ok_slave = false;
} else {
if (abs($diff) > HOUR_TIMESTAMP) {
echo "GLPI_DBSLAVE_{$num}_PROBLEM\n";
$ok_slave = false;
} else {
echo "GLPI_DBSLAVE_{$num}_OK\n";
}
}
}
} else {
echo "No slave DB\n";
}