jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [part/] [platform/] [default.pm] - Blame information for rev 34

 

Line No. Rev Author Line
11simandlpackage HotSaNICmod::OSdep;
2 
3sub version {
4 ($VERSION = '$Revision: 1.20 $') =~ s/.*(\d+\.\d+).*/$1/;
5 return "default.pm $VERSION";
6 }
7 
8sub sample {
9 my %args=@_;
10 
11 if (@{$args{DRIVE}} > 0) {
12 
13 undef my %devmax;
14 undef my %devuse;
15 
16 # sample all currently available partitions using "df" system command.
17 #
18 $old="";
19 if ( ($args{NFSPARTS} == 0) and (defined $args{"df -l"}) ) { @diskfree = grep(/\//,`df -lk`); }
20 else { @diskfree = grep(/\//,`df -k`); }
21 
22 foreach $_ (@diskfree) {
23 $_="$old $_";
24 $old="";
25 chomp;
26 ($dev,$max,$use) = split;
27 if ((!defined $use) || ($use eq "")) { $old=$_; next; } # check for line-break
28 
29 $max*=1024 if defined $max;
30 $use*=1024 if defined $use;
31 
32 $devmax{$dev}=$max;
33 $devuse{$dev}=$use;
34 }
35 
36 # check which drives should be sampled
37 #
38 foreach my $entry (@{$args{DRIVE}}) {
39 ($host,$community,$item,$dbname,$name,$file,$description)=HotSaNICmod::common::get_names($entry);
40 if ($host eq "") {
41 $devmax{$item} = "U" if ! defined $devmax{$item};
42 $devuse{$item} = "U" if ! defined $devuse{$item};
43 HotSaNICmod::do_rrd($dbname,"U",time,$devmax{$name},$devuse{$name});
44 }
45 }
46 }
47 }
48 
491;
50 

Powered by WebSVN 2.2.1