jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [diskio/] [platform/] [common.pm] - Blame information for rev 7

 

Line No. Rev Author Line
11simandlpackage HotSaNICmod::common;
2 
3sub version {
4 ($VERSION = '$Revision: 1.10 $') =~ s/.*(\d+\.\d+).*/$1/;
5 return "common.pm $VERSION";
6 }
7 
8sub configure {
9 %MODCONF=HotSaNICparser::get_moduleconfig(".",("KERNEL"=>"var","SOURCE"=>"var",DEV=>"array"));
10 if ($MODCONF{KERNEL} eq "") { $MODCONF{KERNEL}=HotSaNICparser::identify_kernel(); }
11 if ($MODCONF{SOURCE} eq "") { $MODCONF{SOURCE}=get_source(); }
12 return %MODCONF;
13 }
14 
15sub get_source {
16 my $source="stat";
17 if (-e "/proc/partitions") {
18 open FILE,"/proc/partitions";
19 my $check=<FILE>;
20 close FILE;
21 if ($check =~ /rio/) { $source="partitions"; }
22 }
23 if (-e "/proc/diskstats") {
24 open FILE,"/proc/diskstats";
25 my $check=<FILE>;
26 close FILE;
27 if ($check =~ /rio/) { $source="diskstats"; }
28 }
29 return $source;
30 }
31 
32sub get_names {
33 my $entry=shift || ",";
34 
35 my $host="";
36 my $community="";
37 
38 my ($item,$description)=split /,/,$entry;
39 if( index($item, "SNMP:") >= 0) { (undef,$host,$community,$item) = split /:/, $item; }
40 if ($host ne "") { $name="$host:$description"; }
41 else { $name=$description; }
42 $dbname=$item;
43 ($file=$name) =~ s/[\/.:]/_/g;
44 $description="device: $description";
45 
46 return ($host,$community,$item,$dbname,$name,$file,$description);
47 }
48 
491;
50 

Powered by WebSVN 2.2.1