From e7e3e42ba2971c2f93650973f7aa45f3be546952 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 13 Dec 2012 15:46:25 +1100 Subject: [PATCH] Some node filespace stats --- application/classes/Model/ACTLOG.php | 3 +- application/classes/Model/FILESPACE.php | 43 ++++++++++++++++++++++ application/classes/Model/NODE.php | 39 ++++++++++++++++++++ application/views/node/detail.php | 2 +- application/views/node/filespace_stats.php | 25 +++++++++++++ application/views/node/stats.php | 30 +++++++++++++++ 6 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 application/views/node/filespace_stats.php create mode 100644 application/views/node/stats.php diff --git a/application/classes/Model/ACTLOG.php b/application/classes/Model/ACTLOG.php index 5025744..f486b24 100644 --- a/application/classes/Model/ACTLOG.php +++ b/application/classes/Model/ACTLOG.php @@ -160,7 +160,8 @@ class Model_ACTLOG extends ORM_TSM { switch ($m[2]) { case 'GB': $y *= 1024; case 'MB': $y *= 1024; - case 'KB': $y *= 1024; + break; + case 'KB': $y /= 1024; } } diff --git a/application/classes/Model/FILESPACE.php b/application/classes/Model/FILESPACE.php index ba08b66..4f4bed8 100644 --- a/application/classes/Model/FILESPACE.php +++ b/application/classes/Model/FILESPACE.php @@ -146,6 +146,49 @@ class Model_FILESPACE extends ORM_TSM { 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 * @param $pool is STORAGE POOL NAME diff --git a/application/classes/Model/NODE.php b/application/classes/Model/NODE.php index ed945f7..488b187 100644 --- a/application/classes/Model/NODE.php +++ b/application/classes/Model/NODE.php @@ -507,10 +507,49 @@ class Model_NODE extends ORM_TSM { 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() { 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 * @param $type is Bkup/Arch/SpMg diff --git a/application/views/node/detail.php b/application/views/node/detail.php index 5b72215..26307b1 100644 --- a/application/views/node/detail.php +++ b/application/views/node/detail.php @@ -2,7 +2,7 @@ - + diff --git a/application/views/node/filespace_stats.php b/application/views/node/filespace_stats.php new file mode 100644 index 0000000..17da5d4 --- /dev/null +++ b/application/views/node/filespace_stats.php @@ -0,0 +1,25 @@ + +
set('o',$o); ?>set('o',$o); ?>set('o',$o); ?>
set('o',$o->DOMAIN); ?>
+ + + + + + + + + + + + + + fs() as $fso) { ?> + + + + + + + + +
Filespace Stats
 
File SpaceDataBacked UpStoredRatio
display('FILESPACE_NAME'); ?>utilsation(),0,'',''); ?>data_physical(),0,'',''); ?>data_logical(),0,'',''); ?>utilsation() ? number_format($fso->data_logical()/$fso->utilsation(),2) : 'N/A'; ?>
diff --git a/application/views/node/stats.php b/application/views/node/stats.php new file mode 100644 index 0000000..e956a81 --- /dev/null +++ b/application/views/node/stats.php @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Node Stats
 
Files Protectedfile_byptype('PRIMARY'); ?>
Files on Copy Mediafile_byptype('COPY'); ?> (file_mediaprotection(); ?>%) +
Active Files on the Nodefile_active(); ?> +
Data on Nodefs_data(),$o->fs_capacity(),$o->fs_utilisation()); ?>
Data in TSMfs_logical(),number_format($o->fs_logical()/$o->fs_data(),2)); ?>
+set('o',$o); ?>