GISTS/linux/affichage IPMI vers une page web/ipmiweb/index.php

132 lignes
Pas d'EOL
3,6 Kio
PHP

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>IPMI</title>
<meta name="description" content="page IPMI du serveur Albirew Midgard">
<style type="text/css">
tr:nth-child(even) {background-color: #f2f2f2;}
table, .list{
margin: auto;
border: 4px dotted #4CAF50;
width:50%;
margin-bottom: 2ex;
}
#nom{text-transform: lowercase;}
#nom::first-letter{text-transform: uppercase;}
.bouton{
margin-top:5ex;
transform:skew(12deg,-3deg) rotateZ(0deg)
}
.bouton span{
margin-left:40%;
padding:0.3ex;
}
#titre,th,header,footer, footer a,tr:hover{
background-color: #4CAF50;
color: white;
}
table a:link{
text-decoration: none;
}
table a:link, table a:visited, table a:active{
color:black;
}
table a:hover, tr:hover a:link,tr:hover a:visited{
color:white;
text-decoration:underline;
}
#titre,th,header{
font-variant:small-caps;
}
#maitre{
border-left: 1ex solid green;
text-transform: uppercase;
}
fieldset{
width: 50ex;
margin:auto;
text-align: right;
}
fieldset div{margin:2px;}
::placeholder {
color: white;
opacity: 0.5;
}
footer{
position: fixed;
bottom:0;
left:0;
right:0;
padding: 1px 0;
font-variant:small-caps;
}
.dygraph-roller {
position: relative;
z-index:9;
}
</style>
</head>
<body style='text-align:center;'>
<header><h1>IPMI</h1></header>
<!-- Fin en-tete -->
<?php
if (file_exists('ipmi-lst.html'))
{ include('ipmi-lst.html'); }
if (file_exists('ipmi-events.html'))
{ include('ipmi-events.html'); }
if (file_exists('ipmi-errors.log') and filesize('ipmi-errors.log'))
{
echo ' <div style="margin: auto; border: 4px solid darkred; width:60%;"><pre>';
include('ipmi-errors.log');
echo ' </pre></div>';
}
echo ('<div class="bouton"><span id="titre">Données mises à jour '.time_elapsed_string('@'.filemtime('ipmi-lst.html')).'</span></div>');
function time_elapsed_string($datetime, $full = false) {
$now = new DateTime;
$ago = new DateTime($datetime);
$diff = $now->diff($ago);
$diff->w = floor($diff->d / 7);
$diff->d -= $diff->w * 7;
$string = array(
'y' => 'an',
'm' => 'mois',
'w' => 'semaine',
'd' => 'jour',
'h' => 'heure',
'i' => 'minute',
's' => 'seconde',
);
foreach ($string as $k => &$v) {
if ($diff->$k) {
$v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
} else {
unset($string[$k]);
}
}
if (!$full) $string = array_slice($string, 0, 1);
return $string ? 'il y a ' . implode(', ', $string) : 'à l\'instant';
}
echo ('<div class="list" style="padding-bottom:3em;">');
if (file_exists('temp.html')) {include('temp.html');} else {echo("temp.html not found");}
?>
</div>
<div><a href="ipmi-events.html">ipmi-events</a> - <a href="ipmi-lst.html">ipmi-lst</a> - <a href="temp.html">temp</a></div>
<!-- Début pied-de-page -->
<div style="margin-bottom:5em;"></div>
<footer>
<a href="https://twitter.com/albirew">Albirew</a>℠ 2019 - Aucun droit réservé
</footer>
</body>
<script> // hide non available values
document.querySelectorAll('tr td:nth-child(3)').forEach(el=>{if(el.innerHTML.includes('ns')){el.parentNode.style.display='none'}})
</script>
</html>