1 | 1 | simandl | package HotSaNICmod::common; |
2 | | | |
3 | | | sub version { |
4 | | | ($VERSION = '$Revision: 1.10 $') =~ s/.*(\d+\.\d+).*/$1/; |
5 | | | return "common.pm $VERSION"; |
6 | | | } |
7 | | | |
8 | | | sub configure { |
9 | | | my %MODCONF=HotSaNICparser::get_moduleconfig(".",(DRIVE=>"array")); |
10 | | | |
11 | | | $MODCONF{NFSPARTS}=0; |
12 | | | foreach my $dev (@{$MODCONF{DRIVE}}) { |
13 | | | if ( index($dev,":") >0 ) { $MODCONF{NFSPARTS}++; } |
14 | | | if ( index($dev,"SNMP:") >=0) { $MODCONF{USE_SNMP}=1; } |
15 | | | } |
16 | | | |
17 | | | # check if "df" command supports the "-l" option |
18 | | | my $RC=system "df -l >/dev/null 2>&1"; |
19 | | | if ($RC == 0) { $MODCONF{"df -l"}=1; } |
20 | | | return %MODCONF |
21 | | | } |
22 | | | |
23 | | | sub get_names { |
24 | | | my $entry=shift || ","; |
25 | | | my $host=""; |
26 | | | my $community=""; |
27 | | | |
28 | | | my ($item,$description)=split /,/,$entry; |
29 | | | if( index($item, "SNMP:") >= 0) { (undef,$host,$community,$item) = split /:/, $item; } |
30 | | | if ($host ne "") { $name="$host:$item"; } |
31 | | | else { $name=$item; } |
32 | | | ($dbname=$name) =~ s/[\/:]/_/g; |
33 | | | ($file=$dbname) =~ s/^_*//g; |
34 | | | |
35 | | | return ($host,$community,$item,$dbname,$name,$file,$description); |
36 | | | } |
37 | | | 1; |
38 | | | |