jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [part/] [platform/] [default.pm] - Rev 13 Go to most recent revision

Compare with Previous - Blame - Download


package HotSaNICmod::OSdep;

sub version {
  ($VERSION = '$Revision: 1.20 $') =~ s/.*(\d+\.\d+).*/$1/;
  return "default.pm $VERSION";
  }

sub sample {
  my %args=@_;

  if (@{$args{DRIVE}} > 0) {

    undef my %devmax;
    undef my %devuse;

    # sample all currently available partitions using "df" system command.
    #
    $old="";
    if ( ($args{NFSPARTS} == 0) and (defined $args{"df -l"}) ) { @diskfree = grep(/\//,`df -lk`); }
    else { @diskfree = grep(/\//,`df -k`); }
      
    foreach $_ (@diskfree) {
      $_="$old $_";
      $old="";
      chomp;
      ($dev,$max,$use) = split;
      if ((!defined $use) || ($use eq "")) { $old=$_; next; }   # check for line-break

      $max*=1024 if defined $max;
      $use*=1024 if defined $use;

      $devmax{$dev}=$max;
      $devuse{$dev}=$use;
      }

    # check which drives should be sampled
    #
    foreach my $entry (@{$args{DRIVE}}) {
      ($host,$community,$item,$dbname,$name,$file,$description)=HotSaNICmod::common::get_names($entry);
      if ($host eq "") {
        $devmax{$item} = "U" if ! defined $devmax{$item};
        $devuse{$item} = "U" if ! defined $devuse{$item};
        HotSaNICmod::do_rrd($dbname,"U",time,$devmax{$name},$devuse{$name});
        }
      }
    }
  }

1;


Powered by WebSVN 2.2.1