Add diskspace view on masterserver

This commit is contained in:
Nexus633 2020-07-12 01:03:46 +02:00
parent 1a246b896b
commit 72795698b0
9 changed files with 70 additions and 1 deletions

View File

@ -101,6 +101,11 @@
<status_password>Passwort</status_password>
<status_server_tag>Servertag</status_server_tag>
<status_stop>Gestopt</status_stop>
<status_space>Speicher</status_space>
<status_space_mount>Eingehangen: </status_space_mount>
<status_space_size>Größe: </status_space_size>
<status_space_used>Benutzt: </status_space_used>
<status_space_free>Frei: </status_space_free>
<stop>Stoppen</stop>
<subnets>Subnets</subnets>
<substitutes>Vertreter</substitutes>

View File

@ -83,6 +83,11 @@
<status_server_tag></status_server_tag>
<status_stop></status_stop>
<stop>Stop</stop>
<status_space>Opbevaring</status_space>
<status_space_mount>Monteret: </status_space_mount>
<status_space_size>Størrelse: </status_space_size>
<status_space_used>Brugt: </status_space_used>
<status_space_free>Ledig: </status_space_free>
<subnets>Subnets</subnets>
<substitutes>Suppleanter</substitutes>
<support2>Ny Support Billet</support2>

View File

@ -106,6 +106,11 @@
<status_server_tag>Tag</status_server_tag>
<status_stop>Arrestato</status_stop>
<stop>Arresta</stop>
<status_space>Conservazione</status_space>
<status_space_mount>a Cavallo: </status_space_mount>
<status_space_size>Taglia: </status_space_size>
<status_space_used>Usato: </status_space_used>
<status_space_free>Gratuito: </status_space_free>
<subnets>Sottoreti</subnets>
<substitutes>Sostituti</substitutes>
<support2>Nuovo ticket di supporto</support2>

View File

@ -106,6 +106,11 @@
<status_server_tag>Marca</status_server_tag>
<status_stop>Parado</status_stop>
<stop>Parar</stop>
<status_space>Armazenamento</status_space>
<status_space_mount>Montado: </status_space_mount>
<status_space_size>Tamanho: </status_space_size>
<status_space_used>Usava: </status_space_used>
<status_space_free>Livre: </status_space_free>
<subnets>Subnações</subnets>
<substitutes>SubUsuários</substitutes>
<support2>Novo ticket de suporte</support2>

View File

@ -104,6 +104,11 @@
<status_server_tag>Имя бренда</status_server_tag>
<status_stop>Остановлен</status_stop>
<stop>Остановить</stop>
<status_space>Место хранения</status_space>
<status_space_mount>смонтированный: </status_space_mount>
<status_space_size>размер: </status_space_size>
<status_space_used>Используемый: </status_space_used>
<status_space_free>Свободно: </status_space_free>
<subnets>Subnets</subnets>
<substitutes>Администраторы</substitutes>
<support2>Новый тикет</support2>

View File

@ -106,6 +106,11 @@
<status_server_tag>Brandname</status_server_tag>
<status_stop>Stopped</status_stop>
<stop>Stop</stop>
<status_space>Space</status_space>
<status_space_mount>Mount: </status_space_mount>
<status_space_size>Size: </status_space_size>
<status_space_used>Used: </status_space_used>
<status_space_free>Free: </status_space_free>
<subnets>Subnets</subnets>
<substitutes>Subusers</substitutes>
<support2>New support ticket</support2>

View File

@ -158,7 +158,33 @@ while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
foreach ($sshcheck as $shorten) {
$statusList[$shorten] = false;
}
}
$array['aaData'][] = array($row['ip'], $row['id'], $description, returnButton($template_to_use, 'ajax_admin_master_list.tpl', $statusList, '', '', ''), returnButton($template_to_use, 'ajax_admin_buttons_dl.tpl', 'ma', 'dl', $row['id'], $gsprache->del) . ' ' . returnButton($template_to_use, 'ajax_admin_buttons_add.tpl', 'ma', 'ad', $row['id'], $gsprache->add));
// Add Server space data - Nexus633
$space = null;
$homespace = $rootServer->getDiskSpace("/home");
if (strlen($homespace) > 0){
$space = json_decode($homespace);
}else{
$rootspace = $rootServer->getDiskSpace("/");
if (strlen($rootspace) > 0){
$space = json_decode($rootspace);
}else{
$space = new stdClass();
$space->mount = "unknown";
$space->avil = "";
$space->used = "";
$space->size = "";
}
}
if($space->mount == "unknown"){
$spacedata = "unknown";
}else{
$spacedata = "{$gsprache->status_space_mount}{$space->mount}: {$gsprache->status_space_size}{$space->size} / {$gsprache->status_space_used}{$space->used} / {$gsprache->status_space_free}{$space->avil}";
}
$array['aaData'][] = array($row['ip'], $row['id'], $description, returnButton($template_to_use, 'ajax_admin_master_list.tpl', $statusList, '', '', ''), returnButton($template_to_use, 'ajax_admin_buttons_dl.tpl', 'ma', 'dl', $row['id'], $gsprache->del) . ' ' . returnButton($template_to_use, 'ajax_admin_buttons_add.tpl', 'ma', 'ad', $row['id'], $gsprache->add), $spacedata);
}

View File

@ -805,6 +805,17 @@ class masterServer {
return $this->sshConnectAndExecute (false, true);
}
// Add Server space data - Nexus633
public function getDiskSpace($path){
if ($this->os == 'L') {
$this->shellScript .= 'df -h | grep -w "' . $path . '" | awk \'{print "{\n \"mount\":\"' . $path . '\",\n \"filesystem\":\"" $1 "\",\n \"size\":\"" $2 "\",\n \"used\":\"" $3 "\",\n \"avil\":\"" $4 "\",\n \"perc\":\"" $5 "\"\n}"}\'' . "\n";
} else {
}
return $this->sshConnectAndExecute (false, true);
}
private function linuxMasterRemove ($shorten) {
$this->shellScript .= 'if [ -d "' . $this->masterserverDir . $shorten . '" ]; then rm -rf "' . $this->masterserverDir . $shorten . '"; fi' . "\n";
}

View File

@ -21,6 +21,7 @@
<th><?php echo $sprache->desc;?></th>
<th><?php echo $gsprache->master;?></th>
<th><?php echo $gsprache->action;?></th>
<th><?php echo $gsprache->status_space;?></th>
</tr>
</thead>
<tfoot>
@ -30,6 +31,7 @@
<th><?php echo $sprache->desc;?></th>
<th><?php echo $gsprache->master;?></th>
<th><?php echo $gsprache->action;?></th>
<th><?php echo $gsprache->status_space;?></th>
</tr>
</tfoot>
</table>