Some node filespace stats

This commit is contained in:
Deon George 2012-12-13 15:46:25 +11:00
parent 1c7c79f89c
commit e7e3e42ba2
6 changed files with 140 additions and 2 deletions

View File

@ -160,7 +160,8 @@ class Model_ACTLOG extends ORM_TSM {
switch ($m[2]) { switch ($m[2]) {
case 'GB': $y *= 1024; case 'GB': $y *= 1024;
case 'MB': $y *= 1024; case 'MB': $y *= 1024;
case 'KB': $y *= 1024; break;
case 'KB': $y /= 1024;
} }
} }

View File

@ -146,6 +146,49 @@ class Model_FILESPACE extends ORM_TSM {
return $result; return $result;
} }
/**
* Return the physical space that has been given to TSM to store
*/
public function data_physical() {
$result = 0;
foreach ($this->_occupancy() as $oo) {
// Quick Sanity Check
if ((int)$oo->PHYSICAL_MB == 0 AND $oo->LOGICAL_MB > $oo->REPORTING_MB)
SystemMessage::add(array(
'title'=>_('TSM Data Integrity ?'),
'body'=>sprintf('While [%s] PHYSICAL_MB is (%s), LOGICAL_MB (%s) > REPORTING_MB(%s) [%s]?',$oo->FILESPACE_NAME,$oo->PHYSICAL_MB,$oo->LOGICAL_MB,$oo->REPORTING_MB,$oo->STGPOOL_NAME),
'type'=>'error',
));
elseif ((int)$oo->PHYSICAL_MB > 0 AND $oo->LOGICAL_MB > $oo->PHYSICAL_MB)
SystemMessage::add(array(
'title'=>_('TSM Data Integrity ?'),
'body'=>sprintf('While [%s] PHYSICAL_MB is (%s), LOGICAL_MB (%s) is greater [%s]?',$oo->FILESPACE_NAME,$oo->PHYSICAL_MB,$oo->LOGICAL_MB,$oo->STGPOOL_NAME),
'type'=>'error',
));
if ((int)$oo->PHYSICAL_MB > 0)
$result += $oo->PHYSICAL_MB;
else
$result += $oo->REPORTING_MB;
}
return $result;
}
/**
* Return the space that TSM is using to store this data
*/
public function data_logical() {
$result = 0;
foreach ($this->_occupancy() as $oo)
$result += $oo->LOGICAL_MB;
return $result;
}
/** /**
* Return the LOGICAL_MB that this FILESYSTEM has in a STORAGE POOL * Return the LOGICAL_MB that this FILESYSTEM has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME * @param $pool is STORAGE POOL NAME

View File

@ -507,10 +507,49 @@ class Model_NODE extends ORM_TSM {
return $result; return $result;
} }
public function file_active() {
return $this->file_byptype('ACTIVE') == 0 ? 'Unknown' : (int)$this->file_byptype('ACTIVE')/(int)$this->file_byptype('PRIMARY');
}
public function file_mediaprotection() {
return (int)$this->file_byptype('COPY')/(int)$this->file_byptype('PRIMARY');
}
public function fs() { public function fs() {
return $this->_filespaces(); return $this->_filespaces();
} }
public function fs_capacity() {
$result = 0;
foreach ($this->_filespaces() as $fso)
$result += $fso->CAPACITY;
return (int)$result;
}
public function fs_data() {
$result = 0;
foreach ($this->_filespaces() as $fso)
$result += $fso->utilsation();
return (int)$result;
}
public function fs_logical() {
$result = 0;
foreach ($this->_filespaces() as $fso)
$result += $fso->data_logical();
return (int)$result;
}
public function fs_utilisation() {
return round($this->fs_data()/$this->fs_capacity()*100,2);
}
/** /**
* Return a Graph of the BA Client Sessions * Return a Graph of the BA Client Sessions
* @param $type is Bkup/Arch/SpMg * @param $type is Bkup/Arch/SpMg

View File

@ -2,7 +2,7 @@
<table width="100%"> <table width="100%">
<tr> <tr>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/info')->set('o',$o); ?></td> <td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/info')->set('o',$o); ?></td>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/session')->set('o',$o); ?></td> <td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/stats')->set('o',$o); ?></td>
</tr> </tr>
<tr> <tr>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('domain/policy')->set('o',$o->DOMAIN); ?></td> <td style="width: 50%; vertical-align: top;"><?php echo View::factory('domain/policy')->set('o',$o->DOMAIN); ?></td>

View File

@ -0,0 +1,25 @@
<!-- $o = ORM::factory('NODE') -->
<table class="box-full">
<tr>
<td class="head" colspan="2">Filespace Stats</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td>File Space</td>
<td class="right">Data</td>
<td class="right">Backed Up</td>
<td class="right">Stored</td>
<td class="right">Ratio</td>
</tr>
<?php $i=0; foreach ($o->fs() as $fso) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><?php echo $fso->display('FILESPACE_NAME'); ?></td>
<td class="data-right"><?php echo number_format($fso->utilsation(),0,'',''); ?></td>
<td class="data-right"><?php echo number_format($fso->data_physical(),0,'',''); ?></td>
<td class="data-right"><?php echo number_format($fso->data_logical(),0,'',''); ?></td>
<td class="data-right"><?php echo $fso->utilsation() ? number_format($fso->data_logical()/$fso->utilsation(),2) : 'N/A'; ?></td>
</tr>
<?php } ?>
</table>

View File

@ -0,0 +1,30 @@
<!-- $o = ORM::factory('NODE') -->
<table class="box-full">
<tr>
<td class="head" colspan="2">Node Stats</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td style="width: 40%;">Files Protected</td>
<td style="width: 60%;" class="data"><?php echo $o->file_byptype('PRIMARY'); ?></td>
</tr>
<tr>
<td>Files on Copy Media</td>
<td class="data"><?php echo $o->file_byptype('COPY'); ?> (<?php echo $o->file_mediaprotection(); ?>%)</td<>
</tr>
<tr>
<td>Active Files on the Node</td>
<td class="data"><?php echo $o->file_active(); ?></td<>
</tr>
<tr>
<td>Data on Node</td>
<td class="data"><?php printf('%s/%s (%s%%)',$o->fs_data(),$o->fs_capacity(),$o->fs_utilisation()); ?></td>
</tr>
<tr>
<td>Data in TSM</td>
<td class="data"><?php printf('%s Ratio: %s',$o->fs_logical(),number_format($o->fs_logical()/$o->fs_data(),2)); ?></td>
</tr>
</table>
<?php echo View::factory('node/filespace_stats')->set('o',$o); ?>