2011-03-09 Ramon Novoa <rnovoa@artica.es>
* pandora_agent: Added a module to get the ocupied space % in a partition. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4072 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
7a09b93afc
commit
d3701182d0
|
@ -1,3 +1,8 @@
|
||||||
|
2011-03-09 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* pandora_agent: Added a module to get the ocupied space % in a
|
||||||
|
partition.
|
||||||
|
|
||||||
2011-02-23 Ramon Novoa <rnovoa@artica.es>
|
2011-02-23 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* DEBIAN/postinst: Updated.
|
* DEBIAN/postinst: Updated.
|
||||||
|
|
|
@ -353,6 +353,9 @@ sub read_config (;$) {
|
||||||
} elsif ($line =~ /^\s*module_freepercentdisk\s+(.*)$/) {
|
} elsif ($line =~ /^\s*module_freepercentdisk\s+(.*)$/) {
|
||||||
$module->{'func'} = \&module_freepercentdisk;
|
$module->{'func'} = \&module_freepercentdisk;
|
||||||
$module->{'params'} = $1;
|
$module->{'params'} = $1;
|
||||||
|
} elsif ($line =~ /^\s*module_ocupiedpercentdisk\s+(.*)$/) {
|
||||||
|
$module->{'func'} = \&module_ocupiedpercentdisk;
|
||||||
|
$module->{'params'} = $1;
|
||||||
} elsif ($line =~ /^\s*module_max\s+(.*)\s*$/) {
|
} elsif ($line =~ /^\s*module_max\s+(.*)\s*$/) {
|
||||||
$module->{'max'} = $1;
|
$module->{'max'} = $1;
|
||||||
} elsif ($line =~ /^\s*module_min\s+(.*)\s*$/) {
|
} elsif ($line =~ /^\s*module_min\s+(.*)\s*$/) {
|
||||||
|
@ -1047,6 +1050,24 @@ sub module_freepercentdisk ($) {
|
||||||
return ($availp);
|
return ($availp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Get the ocupied space in a partition in %.
|
||||||
|
################################################################################
|
||||||
|
sub module_ocupiedpercentdisk ($) {
|
||||||
|
my $module = shift;
|
||||||
|
|
||||||
|
# Check module parameters
|
||||||
|
return () unless ($module->{'params'} ne '');
|
||||||
|
|
||||||
|
# Data collection layer
|
||||||
|
load_parts ();
|
||||||
|
|
||||||
|
return () unless defined ($Parts{$module->{'params'}}) and defined ($Parts{$module->{'params'}}{'avail'});
|
||||||
|
|
||||||
|
my $ocupiedp = sprintf("%d", ($Parts{$module->{'params'}}{'total'} - $Parts{$module->{'params'}}{'avail'}) * 100 / $Parts{$module->{'params'}}{'total'});
|
||||||
|
return ($ocupiedp);
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Get the CPU usage %.
|
# Get the CPU usage %.
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
Loading…
Reference in New Issue