1 | 1 | simandl | package HotSaNICmod::common; |
2 | | | |
3 | | | sub version { |
4 | | | ($VERSION = '$Revision: 1.8 $') =~ s/.*(\d+\.\d+).*/$1/; |
5 | | | return "common.pm $VERSION"; |
6 | | | } |
7 | | | |
8 | | | sub configure { |
9 | | | my %MODCONF=HotSaNICparser::get_moduleconfig(".",(NUMCPU=>"var",CPUGRAPH=>"var",CPU_SHOW_MAX=>"bool",USERS_SHOW_TOTAL=>"bool",SECTIONS=>"var","HOST"=>"array",IRQ=>"array")); |
10 | | | |
11 | | | # convert old settings |
12 | | | # |
13 | | | if ($MODCONF{CPUGRAPH} ne "") { $MODCONF{"GRAPH_BASE.CPU"}=$MODCONF{CPUGRAPH}; } |
14 | | | 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,?"); } |
15 | | | if (@{$MODCONF{HOST}}) { $MODCONF{USE_SNMP}=1; } |
16 | | | $MODCONF{SECTIONS} =~ s/int/irq/g; |
17 | | | return %MODCONF; |
18 | | | } |
19 | | | |
20 | | | sub get_names { |
21 | | | my $entry=shift || ","; |
22 | | | my $host=""; |
23 | | | my $community=""; |
24 | | | |
25 | | | my ($item,$description,$targets)=split /,/,$entry; |
26 | | | $targets =~ s/int/irq/g; |
27 | | | if( index($item, "SNMP:") >= 0) { (undef,$host,$community,$item) = split /:/, $item; } |
28 | | | if ($host ne "") { $name="$host"; } |
29 | | | else { $name=$host; } |
30 | | | ($dbname=$name) =~ s/:/_/g; |
31 | | | ($file=$name) =~ s/[.:]/_/g; |
32 | | | |
33 | | | return ($host,$community,$item,$dbname,$name,$file,$description,$targets); |
34 | | | } |
35 | | | |
36 | | | 1; |
37 | | | |