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 | | | %MODULECONFIG=HotSaNICparser::get_moduleconfig(".",(APP=>"array")); |
10 | | | foreach (@{$MODULECONFIG{APP}}) { if ( ~/SNMP/ ) { $MODULECONFIG{USE_SNMP}=1; last; } } |
11 | | | return %MODULECONFIG; |
12 | | | } |
13 | | | |
14 | | | sub get_names { |
15 | | | my $entry=shift || ","; |
16 | | | my $host=""; |
17 | | | my $community=""; |
18 | | | |
19 | | | my ($item,$description)=split /,/,$entry; |
20 | | | if( index($item, "SNMP:") >= 0) { (undef,$host,$community,$item) = split /:/, $item; } |
21 | | | if ($host ne "") { $name="$host:$item"; } |
22 | | | else { $name=$item; } |
23 | | | ($dbname=$name) =~ s/:/_/g; |
24 | | | ($file=$name) =~ s/[.:]/_/g; |
25 | | | |
26 | | | return ($host,$community,$item,$dbname,$name,$file,$description); |
27 | | | } |
28 | | | |
29 | | | 1; |
30 | | | |