1 | 1 | simandl | package HotSaNICmod::common; |
2 | | | |
3 | | | sub version { |
4 | | | ($VERSION = '$Revision: 1.6 $') =~ s/.*(\d+\.\d+).*/$1/; |
5 | | | return "common.pm $VERSION"; |
6 | | | } |
7 | | | |
8 | | | sub configure { |
9 | | | return HotSaNICparser::get_moduleconfig(".",(METHOD=>"var","STREAM"=>"array")); |
10 | | | } |
11 | | | |
12 | | | sub get_names { |
13 | | | my $entry=shift || ","; |
14 | | | my $host=""; |
15 | | | my $community=""; |
16 | | | |
17 | | | my ($item,$description,$speed)=split /,/,$entry; |
18 | | | if( index($item, "SNMP:") >= 0) { (undef,$host,$community,$item) = split /:/, $item; } |
19 | | | if ($host ne "") { $name="$host:$item"; } |
20 | | | else { $name=$item; } |
21 | | | ($dbname=$name) =~ s/^http:\/\///g; |
22 | | | $dbname =~ s/\//_/g; |
23 | | | $dbname =~ s/:/_/g; |
24 | | | ($file=$dbname) =~ s/[.:]/_/g; |
25 | | | |
26 | | | return ($host,$community,$item,$dbname,$name,$file,$description); |
27 | | | } |
28 | | | |
29 | | | 1; |
30 | | | |