jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [part/] [platform/] [common.pm] - Rev 1

Compare with Previous - Blame - Download


package HotSaNICmod::common;

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

sub configure {
  my %MODCONF=HotSaNICparser::get_moduleconfig(".",(DRIVE=>"array"));

  $MODCONF{NFSPARTS}=0;
  foreach my $dev (@{$MODCONF{DRIVE}}) {
    if ( index($dev,":") >0 ) { $MODCONF{NFSPARTS}++; }
    if ( index($dev,"SNMP:") >=0) { $MODCONF{USE_SNMP}=1; }
    }

# check if "df" command supports the "-l" option
  my $RC=system "df -l >/dev/null 2>&1";
  if ($RC == 0) { $MODCONF{"df -l"}=1; }
  return %MODCONF
  }

sub get_names {
  my $entry=shift || ",";
  my $host="";
  my $community="";

  my ($item,$description)=split /,/,$entry;
  if( index($item, "SNMP:") >= 0) { (undef,$host,$community,$item) = split /:/, $item; }
  if ($host ne "") { $name="$host:$item"; }
  else { $name=$item; }
  ($dbname=$name) =~ s/[\/:]/_/g;
  ($file=$dbname) =~ s/^_*//g;

  return ($host,$community,$item,$dbname,$name,$file,$description);
  }
1;


Powered by WebSVN 2.2.1