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

119 lines
3.2 KiB

3 years ago
<?php
/*
* index.php
* Dashboard for my personal hotspot dashboard
* Dominic Reich, OE7DRT, oe7drt@oevsv.at
*/
$time_start = microtime(true);
include("conf.php");
include("func.php");
$mem = ImportDB();
?><!DOCTYPE html>
<html>
<head>
<title><?php echo CALLSIGN ?> Dashboard</title>
<meta name=viewport content="width=device-width,initial-scale=1">
<meta name=generator content="Sublime Text 3 / Vim">
<meta name="author" content="Dominic Reich">
<link rel="stylesheet" type="text/css" media="screen" href="dash.min.css" />
<meta http-equiv="refresh" content="60">
</head>
<body>
<div id="container">
<div id="header">
<a href="<?php echo $_SERVER['REQUEST_URI'] ?>"><h1><?php echo CALLSIGN ?> Hotspot Dashboard</h1></a>
</div>
<div id="content">
<table id="toptable" align="center" width="100%" cellpadding="2px" border="0">
<tr>
<th>Hostname</th>
<th>Model</th>
<th>CPU Freq.</th>
<th>Load</th>
<th>Uptime</th>
<th>Temp.</th>
</tr>
<tr>
<td><?php echo trim(`hostname`); ?> (<?php echo trim(`hostname -I | cut -d' ' -f1`); ?>)</td>
<td><?php echo trim( `cat /sys/firmware/devicetree/base/model | sed 's/Raspberry\ Pi/RPi/'` ); ?> (<?php echo trim( `uname -sr` ); ?>)</td>
<td><?php echo round((int)`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq` / 1000) . " MHz"; ?></td>
<td><?php echo str_replace(","," /",implode(", ", explode(" ", `cat /proc/loadavg`, -2))); ?></td>
<td><?php echo getUptime(); ?></td>
<td><?php echo round((int)`cat /sys/class/thermal/thermal_zone0/temp` / 1000) . "°C"; ?></td>
</tr>
</table>
<div id="bmtable">
<h2>YSF</h2>
<table width="100%" cellpadding="2px" border="0">
<tr>
<th>#</th>
<th>Time (<?php echo date("T"); ?>)</th>
<th>Call</th>
<th>DG-ID</th>
<th>Source</th>
<th>Dur</th>
<th>Loss</th>
<th>BER</th>
</tr>
<?php getLastHeardYSF(MMDVMHOST_LOGPATH, MMDVMHOST_PREFIX) ?>
</table>
<div class="box">
<table width="100%" cellpadding="2px" border="0">
<tr>
<th>Hotspot ID</th>
<th>Startup Reflector</th>
<th><?php echo countDGIDs() ?> DG-IDs booked</th>
</tr>
<tr>
<?php getYSFInfo(); ?>
</tr>
</table>
</div>
</div>
<div id="ipsctable">
<h2>IPSC</h2>
<table width="100%" cellpadding="2px" border="0">
<tr>
<th>#</th>
<th>Time (<?php echo date("T"); ?>)</th>
<th>Call</th>
<th>Slot</th>
<th>TG</th>
<th>Dur</th>
<th>Loss</th>
<th>BER</th>
</tr>
<?php getLastHeard(IPSC_LOGPATH, IPSC_PREFIX) ?>
</table>
<div class="box">
<table width="100%" cellpadding="2px" border="0">
<tr>
<th>Hotspot&nbsp;ID</th>
<th>Server</th>
<!-- <th>Port</th> -->
<th>DMR Options</th>
</tr>
<tr>
<?php getIPSCInfo(); ?>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
I worked <?php $time_end = microtime(true); echo (round($time_end - $time_start, 3)*1000)."ms"; ?> on this page request &mdash; I hope this makes you happy.
</div>
</div>
</body>
</html>
<!-- <?php //$time_end = microtime(true); echo (round($time_end - $time_start, 3)*1000)."ms"; ?>-.- -->