|
|
|
@ -123,120 +123,126 @@ ParseKVFile($cfgdir.'/defaults', $defaults);
|
|
|
|
<h2>QnetGateway <?php echo GetCFGValue('ircddb_login'); ?> Dashboard</h2>
|
|
|
|
<h2>QnetGateway <?php echo GetCFGValue('ircddb_login'); ?> Dashboard</h2>
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
if ('true' == GetCFGValue('dash_show_ps') && `ps -aux | grep -e qn -e MMDVMHost | wc -l` > 2) {
|
|
|
|
$showorder = GetCFGValue('dash_show_order');
|
|
|
|
echo 'Processes:<br><code>', "\n";
|
|
|
|
$showlist = explode(',', trim($showorder));
|
|
|
|
echo str_replace(' ', ' ', 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND<br>'), "\n";
|
|
|
|
foreach($showlist as $section) {
|
|
|
|
$lines = explode("\n", `ps -aux | grep -e qngateway -e qnlink -e qndtmf -e qndvap -e qnitap -e qnrelay -e qndvrptr -e qnmodem -e MMDVMHost | grep -v grep`);
|
|
|
|
switch ($section) {
|
|
|
|
foreach ($lines as $line) {
|
|
|
|
case 'PS':
|
|
|
|
echo str_replace(' ', ' ', $line), "<br>\n";
|
|
|
|
if (`ps -aux | grep -e qn -e MMDVMHost | wc -l` > 2) {
|
|
|
|
}
|
|
|
|
echo 'Processes:<br><code>', "\n";
|
|
|
|
echo '</code>', "\n";
|
|
|
|
echo str_replace(' ', ' ', 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND<br>'), "\n";
|
|
|
|
}
|
|
|
|
$lines = explode("\n", `ps -aux | grep -e qngateway -e qnlink -e qndtmf -e qndvap -e qnitap -e qnrelay -e qndvrptr -e qnmodem -e MMDVMHost | grep -v grep`);
|
|
|
|
|
|
|
|
foreach ($lines as $line) {
|
|
|
|
if ('true' == GetCFGValue('dash_show_sy')) {
|
|
|
|
echo str_replace(' ', ' ', $line), "<br>\n";
|
|
|
|
echo 'System Info:<br>', "\n";
|
|
|
|
}
|
|
|
|
$hn = trim(`uname -n`);
|
|
|
|
echo '</code>', "\n";
|
|
|
|
$kn = trim(`uname -rmo`);
|
|
|
|
|
|
|
|
$oslist = explode(':', `lsb_release -d`);
|
|
|
|
|
|
|
|
$os = trim($oslist[1]);
|
|
|
|
|
|
|
|
$cu = trim(`cat /proc/cpuinfo | grep Model`);
|
|
|
|
|
|
|
|
if (0 == strlen($cu))
|
|
|
|
|
|
|
|
$cu = trim(`cat /proc/cpuinfo | grep "model name"`);
|
|
|
|
|
|
|
|
$culist = explode("\n", $cu);
|
|
|
|
|
|
|
|
$mnlist = explode(':', $culist[0]);
|
|
|
|
|
|
|
|
$cu = trim($mnlist[1]);
|
|
|
|
|
|
|
|
if (count($culist) > 1)
|
|
|
|
|
|
|
|
$cu .= ' ' . count($culist) . ' Threads';
|
|
|
|
|
|
|
|
if (file_exists('/opt/vc/bin/vcgencmd'))
|
|
|
|
|
|
|
|
$cu .= ' ' . str_replace("'", '°', trim(`/opt/vc/bin/vcgencmd measure_temp`));
|
|
|
|
|
|
|
|
echo '<table cellpadding="1" border="1" style="font-family: monospace">', "\n";
|
|
|
|
|
|
|
|
echo '<tr><td style="text-align:center">Hostname</td><td style="text-align:center">Kernel</td><td style="text-align:center">OS</td><td style="text-align:center">CPU</td></tr>', "\n";
|
|
|
|
|
|
|
|
echo '<tr><td style="text-align:center">', $hn, '</td><td style="text-align:center">', $kn, '</td><td style="text-align:center">', $os, '</td><td style="text-align:center">', $cu, '</td></tr></table><br>', "\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ('true' == GetCFGValue('dash_show_lh')) {
|
|
|
|
|
|
|
|
echo 'Last Heard:<br><code>', "\n";
|
|
|
|
|
|
|
|
$rstr = 'MyCall/Sfx Source Last Time<br>';
|
|
|
|
|
|
|
|
echo str_replace(' ', ' ', $rstr), "\n";
|
|
|
|
|
|
|
|
$dbname = $cfgdir.'/'.GetCFGValue('dash_sql_filename');
|
|
|
|
|
|
|
|
$db = new SQLite3($dbname, SQLITE3_OPEN_READONLY);
|
|
|
|
|
|
|
|
$ss = 'SELECT mycall,sfx,urcall,strftime("%s","now")-lasttime FROM LHEARD ORDER BY 4 LIMIT '.GetCFGValue('dash_lastheard_count').' ';
|
|
|
|
|
|
|
|
if ($stmnt = $db->prepare($ss)) {
|
|
|
|
|
|
|
|
if ($result = $stmnt->execute()) {
|
|
|
|
|
|
|
|
while ($row = $result->FetchArray(SQLITE3_NUM)) {
|
|
|
|
|
|
|
|
$source = ("CQCQCQ " == $row[2]) ? "Linking" : "Routing";
|
|
|
|
|
|
|
|
$rstr = MyAndSfxToQrz($row[0], $row[1]).' '.$source.' '.SecToString(intval($row[3])).'<br>';
|
|
|
|
|
|
|
|
echo str_replace('*', ' ', str_replace(' ', ' ', $rstr)), "\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$result->finalize();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'SY':
|
|
|
|
$stmnt->close();
|
|
|
|
echo 'System Info:<br>', "\n";
|
|
|
|
}
|
|
|
|
$hn = trim(`uname -n`);
|
|
|
|
$db->Close();
|
|
|
|
$kn = trim(`uname -rmo`);
|
|
|
|
echo '</code><br>', "\n";
|
|
|
|
$oslist = explode(':', `lsb_release -d`);
|
|
|
|
}
|
|
|
|
$os = trim($oslist[1]);
|
|
|
|
|
|
|
|
$cu = trim(`cat /proc/cpuinfo | grep Model`);
|
|
|
|
if ('true' == GetCFGValue('dash_show_ip')) {
|
|
|
|
if (0 == strlen($cu))
|
|
|
|
echo 'IP Addresses:<br>', "\n";
|
|
|
|
$cu = trim(`cat /proc/cpuinfo | grep "model name"`);
|
|
|
|
echo '<table cellpadding="1" border="1" style="font-family: monospace">', "\n";
|
|
|
|
$culist = explode("\n", $cu);
|
|
|
|
echo '<tr><td style="text-align:center">Internal</td><td style="text-align:center">IPV4</td><td style="text-align:center">IPV6</td></tr>', "\n";
|
|
|
|
$mnlist = explode(':', $culist[0]);
|
|
|
|
echo '<tr><td>', GetIP('internal'), '</td><td>', GetIP('ipv4'), '</td><td>', GetIP('ipv6'), '</td></tr>', "\n";
|
|
|
|
$cu = trim($mnlist[1]);
|
|
|
|
echo '</table><br>', "\n";
|
|
|
|
if (count($culist) > 1)
|
|
|
|
}
|
|
|
|
$cu .= ' ' . count($culist) . ' Threads';
|
|
|
|
|
|
|
|
if (file_exists('/opt/vc/bin/vcgencmd'))
|
|
|
|
if ('true' == GetCFGValue('dash_show_mo')) {
|
|
|
|
$cu .= ' ' . str_replace("'", '°', trim(`/opt/vc/bin/vcgencmd measure_temp`));
|
|
|
|
echo 'Modules:<br>', "\n";
|
|
|
|
echo '<table cellpadding="1" border="1" style="font-family: monospace">', "\n";
|
|
|
|
echo "<table cellpadding='1' border='1' style='font-family: monospace'>\n";
|
|
|
|
echo '<tr><td style="text-align:center">Hostname</td><td style="text-align:center">Kernel</td><td style="text-align:center">OS</td><td style="text-align:center">CPU</td></tr>', "\n";
|
|
|
|
echo '<tr><td style="text-align:center">Module</td><td style="text-align:center">Modem</td><td style="text-align:center">Frequency</td><td style="text-align:center">Repeater</td><td style="text-align:center">Repeater IP</td></tr>', "\n";
|
|
|
|
echo '<tr><td style="text-align:center">', $hn, '</td><td style="text-align:center">', $kn, '</td><td style="text-align:center">', $os, '</td><td style="text-align:center">', $cu, '</td></tr></table><br>', "\n";
|
|
|
|
foreach (array('a', 'b', 'c') as $mod) {
|
|
|
|
break;
|
|
|
|
$module = 'module_'.$mod;
|
|
|
|
case 'LH':
|
|
|
|
if (array_key_exists($module, $cfg)) {
|
|
|
|
echo 'Last Heard:<br><code>', "\n";
|
|
|
|
$configured[] = strtoupper($mod);
|
|
|
|
$rstr = 'MyCall/Sfx Source Last Time<br>';
|
|
|
|
$freq = 0.0;
|
|
|
|
echo str_replace(' ', ' ', $rstr), "\n";
|
|
|
|
if (array_key_exists($module.'_tx_frequency', $cfg))
|
|
|
|
$dbname = $cfgdir.'/'.GetCFGValue('dash_sql_filename');
|
|
|
|
$freq = $cfg[$module.'_tx_frequency'];
|
|
|
|
$db = new SQLite3($dbname, SQLITE3_OPEN_READONLY);
|
|
|
|
else if (array_key_exists($module.'_frequency', $cfg))
|
|
|
|
$ss = 'SELECT mycall,sfx,urcall,strftime("%s","now")-lasttime FROM LHEARD ORDER BY 4 LIMIT '.GetCFGValue('dash_lastheard_count').' ';
|
|
|
|
$freq = $cfg[$module.'_frequency'];
|
|
|
|
if ($stmnt = $db->prepare($ss)) {
|
|
|
|
$stat = GetStatus($mod, $cfg);
|
|
|
|
if ($result = $stmnt->execute()) {
|
|
|
|
if (8==strlen($stat[1]) && 1==strlen($stat[2]))
|
|
|
|
while ($row = $result->FetchArray(SQLITE3_NUM)) {
|
|
|
|
$linkstatus = substr($stat[1], 0, 7).$stat[2];
|
|
|
|
$source = ("CQCQCQ " == $row[2]) ? "Linking" : "Routing";
|
|
|
|
else
|
|
|
|
$rstr = MyAndSfxToQrz($row[0], $row[1]).' '.$source.' '.SecToString(intval($row[3])).'<br>';
|
|
|
|
$linkstatus = 'Unlinked';
|
|
|
|
echo str_replace('*', ' ', str_replace(' ', ' ', $rstr)), "\n";
|
|
|
|
echo '<tr><td style="text-align:center">',strtoupper($mod),'</td><td style="text-align:center">',$cfg[$module],'</td><td style="text-align:center">',$freq,'</td><td style="text-align:center">',$linkstatus,'</td><td style="text-align:center">',$stat[3],'</td></tr>',"\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$result->finalize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo '</table><br>', "\n";
|
|
|
|
$stmnt->close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$db->Close();
|
|
|
|
if ('true' == GetCFGValue('dash_show_ur')) {
|
|
|
|
echo '</code><br>', "\n";
|
|
|
|
echo 'Send URCall:<br>', "\n";
|
|
|
|
break;
|
|
|
|
echo '<form method="post">', "\n";
|
|
|
|
case 'IP':
|
|
|
|
if (count($configured) > 1) {
|
|
|
|
echo 'IP Addresses:<br>', "\n";
|
|
|
|
echo 'Module: ', "\n";
|
|
|
|
echo '<table cellpadding="1" border="1" style="font-family: monospace">', "\n";
|
|
|
|
foreach ($configured as $mod) {
|
|
|
|
echo '<tr><td style="text-align:center">Internal</td><td style="text-align:center">IPV4</td><td style="text-align:center">IPV6</td></tr>', "\n";
|
|
|
|
echo '<input type="radio" name="fmodule"', (isset($fmodule) && $fmodule==$mod) ? '"checked"' : '', ' value="$mod">', $mod, '<br>', "\n";
|
|
|
|
echo '<tr><td>', GetIP('internal'), '</td><td>', GetIP('ipv4'), '</td><td>', GetIP('ipv6'), '</td></tr>', "\n";
|
|
|
|
}
|
|
|
|
echo '</table><br>', "\n";
|
|
|
|
} else
|
|
|
|
break;
|
|
|
|
$fmodule = $configured[0];
|
|
|
|
case 'MO':
|
|
|
|
echo 'URCall: <input type="text" name="furcall" value="', $furcall, '">', "\n";
|
|
|
|
echo 'Modules:<br>', "\n";
|
|
|
|
echo '<input type="submit" name="sendurcall" value="Send URCall"><br>', "\n";
|
|
|
|
echo "<table cellpadding='1' border='1' style='font-family: monospace'>\n";
|
|
|
|
echo '</form>', "\n";
|
|
|
|
echo '<tr><td style="text-align:center">Module</td><td style="text-align:center">Modem</td><td style="text-align:center">Frequency</td><td style="text-align:center">Link</td><td style="text-align:center">Link IP</td></tr>', "\n";
|
|
|
|
if (isset($_POST['sendurcall'])) {
|
|
|
|
foreach (array('a', 'b', 'c') as $mod) {
|
|
|
|
$furcall = $_POST['furcall'];
|
|
|
|
$module = 'module_'.$mod;
|
|
|
|
if (empty($_POST['fmodule'])) {
|
|
|
|
if (array_key_exists($module, $cfg)) {
|
|
|
|
if (1==count($configured)) {
|
|
|
|
$configured[] = strtoupper($mod);
|
|
|
|
|
|
|
|
$freq = 0.0;
|
|
|
|
|
|
|
|
if (array_key_exists($module.'_tx_frequency', $cfg))
|
|
|
|
|
|
|
|
$freq = $cfg[$module.'_tx_frequency'];
|
|
|
|
|
|
|
|
else if (array_key_exists($module.'_frequency', $cfg))
|
|
|
|
|
|
|
|
$freq = $cfg[$module.'_frequency'];
|
|
|
|
|
|
|
|
$stat = GetStatus($mod, $cfg);
|
|
|
|
|
|
|
|
if (8==strlen($stat[1]) && 1==strlen($stat[2]))
|
|
|
|
|
|
|
|
$linkstatus = substr($stat[1], 0, 7).$stat[2];
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
$linkstatus = 'Unlinked';
|
|
|
|
|
|
|
|
echo '<tr><td style="text-align:center">',strtoupper($mod),'</td><td style="text-align:center">',$cfg[$module],'</td><td style="text-align:center">',$freq,'</td><td style="text-align:center">',$linkstatus,'</td><td style="text-align:center">',$stat[3],'</td></tr>',"\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '</table><br>', "\n";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'UR':
|
|
|
|
|
|
|
|
echo 'Send URCall:<br>', "\n";
|
|
|
|
|
|
|
|
echo '<form method="post">', "\n";
|
|
|
|
|
|
|
|
if (count($configured) > 1) {
|
|
|
|
|
|
|
|
echo 'Module: ', "\n";
|
|
|
|
|
|
|
|
foreach ($configured as $mod) {
|
|
|
|
|
|
|
|
echo '<input type="radio" name="fmodule"', (isset($fmodule) && $fmodule==$mod) ? '"checked"' : '', ' value="$mod">', $mod, '<br>', "\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else
|
|
|
|
$fmodule = $configured[0];
|
|
|
|
$fmodule = $configured[0];
|
|
|
|
|
|
|
|
echo 'URCall: <input type="text" name="furcall" value="', $furcall, '">', "\n";
|
|
|
|
|
|
|
|
echo '<input type="submit" name="sendurcall" value="Send URCall"><br>', "\n";
|
|
|
|
|
|
|
|
echo '</form>', "\n";
|
|
|
|
|
|
|
|
if (isset($_POST['sendurcall'])) {
|
|
|
|
|
|
|
|
$furcall = $_POST['furcall'];
|
|
|
|
|
|
|
|
if (empty($_POST['fmodule'])) {
|
|
|
|
|
|
|
|
if (1==count($configured)) {
|
|
|
|
|
|
|
|
$fmodule = $configured[0];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$fmodule = $_POST['fmodule'];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$furcall = str_replace(' ', '_', trim(preg_replace('/[^0-9a-z_ ]/', '', strtolower($furcall))));
|
|
|
|
$fmodule = $_POST['fmodule'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$furcall = str_replace(' ', '_', trim(preg_replace('/[^0-9a-z_ ]/', '', strtolower($furcall))));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (strlen($furcall)>0 && strlen($fmodule)>0) {
|
|
|
|
if (strlen($furcall)>0 && strlen($fmodule)>0) {
|
|
|
|
$command = 'qnremote '.strtolower($fmodule).' '.strtolower($cfg['ircddb_login']).' '.$furcall;
|
|
|
|
$command = 'qnremote '.strtolower($fmodule).' '.strtolower($cfg['ircddb_login']).' '.$furcall;
|
|
|
|
echo $command, "<br>\n";
|
|
|
|
echo $command, "<br>\n";
|
|
|
|
$unused = `$command`;
|
|
|
|
$unused = `$command`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
echo 'Section "', $section, '" was not found!<br>', "\n";
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|
|