140 lines
4.1 KiB
PHP
Executable File
140 lines
4.1 KiB
PHP
Executable File
<?php
|
|
|
|
$view = $_GET["view"];
|
|
|
|
switch($view) {
|
|
default: // Standardseite (Übersicht)
|
|
?>
|
|
<div class="content-header">System-Aktionen</div>
|
|
<hr />
|
|
<div class="save-button" style="background-color: #ffadad" onclick="if(confirm('Das System wird heruntergefahren. Fortfahren?') == true){pageload('shutdown')}"><img src="/vendor/icons/system-shut.svg" \>Herunterfahren</div>
|
|
<div class="save-button" style="background-color: #adcfff" onclick="if(confirm('Das System wird neu gestartet. Fortfahren?') == true){pageload('reboot')}"><img src="/vendor/icons/restart.svg" \>Neu starten</div>
|
|
<div class="save-button" onclick="pageload('info'); $(this).html('<img src=\'/vendor/icons/load.gif\' \>Sammle Systeminfos...');"><img src="/vendor/icons/info-circle.svg" \>Systeminfo</div>
|
|
<div class="save-button" onclick="pageload('wifi')"><img src="/vendor/icons/wifi.svg" \>WLAN-/DHCP-Konfig anzeigen</div>
|
|
<div class="save-button" onclick="window.location.href='#selfcheck';"><img src="/vendor/icons/ecg-monitoring-icon.svg" \>Selbstdiagnose</div>
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
case "info":
|
|
?>
|
|
<div class="content-header">System-Aktionen: Sys-Info</div>
|
|
<hr />
|
|
|
|
<p>Kernel-Version:</p>
|
|
<?php
|
|
$output = shell_exec('uname -r');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
|
|
<p>Betriebssystem:</p>
|
|
<?php
|
|
$output = shell_exec('cat /etc/os-release');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
|
|
<p>System-Uptime:</p>
|
|
<?php
|
|
$output = shell_exec('uptime -p');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
|
|
<p>Letzter Boot:</p>
|
|
<?php
|
|
$output = shell_exec('who -b');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
|
|
<p>CPU-Infos:</p>
|
|
<?php
|
|
$output = shell_exec('cat /proc/cpuinfo');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
|
|
<p>Arbeitsspeicher:</p>
|
|
<?php
|
|
$output = shell_exec('free -h');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
|
|
<p>Speicherplatz:</p>
|
|
<?php
|
|
$output = shell_exec('df -h');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
|
|
<p>Python-Version:</p>
|
|
<?php
|
|
$output = shell_exec('python3 --version');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
|
|
<p>Top 5 Prozesse nach CPU-Auslastung:</p>
|
|
<?php
|
|
$output = shell_exec('ps -eo pid,comm,%cpu,%mem --sort=-%cpu | head -n 6');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
|
|
<p>CPU-Temperatur:</p>
|
|
<?php
|
|
$output = shell_exec('vcgencmd measure_temp');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
<p>System-Uhrzeit (PHP):</p>
|
|
<?php
|
|
setlocale(LC_TIME, 'de_DE.UTF-8'); // optional für deutsche Darstellung
|
|
date_default_timezone_set("Europe/Berlin"); // falls nötig
|
|
echo "<pre align='left'>" . strftime("%A, %e. %B %Y %H:%M:%S") . "</pre>";
|
|
|
|
|
|
break;
|
|
case "wifi":
|
|
?>
|
|
<div class="content-header">System-Aktionen: WLAN/DHCP</div>
|
|
<hr />
|
|
<p>Netzwerkverbindungen:</p>
|
|
<?php
|
|
$output = shell_exec('nmcli connection show');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
<p>Verbundene Geräte:</p>
|
|
<?php
|
|
$output = shell_exec('ip neigh');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
<p>Netzwerkschnittstellen:</p>
|
|
<?php
|
|
$output = shell_exec('nmcli device show');
|
|
echo "<pre align='left'>$output</pre>";
|
|
?>
|
|
<p>Ifconfig:</p>
|
|
<?php
|
|
$output = shell_exec('ifconfig');
|
|
echo "<pre align='left'>$output</pre>";
|
|
break;
|
|
case "reboot":
|
|
?>
|
|
<div class="content-header">System-Aktionen: Neustart</div>
|
|
<hr />
|
|
|
|
<p>Das Prüfgerät wird nun neu gestartet. Die Verbindung wird in Kürze getrennt.</p>
|
|
<p>Stellen Sie sicher, dass Sie sich im Anschluss wieder mit dem Geräte-WLAN verbinden.</p>
|
|
<?php
|
|
$output = shell_exec('sudo /sbin/reboot 2>&1');
|
|
echo "------- Fehlerprotokoll nach dieser Zeile -------<br> $output";
|
|
break;
|
|
case "shutdown":
|
|
?>
|
|
<div class="content-header">System-Aktionen: Herunterfahren</div>
|
|
<hr />
|
|
|
|
<p>Das Prüfgerät wird nun heruntergefahren. Die Verbindung wird in Kürze getrennt.</p>
|
|
<p>Auf Wiedersehen!</p>
|
|
<?php
|
|
|
|
$output = shell_exec('sudo /sbin/shutdown -h now 2>&1');
|
|
echo "------- Fehlerprotokoll nach dieser Zeile -------<br> $output";
|
|
break;
|
|
}
|