1 | 1 | simandl | package HotSaNICmod::common; |
2 | | | |
3 | | | sub version { |
4 | | | ($VERSION = '$Revision: 1.3 $') =~ s/.*(\d+\.\d+).*/$1/; |
5 | | | return "common.pm $VERSION"; |
6 | | | } |
7 | | | |
8 | | | sub configure { |
9 | | | my $num=0; |
10 | | | foreach (@_) { |
11 | | | ($var,$value)=HotSaNICparser::parse_line($_); |
12 | | | if ($var eq "PARALLEL") { $MODARGS{PARALLEL}=$value; } |
13 | | | if ($var eq "INTERVAL") { $MODARGS{INTERVAL}=$value; } |
14 | | | if ($var eq "SYSPING") { $MODARGS{SYSPING}=$value; } |
15 | | | if ($var eq "PROTOCOL") { $MODARGS{PROTOCOL}=$value; } |
16 | | | if ($var eq "HOST") { |
17 | | | my ($ip,$name)=split(/,/,$value); |
18 | | | $MODARGS{"HOST:$ip"}=$name; |
19 | | | } |
20 | | | } |
21 | | | |
22 | | | # apply default values if needed |
23 | | | if ( (!defined $MODARGS{PROTOCOL}) || ( index("tcpicmp",$MODARGS{PROTOCOL}) <0) ) { $MODARGS{PROTOCOL}="icmp"; } |
24 | | | |
25 | | | # check requirements |
26 | | | # |
27 | | | eval { require Net::Ping; }; |
28 | | | if ($@) { |
29 | | | HotSaNICmod::dupe_control("warn",$ARGS{"MODNAME"},"$0: Perlmodule Net::Ping not installed - falling back to system's ping command."); |
30 | | | $MODARGS{SYSPING}=1; |
31 | | | } |
32 | | | return %MODARGS |
33 | | | } |
34 | | | |
35 | | | 1; |
36 | | | |