jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [sensors/] [platform/] [linux.pm] - Rev 32 Go to most recent revision

Compare with Previous - Blame - Download


package HotSaNICmod::OSdep;

use RRDs;

sub version {
  ($VERSION = '$Revision: 1.9 $') =~ s/.*(\d+\.\d+).*/$1/;
  return "$^O.pm $VERSION";
  }

sub sample {
  my %args=@_;

  foreach $entry (@{$args{SENSOR}}) {
    my (undef,undef,$item,$dbname,undef,undef,undef,$num,$scale,$add)=HotSaNICmod::common::get_names($entry);
    ($file)=split /\s+/,$item;
    if (-e $file) {
      open(DEVFILE,"$item") || HotSaNIClog::error("Unable to open $item.");
      my $line=<DEVFILE>;
      chomp $line;
      close DEVFILE;
      my @array=split /\s+/,$line;
      my $value=$array[$num-1]*$scale+$add;
            
      HotSaNICmod::do_rrd($dbname,"50000",time,$value);
      }
    }
  }

1;


Powered by WebSVN 2.2.1