/** * Get statistics * * @return void * @author **/ function get_stats($mount_point = '/') { $obj = new View(); if (!$this->authorized()) { $obj->view('json', array('msg' => array('error' => 'Not authenticated'))); return; } $disk_report = new Disk_report_model(); $out = array(); $thresholds = conf('disk_thresholds', array('danger' => 5, 'warning' => 10)); $out['thresholds'] = $thresholds; $out['stats'] = $disk_report->get_stats($mount_point, $thresholds['danger'], $thresholds['warning']); $obj->view('json', array('msg' => $out)); }
<div class="col-lg-4 col-md-6"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><i class="fa fa-hdd-o"></i> <span data-i18n="free_disk_space">Free Disk Space</span></h3> </div> <div class="panel-body text-center"> <?php $queryobj = new Disk_report_model(); $sql = "select COUNT(1) as total, COUNT(CASE WHEN FreeSpace < 10737418240 THEN 1 END) AS warning, \n\t\t\t\t\tCOUNT(CASE WHEN FreeSpace < 5368709120 THEN 1 END) AS danger FROM diskreport"; ?> <?php if ($obj = current($queryobj->query($sql))) { ?> <a href="<?php echo url('show/listing/disk#' . rawurlencode('freespace > 10GB')); ?> " class="btn btn-success"> <span class="bigger-150"> <?php echo $obj->total - $obj->warning; ?> </span><br> 10GB + </a> <a href="<?php echo url('show/listing/disk#' . rawurlencode('5GB freespace 10GB'));
/** * Get statistics * * @return void * @author **/ function get_smart_stats() { $obj = new View(); if (!$this->authorized()) { $obj->view('json', array('msg' => array('error' => 'Not authenticated'))); return; } $disk_report = new Disk_report_model(); $obj->view('json', array('msg' => $disk_report->getSmartStats())); }