Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ($_GET["server"] == "" ) {
- if ($handle = opendir('/opt/usergraph')) {
- while (false !== ($file = readdir($handle))) {
- if ( is_dir($file) && ! (preg_match("/^\./", $file)) ){
- print "<a href=\"cpu.php?server=$file\">$file</a><br/>";
- }
- }
- closedir($handle);
- }
- } else {
- $server = $_GET["server"];
- print "<h1>$server</h1>";
- if ( is_dir("/opt/usergraph/$server") && ($handle = opendir("/opt/usergraph/$server")) ) {
- print "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
- $usernames = array();
- while (false !== ($file = readdir($handle))) {
- if ( is_file("/opt/usergraph/$server/$file") && (preg_match("/^\w+\.rrd/", $file)) ){
- $name = preg_split("/\.rrd/", $file);
- $usernames[] = $name[0];
- }
- }
- sort($usernames);
- for ($i=0; $i<count($usernames); $i++ ) {
- $username = $usernames[$i];
- $time = time();
- print "<tr align=\"center\" bgcolor=\"#999999\">
- <td>".$username."</td>
- <td><a href=\"/cgi-bin/mkgraph.pl?username=".$username."&server=". $server. "&start=".($time - 24*60*60)."\">CPU usage за день</a></td>
- <td><a href=\"/cgi-bin/mkgraph.pl?username=".$username."&server=". $server. "&start=".($time - 24*60*60*7)."\">CPU usage за неделю</a></td>
- <td><a href=\"/cgi-bin/mkgraph.pl?username=".$username."&server=". $server. "&start=".($time - 24*60*60*30)."\">CPU usage за месяц</a></td>
- </tr>";
- }
- print "</table>";
- closedir($handle);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement