Skip to content
Permalink
Browse files

Huge improvements to speedtest - PATCH-000004

  • Loading branch information...
NEMS Linux
NEMS Linux committed Mar 28, 2019
1 parent 84bc264 commit 4941f0c5f898d0189cf9d58a8f6b6b7a06618d53
Showing with 33 additions and 13 deletions.
  1. +30 −0 config/index.php
  2. +3 −13 info/index.php
@@ -192,6 +192,10 @@
$nemsconf['checkin.enabled'] = intval($_POST['checkin_enabled']) ?: 0;
$nemsconf['checkin.email'] = filter_var(trim($_POST['checkin_email']), FILTER_VALIDATE_EMAIL) ?: '';
$nemsconf['checkin.interval'] = intval($_POST['checkin_interval']) ?: 8; // how many 15 minute cycles before notifying. Default 8 (2 hours).
$nemsconf['speedtestserver'] = intval($_POST['speedtestserver']);
$nemsconf['speedtestwhich'] = intval($_POST['speedtestwhich']) ?: 0;
$nemsconfoutput = '';
foreach ($nemsconf as $key=>$value) {
$nemsconfoutput .= $key . '=' . $value . PHP_EOL;
@@ -438,6 +442,7 @@ function sanitize($string) {
<?php
if (ver('nems') >= 1.5) {
?>

<div class="col-md-4">
<header>IPMI Credentials</header>
<fieldset>
@@ -459,6 +464,31 @@ function sanitize($string) {
</section>
</fieldset>
</div>

<div class="col-md-4">
<header>Internet Speedtest</header>
<fieldset>
<section>
<label class="label">Automatically Chosen Server</label>
<label class="input">
<i class="icon-append fa fa-server"></i>
<input type="hidden" name="speedtestserver" value="<?= $nemsconf['speedtestserver'] ?>" />
<input type="text" disabled="disabled" value="<?= $nemsconf['speedtestserver'] ?>" />
</label>
</section>
<section>
<label class="label">Which To Use</label>
<label class="select">
<select name="speedtestwhich">
<option value="0"<?php if (!isset($nemsconf['speedtestwhich']) || $nemsconf['speedtestwhich'] == 0) echo ' SELECTED'; ?>>Recommended Nearest Server (Dynamic)</option>
<option value="1"<?php if (isset($nemsconf['speedtestwhich']) && $nemsconf['speedtestwhich'] == 1) echo ' SELECTED'; ?>>ARG in NEMS NConf check command (Static)</option>
</select>
<i></i>
</label>
</section>
</fieldset>
</div>

<?php
}
?>
@@ -32,18 +32,8 @@
$platform = ver('platform');
exec('/usr/local/share/nems/nems-scripts/speedtest --list',$servernum_tmp);
if (is_array($servernum_tmp)) {
foreach ($servernum_tmp as $line) {
$tmp = explode(')',$line);
if (intval($tmp[0]) > 0) {
$speedtestservers[] = array(
'num'=>intval($tmp[0]),
);
break; // we only need one
}
}
}
$speedtestserver = intval(trim(shell_exec('/usr/local/bin/nems-info speedtest')));
$speedtestwhich = intval(trim(shell_exec('/usr/local/bin/nems-info speedtest which')));
?>

@@ -62,7 +52,7 @@
<p style="padding:4px 6px; color: #aaa !important;"><b>Number of Services:</b> <span class="nems-green"><?= shell_exec('/usr/local/bin/nems-info services'); ?></span></p>
<p style="padding:4px 6px; color: #aaa !important;"><b>Authorized for Cloud:</b> <span class="nems-green"><?php if (shell_exec('/usr/local/bin/nems-info cloudauth') == 1) echo 'Yes'; else echo 'No'; ?></span></p>

<p style="padding:4px 6px; color: #aaa !important;"><b>Local Speedtest Server Number:</b> <span class="nems-green"><?= $speedtestservers[0]['num'] ?></span></p>
<p style="padding:4px 6px; color: #aaa !important;"><b>Recommended Speedtest Server Number:</b> <span class="nems-green"><?= $speedtestserver ?></span><?php if ($speedtestwhich == 'switch') echo '<br /><b>Important Note:</b> In NEMS SST you have chosen to ignore the recommended server and instead use the one specified in the checkcommand args in NEMS NConf.'; ?></p>

<?php
if (isset($statlog) && is_array($statlog)) {

0 comments on commit 4941f0c

Please sign in to comment.
You can’t perform that action at this time.