hotsanic |
Subversion Repositories: |
Compare with Previous - Blame - Download
package HotSaNICmod::common;
sub version {
($VERSION = '$Revision: 1.8 $') =~ s/.*(\d+\.\d+).*/$1/;
return "common.pm $VERSION";
}
sub configure {
my %MODCONF=HotSaNICparser::get_moduleconfig(".",(NUMCPU=>"var",CPUGRAPH=>"var",CPU_SHOW_MAX=>"bool",USERS_SHOW_TOTAL=>"bool",SECTIONS=>"var","HOST"=>"array",IRQ=>"array"));
# convert old settings
#
if ($MODCONF{CPUGRAPH} ne "") { $MODCONF{"GRAPH_BASE.CPU"}=$MODCONF{CPUGRAPH}; }
if (! @{$MODCONF{IRQ}}) { @{$MODCONF{IRQ}}=("0,timer","1,kbd","2,casc","3,ser1","4,ser2","5,?","6,fdd","7,lpt","8,rtc","9,?","10,?","11,?","12,?","13,CoPro","14,?","15,?"); }
if (@{$MODCONF{HOST}}) { $MODCONF{USE_SNMP}=1; }
$MODCONF{SECTIONS} =~ s/int/irq/g;
return %MODCONF;
}
sub get_names {
my $entry=shift || ",";
my $host="";
my $community="";
my ($item,$description,$targets)=split /,/,$entry;
$targets =~ s/int/irq/g;
if( index($item, "SNMP:") >= 0) { (undef,$host,$community,$item) = split /:/, $item; }
if ($host ne "") { $name="$host"; }
else { $name=$host; }
($dbname=$name) =~ s/:/_/g;
($file=$name) =~ s/[.:]/_/g;
return ($host,$community,$item,$dbname,$name,$file,$description,$targets);
}
1;