1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
<!DOCTYPE html>
<?php
$start=0;
$stop=0;
if ($_GET["start"] == 1){
exec("wakeonlan D0:BF:9C:45:2B:48");
header('Location: index.php');
}
if ($_GET["stop"] == 1){
exec("ssh root@192.168.0.15 poweroff");
header('Location: index.php');
}
if ($_GET["dsmstart"] == 1){
exec('ssh root@192.168.0.15 vim-cmd vmsvc/power.on 1');
header('Location: index.php');
}
if ($_GET["dsmstop"] == 1){
exec("ssh root@192.168.0.15 vim-cmd vmsvc/power.off 1");
header('Location: index.php');
}
if ($_GET["dsmpause"] == 1){
exec("ssh root@192.168.0.15 vim-cmd vmsvc/power.suspend 1");
header('Location: index.php');
}
if ($_GET["dsmreboot"] == 1){
exec("ssh root@192.168.0.15 vim-cmd vmsvc/power.reboot 1");
header('Location: index.php');
}
if ($_GET["pfsensestart"] == 1){
exec('ssh root@192.168.0.15 vim-cmd vmsvc/power.on 2');
header('Location: index.php');
}
if ($_GET["pfsensestop"] == 1){
exec("ssh root@192.168.0.15 vim-cmd vmsvc/power.off 2");
header('Location: index.php');
}
if ($_GET["pfsensepause"] == 1){
exec("ssh root@192.168.0.15 vim-cmd vmsvc/power.suspend 2");
header('Location: index.php');
}
if ($_GET["pfsensereboot"] == 1){
exec("ssh root@192.168.0.15 vim-cmd vmsvc/power.reboot 2");
header('Location: index.php');
}
exec("ping -c1 192.168.0.15 | tail -n 2 | head -n 1 | cut -d' ' -f 4",$retour);
if ($retour[0] == '1'){
$message = "Le Serveur ESXI est allumé";
}
else{
$message = "Le serveur est éteint";
}
?>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Power Serveur</title>
<link rel="stylesheet" href="style.css" />
<!-- Icons -->
<link rel="apple-touch-icon-precomposed" href="iconMobile.png">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<!-- Mobile -->
<meta name="viewport" content="width=device-width" />
<meta name="theme-color" content="#2180e0">
</head>
<body>
<header>
<h1>Serveur</h1>
</header>
<section>
<article>
<h2>Alimentation</h2>
<p><?php echo $message; ?></p>
<a href="index.php?start=1">Allumer</a> | <a href="index.php?stop=1">Éteindre</a>
</article>
<article <?php if ($retour[0] != '1'){ echo "style=\"display:none\""; } ?>>
<h2>Machines Virtuelles</h2>
<table>
<tr>
<td class="titreTD">Nom</td>
<td class="titreTD">VMid</td>
<td class="titreTD">WorldID</td>
<td class="titreTD">Etat</td>
<td class="titreTD">Actions</td>
<td class="titreTD">Date d'uptime</td>
<td class="titreTD">Heure d'uptime</td>
</tr>
<tr>
<td><?php echo "DSM";?></td>
<td><?php echo "1";?></td>
<td><?php echo exec("ssh root@192.168.0.15 esxcli vm process list | grep World | head -n 1");?></td>
<td><?php echo exec("ssh root@192.168.0.15 vim-cmd vmsvc/power.getstate 1");?></td>
<td> <a href="index.php?dsmstart=1"><img src="start.png" alt="start"/></a>
<a href="index.php?dsmpause=1"><img src="pause.png" alt="pause"/></a>
<a href="index.php?dsmstop=1"><img src="stop.png" alt="stop"/></a>
<a href="index.php?dsmreboot=1"><img src="reboot.png" alt="reboot"/></a>
</td>
<td><?php echo exec("ssh root@192.168.0.15 vim-cmd vmsvc/get.runtime 1 | grep bootTime | cut -d ' ' -f6 | cut -d \"\" -f2 | cut -d T -f1 | cut -c 2-11");?></td>
<td><?php echo exec("ssh root@192.168.0.15 vim-cmd vmsvc/get.runtime 1 | grep bootTime | cut -d ' ' -f6 | cut -d \"\" -f2 | cut -d T -f2 | cut -c 1-8");?></td>
</tr>
<tr>
<td><?php echo "pfSense";?></td>
<td><?php echo "2";?></td>
<td><?php echo exec("ssh root@192.168.0.15 esxcli vm process list | grep World | head -n 2");?></td>
<td><?php echo exec("ssh root@192.168.0.15 vim-cmd vmsvc/power.getstate 2");?></td>
<td> <a href="index.php?pfsensestart=1"><img src="start.png" alt="start"/></a>
<a href="index.php?pfsensepause=1"><img src="pause.png" alt="pause"/></a>
<a href="index.php?pfsensestop=1"><img src="stop.png" alt="stop"/></a>
<a href="index.php?pfsensereboot=1"><img src="reboot.png" alt="reboot"/></a>
</td>
<td><?php echo exec("ssh root@192.168.0.15 vim-cmd vmsvc/get.runtime 2 | grep bootTime | cut -d ' ' -f6 | cut -d \"\" -f2 | cut -d T -f1 | cut -c 2-11");?> </td>
<td><?php echo exec("ssh root@192.168.0.15 vim-cmd vmsvc/get.runtime 2 | grep bootTime | cut -d ' ' -f6 | cut -d \"\" -f2 | cut -d T -f2 | cut -c 1-8");?></td>
</tr>
</table>
</article>
<article>
<h2>Liens</h2>
<p><a href="http://192.168.0.15">ESXI</a></p>
<p><a href="http://192.168.0.100:8280/">Haproxy</a></p>
</article>
</section>
<footer></footer>
</body>
</html> |
Partager