jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [traffic/] [platform/] [common.pm] - Rev 21 Go to most recent revision

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(".",(SWAPIO=>"bool",DEV=>"array",STYLE=>"var",SCALE=>"var"));

  if ($MODCONF{STYLE} ne "") { $MODCONF{GRAPH_BASE}=$MODCONF{STYLE}; }
  if ($MODCONF{SCALE} ne "") {
    $MODCONF{GRAPH_MIN}=-abs($MODCONF{SCALE});
    $MODCONF{GRAPH_MAX}=abs($MODCONF{SCALE});
    if ($MODCONF{SCALE}>0 ) { $MODCONF{GRAPH_RIGID}="yes"; }
    }
  foreach (@{$MODCONF{DEV}}) { if (index($_,"SNMP:") >=0) { $MODCONF{USE_SNMP}=1; } }
  return %MODCONF;
  }

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

  my $host="";
  my $community="";

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

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

1;


Powered by WebSVN 2.2.1