1. Import
This commit is contained in:
89
html/sysadmin/monitor_capacity.php
Normal file
89
html/sysadmin/monitor_capacity.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/*=======================================================================
|
||||
*
|
||||
* monitor_capacity.php
|
||||
*
|
||||
* Autor: Marc Vollmann
|
||||
*
|
||||
=======================================================================*/
|
||||
|
||||
|
||||
include_once ("../include/mcglobal.inc.php");
|
||||
|
||||
getSecHttpVars("1",array("serverName","mountedVolume", "volumeSpace","showtitle"));
|
||||
|
||||
if (!isset($serverName) || $serverName == "") : $serverName = "???"; endif;
|
||||
if (!isset($mountedVolume) || $mountedVolume == "") : $mountedVolume = "home"; endif;
|
||||
if (!isset($showtitle) || $showtitle == "") : $showtitle = ""; endif;
|
||||
|
||||
|
||||
$currentTime = getDateTime("0");
|
||||
|
||||
$volumeSpace = "";
|
||||
$out = shell_exec("df -h");
|
||||
$tmpPos = strpos($out, "/" . $mountedVolume);
|
||||
if (!($tmpPos === false)) :
|
||||
$volumeSpace = substr($out, $tmpPos - 4, 2);
|
||||
else :
|
||||
$volumeSpace = "--%";
|
||||
endif;
|
||||
?>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var refreshStatus = 1;
|
||||
var statusMessage = "<?php echo $statusMessage ?>";
|
||||
|
||||
function displayStatusMessage() {
|
||||
if (statusMessage != "") {
|
||||
alert(statusMessage);
|
||||
}
|
||||
};
|
||||
|
||||
function startReload() {
|
||||
if (refreshStatus == 1) {
|
||||
// self.location.reload();
|
||||
document.forms[0].submit();
|
||||
}
|
||||
}
|
||||
|
||||
function startTimeout() {
|
||||
self.setTimeout("startReload()", 1000000);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onLoad="startTimeout();displayStatusMessage();">
|
||||
|
||||
<form action="../sysadmin/monitor_capacity.php" method="post">
|
||||
|
||||
<input type="hidden" name="serverName" value="<?php echo $serverName ?>">
|
||||
<input type="hidden" name="mountedVolume" value="<?php echo $mountedVolume ?>">
|
||||
<input type="hidden" name="showtitle" value="<?php echo $showtitle ?>">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php if ($showtitle != "") : ?>
|
||||
<b>VOLUME SPACE:</b>
|
||||
<?php endif; ?>
|
||||
<span class="f7np1">(<?php echo substr($currentTime,-8) ?>)</span>
|
||||
</td>
|
||||
<?php
|
||||
echo "<td class=\"f8np1\"> " . $serverName . ": </td><td class=\"" . ($volumeSpace < "90" ? "f8np1_darkgreen\">" . $volumeSpace . "" : "f8np1_red\">" . $volumeSpace) . "%</td>\n";
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user