Open-AudIT
https://www.open-audit.org/phpBB3/

Partition free space as percentage
https://www.open-audit.org/phpBB3/viewtopic.php?f=9&t=3256
Page 1 of 1

Author:  Phydeaux [ Wed Apr 15, 2009 1:36 am ]
Post subject:  Partition free space as percentage

To me a listing of partitions with x MB free space is less meaning than a percentage of the partition free. A partition with less than 10% free will suffer somewhat if it is a system partition. I made a few changes to the code to allow this to happen, let me know if this is a good idea. Another thought I had but haven't implemented is to switch between MB and % in the config, or even include both.

index.php
[code]
DisplaySection('f4',__("Partition free space less than ").$partition_free_space.__(" MB"),'PartitionUsage','Partitions');
[/code]
change to
[code]
DisplaySection('f4',__("Partition free space less than ").$partition_free_space.__(" %"),'PartitionUsage','Partitions');
[/code]

admin_config.php
[code]
echo "<div class=\"npb_config_col\">".__("MB").":<input type='text' name='partition_free_space_post' size='4' value='$partition_free_space'></div><br >";
[/code]
change to
[code]
echo "<div class=\"npb_config_col\">".__("%").":<input type='text' name='partition_free_space_post' size='3' value='$partition_free_space'></div><br >";
[/code]

index_data.php
[code]
function GetPartitionUsageData($id)
{
global $db, $partition_free_space;
$tr_class='npb_highlight_row';

$sql = "SELECT sys.system_name, sys.net_ip_address, par.partition_uuid, par.partition_volume_name, par.partition_caption, par.partition_free_space, par.partition_size, par.partition_timestamp ";
$sql .= "FROM system sys, partition par ";
$sql .= "WHERE par.partition_free_space < '$partition_free_space' AND sys.system_uuid = par.partition_uuid AND par.partition_timestamp = sys.system_timestamp ";
$sql .= "ORDER BY sys.system_name, par.partition_caption";
[/code]
change to
[code]
function GetPartitionUsageData($id)
{
global $db, $partition_free_space;
$tr_class='npb_highlight_row';
$partition_percent = $partition_free_space *.01;

$sql = "SELECT sys.system_name, sys.net_ip_address, par.partition_uuid, par.partition_volume_name, par.partition_caption, par.partition_free_space, par.partition_size, par.partition_timestamp ";
$sql .= "FROM system sys, partition par ";
$sql .= "WHERE (par.partition_free_space / par.partition_size) < '$partition_percent' AND sys.system_uuid = par.partition_uuid AND par.partition_timestamp = sys.system_timestamp ";
$sql .= "ORDER BY sys.system_name, par.partition_caption";
[/code]

I don't know how much performance impact it will have to do the math 'on the fly' in the SQL but with my 350 systems it didn't do much of any difference.

Page 1 of 1 All times are UTC + 10 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/