-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemory.php
More file actions
73 lines (54 loc) · 1.91 KB
/
memory.php
File metadata and controls
73 lines (54 loc) · 1.91 KB
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
<?php
@session_start();
if (!isset($_SESSION['user'])) {
header("Location: login.php");
}
include_once 'parts/header.php';
$disk_usage = shell_exec('df -BM');
//build array from df
$disks = array();
foreach(explode("\n", $disk_usage) as $line) {
$partition = array();
$found = preg_match_all("/([^\s].+?)\s/", $line, $partition);
if ($found) {
$disks[] = $partition[1];
}
}
array_shift($disks); //remove the headers at the start of array
$cpu = shell_exec('mpstat | grep "all"');
$mem_free = shell_exec('free -m');
?>
<body>
<?php include_once 'parts/nav.php';?>
<!-- start: Content -->
<div id="content" class="span10">
<ul class="breadcrumb">
<li>
<a href="index.php"><i class="icon-home"></i> Home</a>
<i class="icon-angle-right"></i>
</li>
<li>
<a href="memory.php"><i class="icon-dashboard"></i> Memory</a>
</li>
</ul>
<div class="row-fluid">
<h1 class="page-header">Memory</h1>
<div class="row">
<div class="span7" id="chart_div" style="width: 90%; height: 250px;"></div>
<div class="span6">
<label>Physical memory</label>
<div class="span7" id="cpu_div" style="width: 20%;"></div>
</div>
</div>
<label>Memory usage</label>
<pre><?php echo($mem_free); ?></pre>
</div>
<!-- end: Content -->
</div><!--/#content.span10-->
</div><!--/fluid-row-->
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}"></script>
<script>var disks = <?php echo(json_encode($disks)); ?>;</script>
<script type="text/javascript" src="js_lib/monitor.js"></script>
<?php include_once 'parts/bottom.php';?>
</body>
</html>