Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cat disk_use.php
- <?php
- /*
- online status.php scripts
- based on the scripts of Matthew Miller, Aug 2009.
- Modified and improved by Cornelis Oud.
- Copyright (C) 2010.
- Modified and improved by Michael Zoon
- Copyright (C) 2012 Michael Zoon <michael.zoon@freenas.org>.
- All rights reserved.
- Webservice plugin for FreeNAS (http://www.freenas.org)
- FreeNAS Copyright (C) 2005-2012 Olivier Cochard-Labbe <olivier@freenas.org>.
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
- include_once("bar.php");
- putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin/");
- function DiskUse()
- {
- // $out = "<fieldset><legend>Disk Usage</legend><table border=1>";
- // $out .= "<tr>";
- // $out .= "<th>Filesystem</th>";
- // $out .= "<th>Size</th>";
- // $out .= "<th>Used</th>";
- // $out .= "<th>Free</th>";
- // $out .= "<th>Capacity</th>";
- // $out .= "<th>Mounted</th>";
- // $out .= "</tr>";
- // Invoke bsd command
- $stats = `df -hT`;
- // Clean up the string
- // while(strpos($stats, " "))
- // $stats = trim(str_replace(" ", " ", $stats));
- // Convert to array
- // $stats = explode("\n", $stats);
- // for($i = 1; $i < count($stats); $i++)
- // {
- // $row = explode(" ", $stats[$i]);
- // if($row[0] != "devfs" && $row[0] != "procfs")
- // {
- // $out .= "<tr>";
- // $out .= "<td>".$row[0]."</td>";
- // $out .= "<td>".$row[1]."</td>";
- // $out .= "<td>".$row[2]."</td>";
- // $out .= "<td>".$row[3]."</td>";
- // $out .= "<td>".inline_bar("", percent_bar(substr($row[4], 0, -1)), $row[4])."</td>";
- // $out .= "<td>".$row[5]."</td>";
- // $out .= "</tr>";
- // }
- // }
- // $out .= "</table></fieldset>\n\n";
- $out = "<fieldset><legend>Disk Usage</legend><pre>";
- $out .= $stats;
- $out .= "</pre></fieldset>\n\n";
- return $out;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement