You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
5.6 KiB
PHP

<?php //require(__DIR__.'/admin_login.php');
defined('_VALID') or define('_VALID', true);
defined('_ADMIN') or define('_ADMIN', true);
require(__DIR__.'/includes/config.php');
$server_ip = $config['ilo_server_ip'];
//$params = getIloInfo($server_ip, $username, $password);
$jsondata = file_get_contents('ilo_results.json');
$params = json_decode($jsondata, true);
unset($jsondata);//prevent memory leaks for large json.
//print_r($params);
//-----------------------------------------------------------------------------
?>
<html>
<head>
<title>blackRACK - Temp</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="refresh" content="60">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style type="text/css">
.table td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#fff;}
.table th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#ccc;color:#333;background-color:#f0f0f0;}
.table .normalHead{font-weight:bold;vertical-align:top}
.table .warnHead{font-weight:bold;color:#f56b00;vertical-align:top}
.table .emergencyHead{font-weight:bold;color:#fe0000;vertical-align:top}
.table .tg-yw4l{vertical-align:top}
.powerOn {background-color:lightgreen !important;}
.powerOff {background-color:red !important;}
.powerUnknown {background-color:gray !important;}
.powerFailed {background-color:orange !important;}
</style>
</head>
<body>
<div class="container">
<div style="text-align: right; margin-bottom: -20px;">
<?php
$filename = 'ilo_results.json';
if (file_exists($filename)) {
echo "Werte zuletzt aktualisiert: " . date ("d/m/Y H:i:s", filemtime($filename));
}
?>
</div>
<h2>Server Informationen:</h2>
<p>Grundlegende Informationen, zum Server:</p>
<?php
if ($params['system_enabled_info']['enabledstate'] == 'enabled') {
$power = 'On';
} else if ($params['system_enabled_info']['enabledstate'] == 'disabled') {
$power = 'Off';
} else {
$power = 'Unknown';
if ($line->result == 'Connection Failed') {
$power = 'Failed';
$line->name = '(Connection Failed)';
} else if ($line->result == 'Authencation Failed') {
$power = 'Failed';
$line->name = '(Authencation Failed)';
}
}
?>
<table class="table">
<thead>
<tr>
<th class="normalHead">Produktname</th>
<th class="normalHead">ILOx IP:</th>
<th class="normalHead">System Status:</th>
<th class="normalHead">Power-Modus</th>
<th class="normalHead">Aktuelle Leistung</th>
<th class="normalHead">Durchschnittlicher Stromverbrauch</th>
<th class="normalHead">Maximale Leistung</th>
<th class="normalHead">Minimaler Stromverbrauch</th>
<th class="normalHead">BIOS Version</th>
<th class="normalHead">Management-Modul</th>
<th class="normalHead">Management-Modul-Version</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $params['system_info']['productName'] ?></td>
<td><a href="https://<?php echo $server_ip;?>/"><?php echo $server_ip;?></a></td>
<td class="power<?php echo $power;?>"><?php echo $power;?></td>
<td><?php echo $params['system_power']['powerProfile'] ?></td>
<td><?php echo $params['system_power']['presentPower'] ?></td>
<td><?php echo $params['system_power']['averagePower'] ?></td>
<td><?php echo $params['system_power']['maximumPower'] ?></td>
<td><?php echo $params['system_power']['minimumPower'] ?></td>
<td><?php echo $params['bios_info']['biosVersion'] ?> <br> (<?php echo $params['bios_info']['biosDate'] ?>)</td>
<td><?php echo $params['base_info']['fwName'] ?></td>
<td><?php echo $params['fw_info']['fwVersion'] ?> <br> (<?php echo $params['fw_info']['fwDate'] ?>)</td>
</tr>
</tbody>
</table>
<hr>
<br>
<h2>Server Temparaturen:</h2>
<p>Im folgenden werden alle wichtigen Temaratur-sensoren aus dem HP-ILO ausgelesen und präsentiert:</p>
<table class="table">
<thead>
<tr>
<th class="normalHead">Komponente:</th>
<th class="normalHead">Aktuelle Temaratur:</th>
<th class="warnHead">Warn Temaratur:</th>
<th class="emergencyHead">Emergency PowerOff Temparatur:</th>
</tr>
</thead>
<tbody>
<?php foreach ($params['temperature_info'] as $sensor): ?>
<tr>
<td class="tg-yw4l"><?php echo $sensor['ElementName'] ?> (<?php echo $sensor['Sensor_ID'] ?>)</td>
<td class="tg-yw4l"><?php echo $sensor['CurrentReading'] ?> °C</td>
<td class="tg-yw4l"><?php echo $sensor['CautionValue'] ?> °C</td>
<td class="tg-yw4l"><?php echo $sensor['CriticalValue'] ?> °C</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<hr>
<br>
<h2>Disks Informationen (Health):</h2>
<?php
$filename = 'log.txt';
if (file_exists($filename)) {
echo "<font color='green'>Disk-Status zuletzt aktualisiert: " . date ("d/m/Y H:i:s", filemtime($filename)) . "</font>";
}
echo '<br>';
$disk_checks=file($filename);
unset($disk_checks[0]);
unset($disk_checks[1]);
foreach($disk_checks as $disk) {
$disk_output = str_replace(',', ' -- ', $disk);
$disk_output = str_replace("O", "<font color='green'>O</font>", $disk_output);
$disk_output = str_replace("F", "<font color='red'>F</font>", $disk_output);
echo $disk_output.'<br>';
}
?>
</div>
</body>
</html>