<?php
$reNew=30;
$_REQUEST['q']='TEMP_BANANA_PI,UPTIME,LOAD';
require 'sysview.core.php';
if (! empty ($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'dbinterface')) {
$secondLink=' | <a href="'.$_SERVER['HTTP_REFERER'].'">zurück zum Artikel</a>';
} else {
$secondLink='';
}
?>
<!doctype html>
<html lang="de">
<head>
<title>fastix-API: Prozessortemperatur</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="initial-scale=.85">
<link rel="stylesheet" href="/standard.css" type="text/css">
<style type="text/css">
#temperatur_defaults {
position: absolute;
top: 4.5em;
left: 4em;
height: 13.4em;
width: 2em;
border: 1px solid black;
background-image: linear-gradient(
to top,
blue 0%,
green <?php echo $allOutput['TEMP_BANANA_PI']['data']['WARN_MIN_VALUE']; ?>%,
yellow <?php echo $allOutput['TEMP_BANANA_PI']['data']['WARN_MAX_VALUE']; ?>%,
red <?php echo $allOutput['TEMP_BANANA_PI']['data']['DEAD_VALUE']; ?>%,
red 100%
);
}
#balken {
position: absolute;
bottom: 0;
left: -.5em;
right: -.5em;
border-top: 2px solid black;
text-align: center;
height: <?php echo $allOutput['TEMP_BANANA_PI']['data']['VALUE']-1; ?>%;
}
#balken_value {
position: absolute;
top: -.7em;
left: -3em;
font-size: 80%;
}
#data_table {
position: absolute;
top: 5em;
left: 8em;
font-size: 90%;
}
#messages {
position: absolute;
top: 15.5em;
left: 8em;
font-size: 90%;
}
</style>
<script>
var reNewTime = <?=$reNew?>;
var oDownTimer;
function reNew() {
var xmlHttp = null;
try {
xmlHttp = new XMLHttpRequest();
} catch(e) {
alert('Ups! Es gibt noch Browser, die kein Ajax können?');
}
if (xmlHttp) {
xmlHttp.open('GET', 'sysview.api.php?q=TEMP_BANANA_PI,UPTIME,LOAD', false);
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4) {
var data = JSON.parse(xmlHttp.responseText);
document.getElementById('TEMP_BANANA_PI_STRING').innerHTML = data['TEMP_BANANA_PI']['data']['STRING'];
document.getElementById('balken_value').innerHTML = data['TEMP_BANANA_PI']['data']['STRING'];
document.getElementById('balken').style.height = data['TEMP_BANANA_PI']['data']['value'] + '%';
document.getElementById('UPTIME').innerHTML = data['UPTIME']['data']['STRING'];
document.getElementById('LAST').innerHTML = data['LOAD']['data']['Last']['Gesamt'];
downTimer.innerHTML = <?=$reNew?>;
}
}
xmlHttp.send(null);
}
}
function setTime () {
oDownTimer.innerHTML = oDownTimer.innerHTML - 1;
if (0 >= oDownTimer.innerHTML) {
reNew();
}
window.setTimeout( function() { setTime(); }, 1000 );
}
window.onload = function () {
oDownTimer = document.getElementById('downTimer');
window.setTimeout( function() { setTime(); }, 1000 );
};
</script>
</head>
<body>
<h1>fastix-API: Prozessortemperatur</h1>
<div id="inhalt">
<div id="temperatur_defaults">
<div id="balken">
<div ID="balken_value"><?php echo $allOutput['TEMP_BANANA_PI']['data']['STRING']; ?></div>
</div>
</div>
<table id="data_table">
<tr><td>Aktuelle Temperatur:</td><td><output id="TEMP_BANANA_PI_STRING"><?php echo $allOutput['TEMP_BANANA_PI']['data']['STRING']; ?></output></td></tr>
<tr><td>Kritische Temperatur (tief):</td><td><output><?php echo $allOutput['TEMP_BANANA_PI']['data']['WARN_MIN_STRING']; ?></output></td></tr>
<tr><td>Kritische Temperatur (hoch):</td><td><output><?php echo $allOutput['TEMP_BANANA_PI']['data']['WARN_MAX_STRING']; ?></output></td></tr>
<tr><td>Ausfall-Temperatur:</td><td><output><?php echo $allOutput['TEMP_BANANA_PI']['data']['DEAD_STRING']; ?></output></td></tr>
<tr><td>Server läuft seit:</td><td><output id="UPTIME"><?php echo $allOutput['UPTIME']['data']['STRING']; ?></output></td></tr>
<tr><td>Durchschnittliche Serverlast:</td><td><output id="LAST"><?php echo $allOutput['LOAD']['data']['Last']['Gesamt']; ?></output></td></tr>
</table>
<div id="messages">
<p>Automatische Aktualisierung in <output id="downTimer"><?=$reNew?></output> Sekunden.</p>
<p><a href="./sysview.listFunctions.php">zur Übersicht</a><?=$secondLink?></p>
</div>
</div>
</body>
</html>